United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6387360 Usage of package-private class as a parameter of a method (javax.swing.text.ParagraphView)
JDK-6387360 : Usage of package-private class as a parameter of a method (javax.swing.text.ParagraphView)

Details
Type:
Bug
Submit Date:
2006-02-17
Status:
Resolved
Updated Date:
2012-03-23
Project Name:
JDK
Resolved Date:
2009-08-05
Component:
client-libs
OS:
generic
Sub-Component:
javax.swing
CPU:
generic
Priority:
P2
Resolution:
Fixed
Affected Versions:
6
Fixed Versions:

Related Reports
Relates:
Relates:
Relates:

Sub Tasks

Description
(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)

                                    

Comments
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.
                                     
2006-02-17
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.
                                     
2006-02-28
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.
                                     
2006-03-10
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.
                                     
2006-03-14
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.
                                     
2009-07-16



Hardware and Software, Engineered to Work Together