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 - Add a warning/hint when a public class implements a non-public interface
Summary: Add a warning/hint when a public class implements a non-public interface
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P3 blocker (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-12-17 17:17 UTC by matthies
Modified: 2013-09-02 14:19 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
IDE log file (28.05 KB, text/plain)
2008-03-17 15:40 UTC, Petr Dvorak
Details
Result after I renamed package MyApplication to DesktopApp (138.51 KB, image/png)
2008-03-17 15:42 UTC, Petr Dvorak
Details

Note You need to log in before you can comment on or make changes to this bug.
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...