This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 186670 - Show non-public top level classes
Summary: Show non-public top level classes
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Navigation (show other bugs)
Version: 6.x
Hardware: All All
: P3 normal with 1 vote (vote)
Assignee: Tomas Zezula
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-25 14:10 UTC by ceklock
Modified: 2014-07-17 02:17 UTC (History)
3 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
navigator working as expected (32.81 KB, image/png)
2010-05-26 18:48 UTC, ceklock
Details
navigator working as expected (14.78 KB, image/png)
2010-05-26 18:49 UTC, ceklock
Details
other class (17.39 KB, image/png)
2010-05-26 18:49 UTC, ceklock
Details
other class: bug (9.16 KB, image/png)
2010-05-26 18:50 UTC, ceklock
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ceklock 2010-05-25 14:10:58 UTC
I have a problem with the option "Show non-public members" on the navigator window of NetBeans 6.9.

The problem is that I can see all members (public and non-public), but when I disable the option, to see only public members, nothing appears in the navigator window.

Product Version: NetBeans IDE 6.9 Beta (Build 201004212000)
Java: 1.6.0_18; Java HotSpot(TM) Client VM 16.0-b13
System: Windows XP version 5.1 running on x86; Cp1252; pt_BR (nb)
Comment 1 ceklock 2010-05-25 14:12:01 UTC
P.S: I also have this problem with NetBeans 6.8
Comment 2 Tomas Zezula 2010-05-26 11:36:48 UTC
Works for me. Can you attach an example file.
Thanks
Peter, can you verify it?
Thanks
Comment 3 ceklock 2010-05-26 18:48:20 UTC
Created attachment 99505 [details]
navigator working as expected
Comment 4 ceklock 2010-05-26 18:49:08 UTC
Created attachment 99506 [details]
navigator working as expected
Comment 5 ceklock 2010-05-26 18:49:48 UTC
Created attachment 99507 [details]
other class
Comment 6 ceklock 2010-05-26 18:50:15 UTC
Created attachment 99508 [details]
other class: bug
Comment 7 ceklock 2010-05-26 18:55:10 UTC
It seems the problem is happening for some specific classes...

I have attached 4 screenshots to this bug. 

The first and second screenshots show the navigator working as expected, for the same class.

The third and fourth screenshots show the navigator when I am editing other class. In the fourth screenshot you can see that nothing is appearing at the navigator.

Note the 'Show non-public members' option, selected and not selected.
Comment 8 ceklock 2010-05-26 19:05:24 UTC
As I can see now, this is not really a bug... It is because my class is not a 'public class'. It is a 'final class'.

Maybe in the future NetBeans should provide a "show not private members" option...
Comment 9 Tomas Zezula 2010-05-27 07:32:56 UTC
I agree that even when the class is non public the class should be shown.
Changing to enhancement
Comment 10 ceklock 2011-10-16 23:48:06 UTC
7.1 continues with this issue. 


Product Version: NetBeans IDE Dev (Build 201110110600)
Java: 1.6.0_27; Java HotSpot(TM) Client VM 20.2-b06
System: Windows 7 version 6.1 running on x86; Cp1252; en_BR (nb)
Comment 11 ceklock 2011-10-16 23:56:09 UTC
In short (to remember): 

when a class is not public and the option "Show non-public members" of the navigator window is not selected, nothing is displayed in the navigator window.


Product Version: NetBeans IDE Dev 7.1 (Build 201110110600)
Java: 1.6.0_27; Java HotSpot(TM) Client VM 20.2-b06
System: Windows 7 version 6.1 running on x86; Cp1252; en_BR (nb)
Comment 12 matthies 2011-10-17 11:27:58 UTC
IMO this is a bug. Whether members are public doesn't have anything to do with whether the class is public or not.
Comment 13 ceklock 2012-11-06 23:03:22 UTC
Still present in NetBeans 7.2.1.


Example code:

class Test {

    public void test() {
    }
}


