-
Bug
-
Resolution: Fixed
-
P2
-
12
-
b23
-
Verified
The following code examples shows compile time error (java.lang.AssertionError):
In the following examples, a result expressions with a conditional operator is used as value break statement in the switch statement.
Code 1:
public class Test {
public static void main(String[] args) {
boolean b;
b = switch(1){
case 1: break true && true;
default: break false;
};
System.out.println(b);
}
}
Code 2:
public class Test {
public static void main(String[] args) {
boolean b;
b = switch(1){
case 1: break true || true;
default: break false;
};
System.out.println(b);
}
}
Code 3:
public class SwitchTest {
public static void main(String[] args) {
int a =0;
boolean b = true;
boolean b1 = switch(a){
case 0: break b ? true : false;
default: break false;
};
System.out.println(b1);
}
}
Please find the error log as attachment.
In the following examples, a result expressions with a conditional operator is used as value break statement in the switch statement.
Code 1:
public class Test {
public static void main(String[] args) {
boolean b;
b = switch(1){
case 1: break true && true;
default: break false;
};
System.out.println(b);
}
}
Code 2:
public class Test {
public static void main(String[] args) {
boolean b;
b = switch(1){
case 1: break true || true;
default: break false;
};
System.out.println(b);
}
}
Code 3:
public class SwitchTest {
public static void main(String[] args) {
int a =0;
boolean b = true;
boolean b1 = switch(a){
case 0: break b ? true : false;
default: break false;
};
System.out.println(b1);
}
}
Please find the error log as attachment.