Bug 237656 - [1.5][compiler] No error for generic type with private access
Summary: [1.5][compiler] No error for generic type with private access
Status: RESOLVED DUPLICATE of bug 185422
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-18 12:23 EDT by Nick Radov CLA
Modified: 2008-06-19 07:46 EDT (History)
1 user (show)

See Also:


Attachments
sample source code to reproduce the bug (700 bytes, text/html)
2008-06-18 12:23 EDT, Nick Radov CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Radov CLA 2008-06-18 12:23:41 EDT
Created attachment 105311 [details]
sample source code to reproduce the bug

The Eclipse built-in Java compiler fails to report an error if the type is private. This is inconsistent with the Sun javac 1.6.0_06 compiler.

See the attached source code for an example. Try it in Eclipse, and then from the command line. Eclipse reports no errors, but javac reports this error.

Superclass.java:5: Subclass.NestedSubclass has private access in Subclass
class Subclass extends Superclass<Subclass.NestedSubclass> {
                                          ^
1 error
Comment 1 Philipe Mulet CLA 2008-06-18 12:56:24 EDT
Reproduced in latest, with corrected testcase:

public class X<T> {
}
class Subclass extends X<Subclass.NestedSubclass> {
	@SuppressWarnings("unchecked")
	private final class NestedSubclass extends X {
	}
} 

Both java6 and 7 do complain.
Comment 2 Philipe Mulet CLA 2008-06-18 12:59:38 EDT
Feels strange than an access to a private type be forbidden within enclosing type...

like this code doesn't raise any error:
public class X<T> {
}
class Subclass extends X<Object> {
	Subclass.NestedSubclass nested;
	@SuppressWarnings("unchecked")
	private final class NestedSubclass extends X {
	}
} 

Feels like a javac bug to me.
Comment 3 Maxime Daniel CLA 2008-06-19 07:07:10 EDT
See also bug 185422.
Comment 4 Philipe Mulet CLA 2008-06-19 07:46:12 EDT
Indeed, this is a dup.

*** This bug has been marked as a duplicate of bug 185422 ***