when a class is not public and the option "Show non-public members" is unselected in the navigator window, nothing is displayed in the navigator window. I think public attributes and methods should be displayed even if the class is not public.
Comment 14 Tomas Zezula 2012-11-07 08:34:25 UTC
It's questionable.
In your example:

class Test {

    public void test() {
    }
}

The method should not be probably shown as the API client has no way how to access it, the type is not exported. However if I modify the example to:


class Test {

    public String toString() {
         return "";
    }
}

it probably should be shown as it's a part of the publicly accessible API overridden from j.l.Object.
Comment 15 Marian Mirilovic 2012-11-07 08:58:49 UTC
ceklock, 
please be so kind and do not change product/component/keywords/type, .... or explain why did you do so. Thanks for understanding.
Comment 16 matthies 2012-11-07 13:27:14 UTC
(In reply to comment #14)
> It's questionable.
> In your example:
> 
> class Test {
> 
>     public void test() {
>     }
> }
> 
> The method should not be probably shown as the API client has no way how to
> access it, the type is not exported.

If you take the class itself as an (mini-)API, the respective member is public in this class API, in the sense of being part of the API. Whether this class API is exposed publicly or just within its package is a separate question; usually the design of the class's API shouldn't be affected by it.

My point is this: Even if a class is package-private, it is still designed to provide/fullfill a specific contract towards its client code. "Show non-public members" is a useful switch to toggle between viewing all members and viewing just the members of the class's API towards its client code. With the current behavior, this switch becomes useless for package-private classes although it would be very useful for viewing the class's API towards its clients (which just happen to be limited to classes in the same package).
Comment 17 ceklock 2012-11-07 17:00:38 UTC
matthies: this is exactly what I was trying to say. The class is viewable in the package, but I can't view the public members because the class is not public.
Comment 18 Tomas Zezula 2012-11-07 17:31:22 UTC
OK, I will ask UI and change if they agree.
Comment 19 Petr Somol 2012-12-10 12:49:55 UTC
(In reply to comment #16)
> "Show non-public
> members" is a useful switch to toggle between viewing all members and viewing
> just the members of the class's API towards its client code. 

IMHO the above sentence from Comment #16 summarizes the core of the problem the best. The discussion is about two sides of the coin - on one hand we can follow the purist approach (as it is implemented now) and effectively render the "Show non-public members" filter unusable for non public classes, or on the other hand we can accept the view that the switch should have just local meaning regardless the global publicity of the class itself, and should just make it possible to "to toggle between viewing all members and viewing just the members of the class's API towards its client code".
It seems to me that global visibility of the class as a whole is not of importance here and now (at development stage), as it may change anyway. I can imagine working on a public class which I later decide to make package-private or vice versa, while regardless of that I would still think about some if its members as public and about others as non-public, and would want to use the switch. The mere fact that till now it has been effectively disabled for certain classes while actually it does have well-defined behavior in context of all classes feels like we are facing here a unnecessary restriction (which does not seem to help in any promotion of good coding practice or any other such concern).

Thus I vote in favor of following the other side of the coin and to implement the change in "Show non-public members" behavior.
Comment 20 Tomas Zezula 2014-07-10 09:10:01 UTC
In reply to comment #19:
>Thus I vote in favor of following the other side of the coin and to implement the >change in "Show non-public members" behaviour.
OK, I will do it.
Comment 21 Tomas Zezula 2014-07-10 09:20:08 UTC
Also yesterday I've implemented different file icons for java file types (class, interface, annotation, enum). I've looked at Idea and found that they display files with API exported classes (public) with green lock. This is nice unfortunately we already have 4 badges on file nodes and there is no place for the next one. Maybe we should reconsider importance of these 4 badges.
Comment 22 Tomas Zezula 2014-07-10 10:05:17 UTC
Fixed jet-main c29b9c9baffd
Comment 23 Quality Engineering 2014-07-17 02:17:31 UTC
Integrated into 'main-silver', will be available in build *201407170001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/c29b9c9baffd
User: Tomas Zezula <tzezula@netbeans.org>
Log: #186670: Show non-public top level classes