enum Operation {
X;
static int s = 0;
public static final String constS = "";
Operation() {
int i = Operation.s;
i = s;
s = 0;
final int x = Integer.MAX_VALUE;
String co = constS;
// TODO: unclear
//Operation o = X;
}
static {
int i = Operation.s;
i = s;
s = 0;
final int x = Integer.MAX_VALUE;
String co = constS;
// TODO: unclear
//Operation o = X;
}
{
int i = Operation.s;
i = s;
s = 0;
final int x = Integer.MAX_VALUE;
String co = constS;
// TODO: unclear
//Operation o = X;
Operation ooo = new Operation();
}
void values() {}
void values(int i) {}
void valueOf() {}
void valueOf(String s) {}
}
class exte extends Operation {
}
class use {
void f(Operation op) {
switch(op) {
case Operation.X: break;
}
switch(op) {
case X: break;
}
switch(op) {
case X: break;
case X: break;
}
}
}
enum pubCtr {
X(1);
public pubCtr(int i) {}
}
enum protCtr {
X(1);
protected protCtr(int i) {}
}
final enum Fin { Y }
abstract enum Abstr { }
enum params {
}
enum OurEnum {
A, B, C;
OurEnum() {
}
{
Enum a = A;
OurEnum enumValue = B;
switch (enumValue) {
}
switch (enumValue) {
case A:
break;
}
}
}
enum TestEnum
{
A(B), B(A);
TestEnum(TestEnum other) {
super(null, 0);
}
}
enum abstr implements Runnable {
}
//this one is OK, enum constants are checked instead of enum itself
enum abstr1 implements Runnable {
A {
public void run() {}
};
}
class X extends Enum {
public X(String name, int ordinal) {
super(name, ordinal);
}
}
enum StaticInEnumConstantInitializer {
AN {
static class s {
}
private static final String t = String.valueOf(1);
};
}
interface Barz {
void baz();
}
enum Fooz implements Barz {
FOO;
}
///////////////////////
class sss {
void f() {
enum EEEE { EE, YY };
}
}
//////////////////////
//This code is OK
enum PowerOfTen {
ONE(1),TEN(10),
HUNDRED(100) {
public String toString() {
return Integer.toString(super.val);
}
};
private final int val;
PowerOfTen(int val) {
this.val = val;
}
public String toString() {
return name().toLowerCase();
}
public static void main(String[] args) {
System.out.println(ONE + " " + TEN + " " + HUNDRED);
}
}
//IDEADEV-8192
enum MyEnum {
X1, X2;
private static MyEnum[] values = values();
public static void test() {
for (MyEnum e : values) { // values is colored red
e.toString();
}
}
}
//end of IDEADEV-8192
class EnumBugIDEADEV15333 {
public enum Type { one, to }
Type type = Type.one;
public void main() {
switch(type){
case one:
Object one = new Object();
}
}
}