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 124147

Summary: Add a warning/hint when a public class implements a non-public interface
Product: java Reporter: matthies <matthies>
Component: HintsAssignee: Svata Dedic <sdedic>
Status: NEW ---    
Severity: blocker CC: bht
Priority: P3    
Version: 6.x   
Hardware: PC   
OS: Windows XP   
Issue Type: ENHANCEMENT Exception Reporter:
Attachments: IDE log file
Result after I renamed package MyApplication to DesktopApp

Description matthies 2007-12-17 17:17:57 UTC
Having a public class extend a non-public class generates a warning/hint ("Exporting non-public type through public 
API"). The same should happen when a public class implements a non-public interface.


A few notes regarding the description of the hint "Exporting non-public type through public API" in the Options, which 
reads as follows:

"Checks that return types and parameter types of allpublic methods and all types of public fields are publicly 
available from other packages.Having private or package private types in a package API is useless."

– It only talks about method return and parameter types, thus the behavior for extending non-public classes is actually 
undocumented.

– The claim that "having private or package private types in a package API is useless" is not exactly true. For example 
if there is a method g() returning some non-public type and a method f() taking a parameter of that same non-public 
type, it's still valid to have a nested call f(g()) in code that doesn't have access to the type.

– There are spaces missing in "allpublic" and "packages.Having".
Comment 1 Petr Dvorak 2008-03-17 15:40:34 UTC
Created attachment 58492 [details]
IDE log file
Comment 2 Petr Dvorak 2008-03-17 15:42:31 UTC
Created attachment 58493 [details]
Result after I renamed package MyApplication to DesktopApp
Comment 3 Petr Dvorak 2008-03-17 15:44:42 UTC
The last two attachments do not belong to this issue. Issuezilla MESSES UP redirect, grrr...