diff options
| author | ANIRBAN CHAKRABORTY | 2013-08-12 14:03:44 +0000 |
|---|---|---|
| committer | Jayaprakash Arthanareeswaran | 2013-08-12 14:10:32 +0000 |
| commit | 1513eebd74ab45e8a8f50e93dd2da30af183a918 (patch) | |
| tree | bf5e09f886a147549f6e7c8f6519aabf7a328121 | |
| parent | 1b18be0be9e4004bc36c661ce71eb9b1106a6444 (diff) | |
| download | eclipse.jdt.core-1513eebd74ab45e8a8f50e93dd2da30af183a918.tar.gz eclipse.jdt.core-1513eebd74ab45e8a8f50e93dd2da30af183a918.tar.xz eclipse.jdt.core-1513eebd74ab45e8a8f50e93dd2da30af183a918.zip | |
Fix for bug 412650 - [1.8][compiler]Incongruent Lambda Exception thrown
Signed-off-by: ANIRBAN CHAKRABORTY <anchakrk@in.ibm.com>
2 files changed, 30 insertions, 0 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NegativeLambdaExpressionsTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NegativeLambdaExpressionsTest.java index 89c2806815..2fbae531a0 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NegativeLambdaExpressionsTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NegativeLambdaExpressionsTest.java @@ -6849,6 +6849,34 @@ public void test412284c() { null /* custom options */ ); } +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=412650 +// [1.8][compiler]Incongruent Lambda Exception thrown +public void test412650() { + this.runNegativeTest( + new String[] { + "X.java", + "interface I {\n" + + " String sam();\n" + + "}\n" + + "public class X {\n" + + " static String foo(I i) { return \"\"; }\n" + + " public static void main(String[] args) {\n" + + " foo(() -> foo(X::getInt));\n" + + " }\n" + + " static Integer getInt() { return 0; }\n" + + "}\n" + }, + "----------\n" + + "1. ERROR in X.java (at line 7)\n" + + " foo(() -> foo(X::getInt));\n" + + " ^^^^^^^^^\n" + + "The type of getInt() from the type X is Integer, this is incompatible with the descriptor's return type: String\n" + + "----------\n", + null /* no extra class libraries */, + true /* flush output directory */, + null /* custom options */ + ); +} public static Class testClass() { return NegativeLambdaExpressionsTest.class; } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReferenceExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReferenceExpression.java index 3090570bfc..b3b4588623 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReferenceExpression.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReferenceExpression.java @@ -580,6 +580,8 @@ public class ReferenceExpression extends FunctionalExpression implements Invocat try { this.binding = null; resolveType(this.enclosingScope); + } catch (IncongruentLambdaException e) { + return false; } finally { this.enclosingScope.problemReporter().switchErrorHandlingPolicy(oldPolicy); isCompatible = this.binding != null && this.binding.isValidBinding(); |
