-
Bug
-
Resolution: Fixed
-
P2
-
5.0
-
01
-
generic
-
generic
Empty enum declartions are allowed where other static declarations are not
Tried on Tiger-Beta3-Build 59, solaris
Please See the code below:-
/**Empty enum declarations are allowed where other
*static declarations are not allowed.
*/
import java.util.*;
class B {
}
class A {
enum COLOR{RED, GREEN};
public B check() {
//enum CHECK{}; ->compilation error enum types must not be local
return new B() {
//static int k =0; -> Compilation error static inside inner class
//public static void show() {} -> compilation error static inside inner class
enum STRENGTH{}; // compiles silently
//enum STRENGTH{HARD,SOFT}; // gives compilation error non static variable this cannot be refrenced from a static context
};
}
}
public class Test16 {
public void assertion() {
A ref_A = new A();
B ref_B = ref_A.check();
}
public static void main(String args[]) {
Test16 ref = new Test16();
ref.assertion();
}
}
Tried on Tiger-Beta3-Build 59, solaris
Please See the code below:-
/**Empty enum declarations are allowed where other
*static declarations are not allowed.
*/
import java.util.*;
class B {
}
class A {
enum COLOR{RED, GREEN};
public B check() {
//enum CHECK{}; ->compilation error enum types must not be local
return new B() {
//static int k =0; -> Compilation error static inside inner class
//public static void show() {} -> compilation error static inside inner class
enum STRENGTH{}; // compiles silently
//enum STRENGTH{HARD,SOFT}; // gives compilation error non static variable this cannot be refrenced from a static context
};
}
}
public class Test16 {
public void assertion() {
A ref_A = new A();
B ref_B = ref_A.check();
}
public static void main(String args[]) {
Test16 ref = new Test16();
ref.assertion();
}
}
- relates to
-
JDK-6174188 l10n for 5081785 & 5097250: compiler resource has 2 new properties
- Resolved
-
JDK-6542046 Method-scoped enums no longer allowed
- Closed