Community
Participate
Working Groups
Build ID: M20070212-1330 Steps To Reproduce: 1. Take the attached class file. 2. See how eclipse compiles it without problems. 3. Compile with the Sun JVM at the command line at receive the following error: de\ikoffice\EclipseBug.java:28: hello() in de.ikoffice.EclipseBug cannot be appl ied to (java.lang.String) hello("static Class!"); ^ 1 error More information: It can be solved by calling hello() with EclipseBug.hello(), but Eclipse should either throw an exception, too, to be comform with the JVM, or forward his bug to sun.
Created attachment 74243 [details] Source file that shows up the bug.
The example code compiles fine with javac prior to 1.5 Need to investigate why javac changed their behaviour
Its not an issue of private static fields/methods no longer being visible. Both of these cases compile fine. class EclipseBug { //void hello() { System.out.println("Hello Instance!"); } private static void hello(String who) { System.out.println("Hello "+who+"!"); } static class EclipseBugInnerClass extends EclipseBug { public void innerHello() { hello("static Class!"); } } } class EclipseBug2 { private static String foo = "static Class!"; static class EclipseBugInnerClass extends EclipseBug { public void test() { System.out.println(foo); } } public static void main(String[] s) { new EclipseBugInnerClass().test(); } }
Ive just downloaded eclipse-cpp-europa-winter-win32, mingw I compiled and ran the intro."Hello World" prog. ok. However, when I try to build and run it again as the helloworld program, I get the following error : **** Internal Builder is used for build **** gcc -O0 -g3 -Wall -c -fmessage-length=0 -osrc\helloworld.o .\src\helloworld.c gcc: installation problem, cannot exec `cc1': No such file or directory Build error occurred, build is stopped Time consumed: 125 ms. Also as I try and work thro. other projects they seem to get mixed up with each other, and the runs fail. Error messages are launch failed no binaries etc. Is there a way of clearing failed projects from the platform completely? I have printed out several tutorials but they dont ans. this. I may say that eclipse came as a breath of fresh air after the useless Borland C++ compiler and the worse Microsoft .Net framework 3.5 and vis C++ x 86! However there are still problems.
Brian - I don't think this bug has anything to do with your example. This is a specific problem with the Java compiler spec (Not C++). I suggest you join the Eclipse/C++ newsgroup & ask your question there.
(In reply to comment #5) > Brian - I don't think this bug has anything to do with your example. This is a > specific problem with the Java compiler spec (Not C++). > I suggest you join the Eclipse/C++ newsgroup & ask your question there. Please tell me how to join Eclipse/C++ thro. bugzilla? Thanks Brian
In addition to the cases in comment #3, this case also compiles fine in javac 1.5 & above class EclipseBug { private void hello() { System.out.println(1); } private static void hello(String who) { System.out.println(2); } static class EclipseBugInnerClass extends EclipseBug { public void innerHello() { hello(""); } } } So its only the case when the instance method is NOT private but the matching static method IS private.
class EclipseBug { void hello() { System.out.println(1); } private static void hello(String who) { System.out.println(2); } static class E1 extends EclipseBug { public void x() { hello(null); } // fails in 1.5 & above, succeeds in 1.4 public void y(E1 e) { e.hello(null); } // fails } static class E2 { public void x() { hello(null); } // succeeds public void y(E1 e) { e.hello(null); } // fails } } class E3 extends EclipseBug { public void x() { hello(null); } // fails public void y(E3 e) { e.hello(null); } // fails } So between 1.4 & 1.5, E1.x() compiles differently. The visible inherited method hello() found by walking the superclass chain takes precedence over the private static method found in the outer class scope.
Created attachment 119423 [details] Proposed patch with testcase
Created attachment 119525 [details] Proposed patch with testcase for 3.4.2 If we need it
Just before I released the fix, I tried with the latest JDK7 build (1.7.0-ea-b40) and javac has changed their behaviour back to what it was in 1.4 & now accept a matching private static method again. So we will keep our current behaviour. Test released for 3.5M4
Verified for 3.5M4 using I20081208-1800