Skip to content

Failed

org.eclipse.jdt.core.tests.compiler.regression.SwitchExpressionTest.testBug545333 - 12 (from org.eclipse.jdt.core.tests.compiler.regression.TestAll)

Failing for the past 1 build (Since #44 )
Took 0.96 sec.

Error Message

testBug545333 - Eclipse found error(s) but Javac only found warning(s).
----------- Expected ------------
----------\n
1. ERROR in X.java (at line 4)\n
 int v = switch (i) {\n
      default -> throw new MyException();\n
     };\n
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n
A switch expression should have at least one result expression\n
----------\n

------------ but was ------------
Note: X.java uses preview language features.\n
Note: Recompile with -Xlint:preview for details.\n

--------- Difference is ----------
 expected:<[----------\n
1. ERROR in X.java (at line 4)\n
 int v = switch (i) {\n
      default -> throw new MyException();\n
     };\n
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n
A switch expression should have at least one result expression\n
----------]\n
> but was:<[Note: X.java uses preview language features.\n
Note: Recompile with -Xlint:preview for details.]\n
>

Stacktrace

junit.framework.ComparisonFailure: 
testBug545333 - Eclipse found error(s) but Javac only found warning(s).
----------- Expected ------------
----------\n
1. ERROR in X.java (at line 4)\n
	int v = switch (i) {\n
    		default -> throw new MyException();\n
    	};\n
	        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n
A switch expression should have at least one result expression\n
----------\n

------------ but was ------------
Note: X.java uses preview language features.\n
Note: Recompile with -Xlint:preview for details.\n

--------- Difference is ----------
 expected:<[----------\n
1. ERROR in X.java (at line 4)\n
	int v = switch (i) {\n
    		default -> throw new MyException();\n
    	};\n
	        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n
A switch expression should have at least one result expression\n
----------]\n
> but was:<[Note: X.java uses preview language features.\n
Note: Recompile with -Xlint:preview for details.]\n
>
	at org.eclipse.jdt.core.tests.compiler.regression.SwitchExpressionTest.runNegativeTest(SwitchExpressionTest.java:68)
	at org.eclipse.jdt.core.tests.compiler.regression.SwitchExpressionTest.testBug545333(SwitchExpressionTest.java:2177)

Standard Output

org.eclipse.jdt.core.tests.compiler.regression.SwitchExpressionTest#testBug545333 - 12
X.java [
public class X {
    @SuppressWarnings("preview")
	public static int foo(int i) throws MyException {
    	int v = switch (i) {
    		default -> throw new MyException();
    	};
        return v;
    }
    public static void main(String argv[]) {
    	try {
			System.out.println(X.foo(1));
		} catch (MyException e) {
			System.out.println("Exception thrown as expected");
		}
	}
}
class MyException extends Exception {
	private static final long serialVersionUID = 3461899582505930473L;	
}

]


Full results sent to /tmp/genie.jdt/comptest/run.1565715170219/12_20190813_125251.txt

Standard Error

--- javac err: ---
Note: X.java uses preview language features.
Note: Recompile with -Xlint:preview for details.

----------------------------------------