b5f0eec3d8
8205393: Add SourceVersion.RELEASE_13 8205394: Add source 13 and target 13 to javac 8205645: Bump maximum recognized class file version to 57 for JDK 13 8214825: Update preview language features for start of JDK 13 Reviewed-by: erikj, alanb, mchung, mcimadamore, dholmes, smarks, jjg
88 lines
1.9 KiB
Java
88 lines
1.9 KiB
Java
/**
|
|
* @test /nodynamiccopyright/
|
|
* @bug 8214031
|
|
* @summary Verify that definite assignment when true works (illegal code)
|
|
* @compile/fail/ref=DefiniteAssignment2.out --enable-preview --source 13 -XDrawDiagnostics DefiniteAssignment2.java
|
|
*/
|
|
public class DefiniteAssignment2 {
|
|
|
|
public static void main(String[] args) {
|
|
int a = 0;
|
|
boolean b = true;
|
|
boolean t;
|
|
|
|
{
|
|
int x;
|
|
|
|
t = (b && switch(a) {
|
|
case 0: break (x = 1) == 1 || true;
|
|
default: break false;
|
|
}) || x == 1;
|
|
}
|
|
|
|
{
|
|
int x;
|
|
|
|
t = (switch(a) {
|
|
case 0: break (x = 1) == 1;
|
|
default: break false;
|
|
}) || x == 1;
|
|
}
|
|
|
|
{
|
|
int x;
|
|
|
|
t = (switch(a) {
|
|
case 0: x = 1; break true;
|
|
case 1: break (x = 1) == 1;
|
|
default: break false;
|
|
}) || x == 1;
|
|
}
|
|
|
|
{
|
|
int x;
|
|
|
|
t = (switch(a) {
|
|
case 0: break true;
|
|
case 1: break (x = 1) == 1;
|
|
default: break false;
|
|
}) && x == 1;
|
|
}
|
|
|
|
{
|
|
int x;
|
|
|
|
t = (switch(a) {
|
|
case 0: break false;
|
|
case 1: break isTrue() || (x = 1) == 1;
|
|
default: break false;
|
|
}) && x == 1;
|
|
}
|
|
|
|
{
|
|
int x;
|
|
|
|
t = (switch(a) {
|
|
case 0: break false;
|
|
case 1: break isTrue() ? true : (x = 1) == 1;
|
|
default: break false;
|
|
}) && x == 1;
|
|
}
|
|
|
|
{
|
|
final int x;
|
|
|
|
t = (switch(a) {
|
|
case 0: break false;
|
|
case 1: break isTrue() ? true : (x = 1) == 1;
|
|
default: break false;
|
|
}) && (x = 1) == 1;
|
|
}
|
|
}
|
|
|
|
private static boolean isTrue() {
|
|
return true;
|
|
}
|
|
|
|
}
|