Incremental Compiler bug when accessing a protected attribute? [message #200318] |
Mon, 23 February 2004 18:22  |
Eclipse User |
|
|
|
I'm working on some code similar to below and I'm experiencing
differences between the Sun java compiler and the Eclipse incremental
compiler in how they see protected attributes of a class.
In Eclipse, I get the error "Type myPrivateClass.Goober is not
visible." on all accesses to x, y, and z. But when I compile the code
using 1.4.2_01 of the Sun SDK I only receive 2 errors one on x and the
other on z.
The reason I ask is because some code I'm working on has thousands of
instances similar to the scenario accessing y and obviously Eclipse is
giving me boat loads of errors. Is this a bug in the Eclipse
compiler, or a known discrepancy between Eclipse & Sun?
Shane
-8< file: myPrivateClass.java ----------------------------
package myPackage;
public final class myPrivateClass {
private class Goober {
private int x;
protected int y;
public int z;
}
Goober goober = new Goober();
}
-8< file: myTestClass.java ------------------------------
package myPackage;
public class myTestClass {
public void lmnop() {
myPrivateClass x = new myPrivateClass();
x.goober.x = 0; // private not accessable via javac
x.goober.y = 1; // protected accessable via javac
x.goober.z = 2; // public not accessable via javac
}
}
-8< file: build.xml ------------------------------
<project name="stuff" default="default" basedir=".">
<property name="build.dest" value="./bin" />
<target name="default">
<mkdir dir="${build.dest}"/>
<javac srcdir="."
destdir="${build.dest}"
/>
</target>
</project>
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.06352 seconds