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 255787

Summary: Exporting non-public type hint looks incorrect in some cases
Product: java Reporter: Michel Graciano <hmichel>
Component: HintsAssignee: Svata Dedic <sdedic>
Status: RESOLVED INVALID    
Severity: normal    
Priority: P3    
Version: 8.1   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:
Attachments: Sample project

Description Michel Graciano 2015-10-07 20:17:51 UTC
Created attachment 156606 [details]
Sample project

Exporting non-public type hint looks incorrect in some cases. In my case, I have an implicitly public interface (with no modifier), and created a class like this:

public class PublicApi<T extends SampleInterface> {}

Now I have the hint warning me about non-public API been exposed. In fact, according to JSL, all members of interfaces lacking access modifiers are implicitly public. So my understanding here is that I am exposing a public API and the hint should not be shown IMO.

I am attaching a sample project.
Comment 1 Ralph Ruijs 2015-10-08 12:50:35 UTC
(In reply to Michel Graciano from comment #0)
> Now I have the hint warning me about non-public API been exposed. In fact,
> according to JSL, all members of interfaces lacking access modifiers are
> implicitly public. So my understanding here is that I am exposing a public
> API and the hint should not be shown IMO.

From the JLS: "Every method declaration in the body of an interface is implicitly public (ยง6.6).". This rule doesn't apply to the interface itself, which can still be "package private".