-
Type:
Bug
-
Resolution: Fixed
-
Priority:
P2
-
Affects Version/s: None
-
Component/s: tools
-
b26
The below code uses instanceof in do S while(e) statement. It should throw a compilation error as S contains a reachable break statement whose break target contains S. However, the compilation goes through successfully.
public class PatternTest {
static public Object b0 = "bb";
public static void main(String[] args) {
String res = "";
Object bx = b0;
A:
do {
res += "t";
break A;
} while (!(bx instanceof String v));
System.out.println("Got: " + v);
}
}
There is a LinkageError thrown at runtime. The error log is attached below.
public class PatternTest {
static public Object b0 = "bb";
public static void main(String[] args) {
String res = "";
Object bx = b0;
A:
do {
res += "t";
break A;
} while (!(bx instanceof String v));
System.out.println("Got: " + v);
}
}
There is a LinkageError thrown at runtime. The error log is attached below.