Community
Participate
Working Groups
Build 20020226 The following test case should compile, but Eclipse compiler rejects it: import javax.swing.AbstractAction; public class Main { public static void main(String[] args) { AbstractAction myAction = null; myAction.actionPerformed(null); // SHOULDN'T BE ANY COMPILE ERROR } }
This is due to the removal of default abstract methods in rt.jar provided with the JDK1.4.
Indeed, 1.4 class libraries are compiled for target 1.2 or better (as opposed to 1.3 classlibs which were compiled for 1.1 targets). This means that no default abstract method is generated any longer, and this can disturb some compiler lookup semantics since the reference is now different. Eclipse is in 1.3 mode by default, and soon a compiler setting will allow you to turn it into a 1.4 compiler (which it is already, simply missing the UI for setting the option). If using Javac, you will notice that it refuses alltogether to compile against a 1.4 library: d:\>javac -bootclasspath d:\jdk1.4\jre\lib\rt.jar Main.java Main.java:5: cannot access java.lang.Object bad class file: d:\jdk1.4\jre\lib\rt.jar(java/lang/Object.class) class file has wrong version 48.0, should be 47.0 Please remove or make sure it appears in the correct subdirectory of the classpath. public static void main(String[] args) { ^ 1 error
Closing, this is a legite failure until 1.4 setting is available (there is a JDT/UI request for this, see http://bugs.eclipse.org/bugs/show_bug.cgi?id=9510).
*** Bug 11406 has been marked as a duplicate of this bug. ***
*** Bug 11435 has been marked as a duplicate of this bug. ***
As per bug 11435, we did fix our compiler behavior to be able to deal with 1.4 libraries in 1.3 mode.