Community
Participate
Working Groups
Build ID: I20080617-2000 Steps To Reproduce: 1.Create a class Caller in package p1: package p1; import p2.Callee; public class Caller { public void bar() { Callee.foo(new Object()); } } 2. Create a class Callee in package p2: package p2; public class Callee { public static void foo(final Object... varargs) { }; protected static void foo(final Object singleArg) { }; } 3. compile using Eclipse (ecj): compilation succeeds without warnings or errors 4. compile using javac (tried with 1.6.0_06 and 1.6.0_10 rc1): the following error is reported: p1/Caller.java:7: foo(java.lang.Object) has protected access in p2.Callee Callee.foo(new Object()); ^ 1 error More information: I don't know which compile follows the spec correctly in this case, but there is a discrepancy that should be looked into.
http://java.sun.com/docs/books/jls/third_edition/html/expressions.html#316811 seems to suggest that the behavior of Eclipse is correct here, as the protected method should not be considered at all, since it's not even "potentially applicable", since it's not accessible. I've filed a bug in the Sun bug parade as well and will update this bug, as soon as I hear back from Sun. Side note: Java 5 produces exactly the same problem when compiling the example.
I've got a reply from Sun saying that the behaviour is indeed a bug (or at least was accepted into their bug tracking system as a bug). The bug _will be_ visible at http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6746184 (according to the mail it can take 1 or 2 days until it is visible). This seems to indicate that the behaviour of ejc is in fact correct and this bug entry is invalid.
Thank you. Closing as NOT_ECLIPSE
Verified for 3.5M2