extract enum: ensure normalized fields (IDEA-112590)

This commit is contained in:
Anna Kozlova
2013-08-23 17:11:52 +04:00
parent d0fb95d067
commit 832256ec33
7 changed files with 59 additions and 0 deletions
@@ -0,0 +1,12 @@
public enum EEnum {
FOO(0), BAR(2);
private int value;
public int getValue() {
return value;
}
EEnum(int value) {
this.value = value;
}
}
@@ -0,0 +1,5 @@
class Test {
void foo() {
System.out.println(EEnum.FOO.getValue());
}
}
@@ -0,0 +1,15 @@
class Usage {
void foo(EEnum i) {
switch (i) {
case FOO:
break;
case BAR:
break;
}
}
void foobar() {
foo(EEnum.FOO);
foo(EEnum.BAR);
}
}
@@ -0,0 +1,6 @@
class Test {
public static final int FOO = 0, BAR = 2;
void foo() {
System.out.println(FOO);
}
}
@@ -0,0 +1,15 @@
class Usage {
void foo(int i) {
switch (i) {
case Test.FOO:
break;
case Test.BAR:
break;
}
}
void foobar() {
foo(Test.FOO);
foo(Test.BAR);
}
}