Failed

org.eclipse.jdt.core.tests.compiler.regression.NullAnnotationTest.testBug542707_001 - 13 (from org.eclipse.jdt.core.tests.compiler.regression.TestAll)

Failing for the past 35 builds (Since #384 )
Took 6 ms.

Error Message

Invalid problem log .
----------- Expected ------------
----------\n
1. ERROR in X.java (at line 12)\n
 x = null;\n
     ^^^^\n
Null type mismatch: required '@NonNull X' but the provided value is null\n
----------\n
2. ERROR in X.java (at line 15)\n
 default -> null;\n
            ^^^^\n
Null type mismatch: required '@NonNull X' but the provided value is null\n
----------\n

------------ but was ------------
----------\n
1. ERROR in X.java (at line 0)\n
 import java.io.IOException;\n
 ^\n
Preview features enabled at an invalid source release level 12, preview can be enabled only at source level 13\n
----------\n

--------- Difference is ----------
 expected:<... in X.java (at line [12)\n
 x = null;\n
     ^^^^\n
Null type mismatch: required '@NonNull X' but the provided value is null\n
----------\n
2. ERROR in X.java (at line 15)\n
 default -> null;\n
            ^^^^\n
Null type mismatch: required '@NonNull X' but the provided value is null]\n
----------\n
> but was:<... in X.java (at line [0)\n
 import java.io.IOException;\n
 ^\n
Preview features enabled at an invalid source release level 12, preview can be enabled only at source level 13]\n
----------\n
>

Stacktrace

junit.framework.ComparisonFailure: 
Invalid problem log .
----------- Expected ------------
----------\n
1. ERROR in X.java (at line 12)\n
	x = null;\n
	    ^^^^\n
Null type mismatch: required '@NonNull X' but the provided value is null\n
----------\n
2. ERROR in X.java (at line 15)\n
	default -> null;\n
	           ^^^^\n
Null type mismatch: required '@NonNull X' but the provided value is null\n
----------\n

------------ but was ------------
----------\n
1. ERROR in X.java (at line 0)\n
	import java.io.IOException;\n
	^\n
Preview features enabled at an invalid source release level 12, preview can be enabled only at source level 13\n
----------\n

--------- Difference is ----------
 expected:<... in X.java (at line [12)\n
	x = null;\n
	    ^^^^\n
Null type mismatch: required '@NonNull X' but the provided value is null\n
----------\n
2. ERROR in X.java (at line 15)\n
	default -> null;\n
	           ^^^^\n
Null type mismatch: required '@NonNull X' but the provided value is null]\n
----------\n
> but was:<... in X.java (at line [0)\n
	import java.io.IOException;\n
	^\n
Preview features enabled at an invalid source release level 12, preview can be enabled only at source level 13]\n
----------\n
>
	at org.eclipse.jdt.core.tests.compiler.regression.NullAnnotationTest.testBug542707_001(NullAnnotationTest.java:10372)

Standard Output

org.eclipse.jdt.core.tests.compiler.regression.NullAnnotationTest#testBug542707_001 - 13
		"----------\n" + 
		"1. ERROR in X.java (at line 0)\n" + 
		"	import java.io.IOException;\n" + 
		"	^\n" + 
		"Preview features enabled at an invalid source release level 12, preview can be enabled only at source level 13\n" + 
		"----------\n"
X.java [
import java.io.IOException;

import org.eclipse.jdt.annotation.NonNull;

public class X {
	public static int foo(int i) throws IOException {
		int k = 0;
		@NonNull
		X x = new X();
		x  = switch (i) { 
		case 1  ->   {
			x = null;
			break x;
		}
		default -> null;
		};

		return k ;
	}

	public static void main(String[] args) {
		try {
			System.out.println(foo(3));
		} catch (IOException e) {
			// do nothing
		}
	}
}

]