Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 412650 | Differences between
and this patch

Collapse All | Expand All

(-)a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NegativeLambdaExpressionsTest.java (+32 lines)
Lines 6732-6737 Link Here
6732
		null /* custom options */
6732
		null /* custom options */
6733
	);
6733
	);
6734
}
6734
}
6735
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=412650,
6736
//[1.8][compiler]Incongruent Lambda Exception thrown
6737
public void test412650() {
6738
	this.runNegativeTest(
6739
		new String[] {
6740
				"X.java",
6741
				"package test;\n" +
6742
				"import static test.Y.*;\n" +
6743
				"public class X  {\n" +
6744
				"  public void foo() {\n" +
6745
				"    Y<String> generated = cons(\"a\", () -> cons(\"b\", Y::<String>empty));\n" +
6746
				"  }\n" +
6747
				"}\n",
6748
				"Y.java",
6749
				"package test;\n" +
6750
				"import java.util.function.Supplier;\n" +
6751
				"public abstract class Y<E>  {\n" +
6752
				"  public static <E> Y<E> empty() { return null;}\n" +
6753
				"  public static <E> Y<E> cons(E head, Supplier<Y<E>> tailFun) {return null;}\n" +
6754
				"}\n"
6755
		},
6756
		"----------\n" + 
6757
		"1. ERROR in X.java (at line 5)\n" + 
6758
		"	Y<String> generated = cons(\"a\", () -> cons(\"b\", Y::<String>empty));\n" + 
6759
		"	                      ^^^^\n" + 
6760
		"The method cons(String, () -> cons(\"b\", Y::<String>empty)) is undefined for the type X\n" + 
6761
		"----------\n",
6762
		null /* no extra class libraries */,
6763
		true /* flush output directory */,
6764
		null /* custom options */
6765
	);
6766
}
6735
public static Class testClass() {
6767
public static Class testClass() {
6736
	return NegativeLambdaExpressionsTest.class;
6768
	return NegativeLambdaExpressionsTest.class;
6737
}
6769
}

Return to bug 412650