Failed
org.eclipse.jdt.core.tests.compiler.regression.NullReferenceTest.testBug291418b - 1.8 (from org.eclipse.jdt.core.tests.compiler.regression.TestAll)
Error Message
testBug291418b - Eclipse found error(s) but Javac only found warning(s). ----------- Expected ------------ ----------\n 1. ERROR in X.java (at line 6)\n if (collectionVar == null);\n ^^^^^^^^^^^^^\n Null comparison always yields false: The variable collectionVar cannot be null at this location\n ----------\n 2. ERROR in X.java (at line 8)\n if (argArray == null);\n ^^^^^^^^\n Null comparison always yields false: The variable argArray cannot be null at this location\n ----------\n ------------ but was ------------ X.java:6: warning: [empty] empty statement after if\n if (collectionVar == null);\n ^\n X.java:7: warning: [empty] empty statement after if\n if (array == null);\n ^\n X.java:8: warning: [empty] empty statement after if\n if (argArray == null);\n ^\n 3 warnings\n --------- Difference is ---------- expected:<[----------\n 1. ERROR in X.java (at line 6)\n if (collectionVar == null);\n ^^^^^^^^^^^^^\n Null comparison always yields false: The variable collectionVar cannot be null at this location\n ----------\n 2. ERROR in X.java (at line 8)\n if (argArray == null);\n ^^^^^^^^\n Null comparison always yields false: The variable argArray cannot be null at this location\n ----------]\n > but was:<[X.java:6: warning: [empty] empty statement after if\n if (collectionVar == null);\n ^\n X.java:7: warning: [empty] empty statement after if\n if (array == null);\n ^\n X.java:8: warning: [empty] empty statement after if\n if (argArray == null);\n ^\n 3 warnings]\n >
Stacktrace
junit.framework.ComparisonFailure: testBug291418b - Eclipse found error(s) but Javac only found warning(s). ----------- Expected ------------ ----------\n 1. ERROR in X.java (at line 6)\n if (collectionVar == null);\n ^^^^^^^^^^^^^\n Null comparison always yields false: The variable collectionVar cannot be null at this location\n ----------\n 2. ERROR in X.java (at line 8)\n if (argArray == null);\n ^^^^^^^^\n Null comparison always yields false: The variable argArray cannot be null at this location\n ----------\n ------------ but was ------------ X.java:6: warning: [empty] empty statement after if\n if (collectionVar == null);\n ^\n X.java:7: warning: [empty] empty statement after if\n if (array == null);\n ^\n X.java:8: warning: [empty] empty statement after if\n if (argArray == null);\n ^\n 3 warnings\n --------- Difference is ---------- expected:<[----------\n 1. ERROR in X.java (at line 6)\n if (collectionVar == null);\n ^^^^^^^^^^^^^\n Null comparison always yields false: The variable collectionVar cannot be null at this location\n ----------\n 2. ERROR in X.java (at line 8)\n if (argArray == null);\n ^^^^^^^^\n Null comparison always yields false: The variable argArray cannot be null at this location\n ----------]\n > but was:<[X.java:6: warning: [empty] empty statement after if\n if (collectionVar == null);\n ^\n X.java:7: warning: [empty] empty statement after if\n if (array == null);\n ^\n X.java:8: warning: [empty] empty statement after if\n if (argArray == null);\n ^\n 3 warnings]\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.testBug291418b(NullReferenceTest.java:11804)
Standard Output
org.eclipse.jdt.core.tests.compiler.regression.NullReferenceTest#testBug291418b - 1.8 X.java [ class X { void foo(int[] argArray) { int[] array = {2}; int[] collectionVar = {1,2}; if(argArray == null) return; for(int x:collectionVar) { if (collectionVar == null); if (array == null); if (argArray == null); array = null; } } } ] Full results sent to /tmp/comptest/run.1514610271420/1.8.0_131_20171230_000432.txt
Standard Error
--- javac err: --- X.java:6: warning: [empty] empty statement after if if (collectionVar == null); ^ X.java:7: warning: [empty] empty statement after if if (array == null); ^ X.java:8: warning: [empty] empty statement after if if (argArray == null); ^ 3 warnings ----------------------------------------