Duplicate :
|
from jacks ==== 6.5.5.1-nested-3 A simple type name favors a visible local class declaration over member types FAILED ==== Contents of test case: empty_main T6551n3 { class C { // local static final int i = 1; } new Object() { class C { // member static final int i = 2; } void foo(int j) { switch (j) { case 0: case 1: // C refers to the member class, since the local is // shadowed, hence C.i is 2 case C.i: } } }; } ---- Result was: FAIL ---- Result should have been: PASS ==== 6.5.5.1-nested-3 FAILED 1 class T { 2 void f() { 3 class C { // local 4 static final int i = 1; 5 } 6 new Object() { 7 class C { // member 8 static final int i = 2; 9 } 10 void foo(int j) { 11 switch (j) { 12 case 0: 13 case 1: 14 // C refers to the member class, since the local is 15 // shadowed, hence C.i is 2 16 case C.i: 17 } 18 } 19 }; 20 } 21 }