Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2019-02-07 15:54:48 -0500
committerStephan Herrmann2019-02-07 15:54:48 -0500
commita9d77143a860475b4d660573eefc303be09d98f4 (patch)
tree1e9c6513d7764ae011239d911fa83558633d38b6
parent56c7200f17bcd06f03618a81316a7dbfe1d7dcf8 (diff)
downloadeclipse.jdt.core-a9d77143a860475b4d660573eefc303be09d98f4.tar.gz
eclipse.jdt.core-a9d77143a860475b4d660573eefc303be09d98f4.tar.xz
eclipse.jdt.core-a9d77143a860475b4d660573eefc303be09d98f4.zip
Bug 538192 - [1.8][compiler] Eclipse IDE compiler error (lambda), using
io.cucumber.datatable.DataTableType Change-Id: I3af5f99587f34fdcbff08c5d1635115b382a159c Signed-off-by: Stephan Herrmann <stephan.herrmann@berlin.de>
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_8.java20
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LambdaExpression.java2
2 files changed, 22 insertions, 0 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_8.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_8.java
index 4bf0b94b6e..c57ea95c8e 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_8.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_8.java
@@ -9512,4 +9512,24 @@ public void testBug508834_comment0() {
};
runner.runConformTest();
}
+ public void testBug538192() {
+ Runner runner = new Runner();
+ runner.testFiles = new String[] {
+ "Test.java",
+ "import java.util.*;\n" +
+ "import java.util.function.Function;\n" +
+ "interface ListFunc<T> extends Function<List<String>, T> {}\n" +
+ "interface MapFunc<T> extends Function<Map<String,String>, T> {}\n" +
+ "class DTT {\n" +
+ " public <T> DTT(Class<T> c, ListFunc<T> f) {}\n" +
+ " public <T> DTT(Class<T> c, MapFunc<T> f) {} \n" +
+ "}\n" +
+ "public class Test {\n" +
+ " void test() {\n" +
+ " new DTT(Integer.class, (Map<String, String> row) -> Integer.valueOf(0));\n" +
+ " }\n" +
+ "}\n"
+ };
+ runner.runConformTest();
+ }
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LambdaExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LambdaExpression.java
index 08067d8306..b252d45f42 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LambdaExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LambdaExpression.java
@@ -481,6 +481,8 @@ public class LambdaExpression extends FunctionalExpression implements IPolyExpre
if (expected.isParameterizedType() && argument.isParameterizedType()) {
TypeBinding[] expectedArgs = ((ParameterizedTypeBinding)expected).typeArguments();
TypeBinding[] args = ((ParameterizedTypeBinding)argument).typeArguments();
+ if (args.length != expectedArgs.length)
+ return false;
for (int j = 0; j < args.length; j++) {
if (TypeBinding.notEquals(expectedArgs[j], args[j])) {
if (expectedArgs[j].isWildcard() && args[j].isUnboundWildcard()) {

Back to the top