Failed
org.eclipse.jdt.core.tests.compiler.regression.NullReferenceTest.testBug402993 - 1.8 (from org.eclipse.jdt.core.tests.compiler.regression.TestAll)
Error Message
testBug402993 - Eclipse found error(s) but Javac only found warning(s). ----------- Expected ------------ ----------\n 1. ERROR in Test.java (at line 23)\n if (exc == null) // no warning here ??\n ^^^\n Redundant null check: The variable exc can only be null at this location\n ----------\n 2. ERROR in Test.java (at line 31)\n if (exc == null) // No warning here ??\n ^^^\n Redundant null check: The variable exc can only be null at this location\n ----------\n ------------ but was ------------ Test.java:24: warning: [empty] empty statement after if\n ;\n ^\n 1 warning\n --------- Difference is ---------- expected:<[----------\n 1. ERROR in Test.java (at line 23)\n if (exc == null) // no warning here ??\n ^^^\n Redundant null check: The variable exc can only be null at this location\n ----------\n 2. ERROR in Test.java (at line 31)\n if (exc == null) // No warning here ??\n ^^^\n Redundant null check: The variable exc can only be null at this location\n ----------]\n > but was:<[Test.java:24: warning: [empty] empty statement after if\n ;\n ^\n 1 warning]\n >
Stacktrace
junit.framework.ComparisonFailure: testBug402993 - Eclipse found error(s) but Javac only found warning(s). ----------- Expected ------------ ----------\n 1. ERROR in Test.java (at line 23)\n if (exc == null) // no warning here ??\n ^^^\n Redundant null check: The variable exc can only be null at this location\n ----------\n 2. ERROR in Test.java (at line 31)\n if (exc == null) // No warning here ??\n ^^^\n Redundant null check: The variable exc can only be null at this location\n ----------\n ------------ but was ------------ Test.java:24: warning: [empty] empty statement after if\n ;\n ^\n 1 warning\n --------- Difference is ---------- expected:<[----------\n 1. ERROR in Test.java (at line 23)\n if (exc == null) // no warning here ??\n ^^^\n Redundant null check: The variable exc can only be null at this location\n ----------\n 2. ERROR in Test.java (at line 31)\n if (exc == null) // No warning here ??\n ^^^\n Redundant null check: The variable exc can only be null at this location\n ----------]\n > but was:<[Test.java:24: warning: [empty] empty statement after if\n ;\n ^\n 1 warning]\n > at org.eclipse.jdt.core.tests.junit.extension.TestCase.assertStringEquals(TestCase.java:260) at org.eclipse.jdt.core.tests.junit.extension.TestCase.assertEquals(TestCase.java:236) at org.eclipse.jdt.core.tests.compiler.regression.AbstractRegressionTest.runJavac(AbstractRegressionTest.java:2048) at org.eclipse.jdt.core.tests.compiler.regression.AbstractRegressionTest.runTest(AbstractRegressionTest.java:2814) at org.eclipse.jdt.core.tests.compiler.regression.AbstractRegressionTest.runTest(AbstractRegressionTest.java:2539) at org.eclipse.jdt.core.tests.compiler.regression.AbstractRegressionTest.runNegativeTest(AbstractRegressionTest.java:2113) at org.eclipse.jdt.core.tests.compiler.regression.AbstractRegressionTest.runNegativeTest(AbstractRegressionTest.java:2102) at org.eclipse.jdt.core.tests.compiler.regression.NullReferenceTest.testBug402993(NullReferenceTest.java:17192)
Standard Output
org.eclipse.jdt.core.tests.compiler.regression.NullReferenceTest#testBug402993 - 1.8 Test.java [ public class Test { private static void occasionallyThrowException() throws Exception { if ((System.currentTimeMillis() & 1L) != 0L) throw new Exception(); } private static void open() throws Exception { occasionallyThrowException(); } private static void close() throws Exception { occasionallyThrowException(); } public static void main(String s[]) { Exception exc = null; try { open(); // do more things } catch (Exception e) { if (exc == null) // no warning here ?? ; } finally { try { close(); } catch (Exception e) { if (exc == null) // No warning here ?? exc = e; } } } } ] Full results sent to /tmp/comptest/run.1514610271420/1.8.0_131_20171230_000432.txt
Standard Error
--- javac err: --- Test.java:24: warning: [empty] empty statement after if ; ^ 1 warning ----------------------------------------