Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 321433

Summary: [compiler] Compiler should raise a (warning|error) when one exports a non-public type through public API
Product: [Eclipse Project] PDE Reporter: Oliver Drotbohm <odrotbohm>
Component: API ToolsAssignee: PDE API Tools Inbox <pde-apitools-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: deepakazad, Olivier_Thomann, remy.suen
Version: 3.7   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: stalebug

Description Oliver Drotbohm CLA 2010-07-31 12:25:16 EDT
Build Identifier: 

Suppose you have a class:

class Foo { … }

and another one:

public class Bar {
  public Foo foobar() { … }
}

This should raise a warning on the foobar method, that it exposes a non-public type.

Netbeans already has this feature. They raise a "Exporting non-public type through public API" warning: http://hg.netbeans.org/main/file/3547a4cb9429/java.hints/src/org/netbeans/modules/java/hints/ExportNonAccessibleElement.java

Reproducible: Always
Comment 1 Olivier Thomann CLA 2010-08-01 10:26:44 EDT
The compiler has no notion of public API.
Are you using API Tooling for your project? This would be detected as an API leak.

Moving to PDE/API Tooling
Comment 2 Oliver Drotbohm CLA 2010-08-01 11:02:29 EDT
Seems you got me wrong to a large extend. I'd lime to see this warning raised in a plain Java project, nothing PDE related here. I know this is not a "real" compiler warning. But as it is quite near to the type system, it think it would be quite useful. On the other hand one could argue that this should be caught by Findbugs or the like.

So you should either close it as invalid or move it back to JDT ;).
Comment 3 Eclipse Webmaster CLA 2019-09-06 16:13:40 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.
Comment 4 Julian Honnen CLA 2019-09-09 02:44:12 EDT
Please remove the stalebug flag, if this issue is still relevant and can be reproduced on the latest release.