FULL PRODUCT VERSION :
6.x
A DESCRIPTION OF THE PROBLEM :
source compile with javac 5.x but doesn't on javac 6.x
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile the attached code in 5.x and 6.x
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
expected that code will compile
ACTUAL -
does not compile
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Information:Compilation completed with 2 errors and 0 warnings
Information:2 errors
Information:0 warnings
/home/yohan/workspace/project/sotbicom/src/java/Javac6Und5Difference.java
Error:Error:line (6)non-static variable this cannot be referenced from a static context
Error:Error:line (6)non-static variable this cannot be referenced from a static context
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class Javac6Und5Difference {}
enum ENUM {
ENUM_CONST {
public AbstractClass method() {
return new AbstractClass() {
public boolean method() {
return true;
}
};
}
};
public abstract AbstractClass method();
//try remove private modifier and see what happens :)
private abstract class AbstractClass {
public abstract boolean method();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
place "static" modifier :
private static abstract class
Release Regression From : 5.0u11
The above release value was the last known release where this
bug was not reproducible. Since then there has been a regression.