Bug 23788

Summary: Java compiler doesn't properly flag invalid protected access (for javac 1.4 compatibility)
Product: [Eclipse Project] JDT Reporter: Seth Nickell <snickell>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: John_Wiegand
Version: 2.0.1   
Target Milestone: 2.1 M1   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Tiny eclipse project demonstrating the problem none

Description Seth Nickell CLA 2002-09-18 16:26:20 EDT
According to:
http://developer.java.sun.com/developer/bugParade/bugs/4637755.html for a Java
1.4 compatible javac the compiler should not allow access to protected members
from classes defined outside their package, even if members are overrider the
method from a base class that *is* in the accessor's package. This "bug" existed
in the javac included with JDK 1.3, but is "fixed" in the JDK 1.4 javac.

Included is a piece of sample code that demonstrates the problem. With Sun's
javac from JDK1.4 the following error is reported on compilation:

PackageA/MainClass.java:12: overriddenMethod() has protected access in
PackageB.DerivedClass
		derivedObject.overriddenMethod();

Eclipse's java compiler compiles the code happily, even when JDK1.4
compatibility is enabled.
Comment 1 Seth Nickell CLA 2002-09-18 16:27:20 EDT
Created attachment 2009 [details]
Tiny eclipse project demonstrating the problem
Comment 2 Seth Nickell CLA 2002-09-18 16:27:57 EDT
I should mention that the attachment *does* compile with Eclipse, but it should
not. I've commented the line that should not compile.
Comment 3 Philipe Mulet CLA 2002-09-19 07:13:37 EDT
Works for me in latest. This is a duplicate of bug 22428.
Fix is part of 2.1-M1 build.

*** This bug has been marked as a duplicate of 22428 ***
Comment 4 Philipe Mulet CLA 2002-09-19 07:13:53 EDT
Forgot to assign.
Comment 5 Philipe Mulet CLA 2002-09-19 07:14:21 EDT

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