Community
Participate
Working Groups
RC1 compiles the following without an error with compiler compliance level set to 1.3: import java.util.Hashtable; public class EclipseCompilerBug { static { hash = new Hashtable(); } private static final Hashtable hash; } 1.3.1 javac gives: EclipseCompilerBug.java:25: illegal forward reference hash = new Hashtable(); ^ The same code compiles without error with 1.4.2 and 1.5.0-B2 so this is indeed a compliance problem.
I consider this more a bug in javac1.3.1 than a compliance issue. See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4459133 for further details. It has been fixed in 1.4.1. Compliance doesn't mean that we must have the same bugs :-).
Indeed we do implement the language spec.
I beg to disagree... The question is does eclipse want to be useful or pedantic? At this point it is more or less true that if I am not compiling with my ide I am compiling using javac. So I think that indeed eclipse should be implementing javac-s bugs as part of compliance. For consider... If I can't rely on eclipse to produce the same compilation results as that produced by an external build using javac then I have to ask every developer to compile all code with javac as well before submission. This is a huge loss in productivity. And it does not matter that it is fixed in 1.4.x (which I realize). It is very difficult to get a large shop like ours to upgrade (for our code a full regression --- which is required if a JDK upgrade is done --- is over 6 months). So to reiterate, I think you need to comply with the de-facto standard (which is javac and not the LRS) even if it _is_ buggy. P.S.: I promise not to reopen this again, but please consider my remarks as seriously as they were meant.
Again I disagree. We are not reproducing javac bugs. Your point is well taken, but the only true solution for you then is to simply use an external Ant tool to run javac instead. Then you'll have whatever behavior (even if wrong) you want. Moreover, javac and Eclipse differ in generated classfiles, and you may observe more subtle issues near serialization if using both compilers at same time. To be on the safe side, you should stick to one particular version of a compiler (since across same compiler versions, bugs are being fixed, and behavior is thus altered). Our compliance level denotes a Java Compliance Kit level not a javac level.