Failed
org.eclipse.jdt.core.tests.compiler.regression.CastTest.test461706a - 1.8 (from org.eclipse.jdt.core.tests.compiler.regression.TestAll)
Error Message
test461706a - Eclipse found error(s) but Javac only found warning(s). ----------- Expected ------------ ----------\n 1. ERROR in Bug.java (at line 20)\n .map(x -> (ICondition)x)\n ^^^^^^^^^^^^^\n Unnecessary cast from Bug.ICondition to Bug.ICondition\n ----------\n ------------ but was ------------ Bug.java:20: warning: [cast] redundant cast to ICondition\n .map(x -> (ICondition)x)\n ^\n 1 warning\n --------- Difference is ---------- expected:<[----------\n 1. ERROR in Bug.java (at line 20)\n .map(x -> (ICondition)x)\n ^^^^^^^^^^^^^\n Unnecessary cast from Bug.ICondition to Bug.ICondition\n ----------]\n > but was:<[Bug.java:20: warning: [cast] redundant cast to ICondition\n .map(x -> (ICondition)x)\n ^\n 1 warning]\n >
Stacktrace
junit.framework.ComparisonFailure: test461706a - Eclipse found error(s) but Javac only found warning(s). ----------- Expected ------------ ----------\n 1. ERROR in Bug.java (at line 20)\n .map(x -> (ICondition)x)\n ^^^^^^^^^^^^^\n Unnecessary cast from Bug.ICondition to Bug.ICondition\n ----------\n ------------ but was ------------ Bug.java:20: warning: [cast] redundant cast to ICondition\n .map(x -> (ICondition)x)\n ^\n 1 warning\n --------- Difference is ---------- expected:<[----------\n 1. ERROR in Bug.java (at line 20)\n .map(x -> (ICondition)x)\n ^^^^^^^^^^^^^\n Unnecessary cast from Bug.ICondition to Bug.ICondition\n ----------]\n > but was:<[Bug.java:20: warning: [cast] redundant cast to ICondition\n .map(x -> (ICondition)x)\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:2220) at org.eclipse.jdt.core.tests.compiler.regression.CastTest.test461706a(CastTest.java:3234)
Standard Output
org.eclipse.jdt.core.tests.compiler.regression.CastTest#test461706a - 1.8 Bug.java [ import java.util.ArrayList; import java.util.List; public class Bug { private static class AndCondition implements ICondition { public AndCondition(ICondition cond1, ICondition cond2) { // todo } } static class SimpleCondition implements ICondition { } private static interface ICondition { ICondition TRUE = new SimpleCondition(); default ICondition and(final ICondition cond) { return new AndCondition(this, cond); } } public static void main(final String[] args) { final List<ICondition> conditions = new ArrayList<>(); conditions.stream() .map(x -> (ICondition)x) .reduce((x, y) -> x.and(y)) .orElse(ICondition.TRUE); } } ] Full results sent to /tmp/comptest/run.1514610271420/1.8.0_131_20171230_000432.txt
Standard Error
--- javac err: --- Bug.java:20: warning: [cast] redundant cast to ICondition .map(x -> (ICondition)x) ^ 1 warning ----------------------------------------