JDK-6387360 : Usage of package-private class as a parameter of a method (javax.swing.text.ParagraphView)
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2006-02-17
  • Updated: 2017-05-16
  • Resolved: 2009-08-05
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
7 b68Fixed
Related Reports
Relates :  
Relates :  
Relates :  
(Bug was originally about two different classes. I've split of part of this into 6387579).

The javax.swing.text.ParagraphView.Row package-private class is referenced to from the following method of public javax.swing.text.ParagraphView class:

protected void adjustRow(javax.swing.text.ParagraphView.Row r,
                         int desiredSpan,
                         int x)

EVALUATION This method could not have been overridden. While it might be called (with null), it is empty, so there's no reason to call it. It is neither called nor overridden inside Swing, too. This method was also marked as internal, and its use was discouraged. That said, let's remove it.

EVALUATION ###@###.### > > In your case the method > -------------- > protected void adjustRow(javax.swing.text.ParagraphView.Row r, > int desiredSpan, > int x) > -------------- > could never be neither called nor overridden in user applications, so > from this point there seem to be no risk to make it private or remove. I am afraid I have to disagree with you. This method could have been called. -- ParagraphViewTest.java import javax.swing.text.*; public class ParagraphViewTest { public static void main(String[] args) { Document doc = new DefaultStyledDocument(); new MyPargraphView(doc.getRootElements()[0]); } static class MyPargraphView extends ParagraphView { public MyPargraphView(Element elem) { super(elem); adjustRow(null, 100, 0); } } } -- This code comiples and runs. If we are to remove ParagraphView.adjustRow this test case will not compile. > There still presents another choice - to make > javax.swing.text.ParagraphView.Row public. It would be a bad choice from the API prospective. ParagraphView.Row is not meant to be public. There are three choices here: 1. remove ParagraphView.adjustRow 2. make ParagraphView.Row public 3. close the bug as will not fix From my prospective first two choices are unacceptable.

EVALUATION see 6387579 Usage of package-private class as parameter of a method (javax.swing.tree.DefaultTreeSelectionModel) for more details. I'm closing out as will not fix.

EVALUATION I am not sure what we should do in this case. This method should not have been created in a first place. But I am not sure if we can remove this method. Will see what the descion will be for 6387579 [Usage of package-private class as parameter of a method (javax.swing.tree.DefaultTreeSelectionModel)] It would be much easer if compiler would issue warning on that. Visibility of the argument types should not be stricter than the visibility of the method itself.

EVALUATION This was file a long time ago as 4350413, at which time I simply documented that it's for internal use. We should lobby to remove this now. It could never have been called.