Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2019-05-09 12:29:59 -0400
committerStephan Herrmann2019-05-09 12:29:59 -0400
commit752fbc656301185a7a6ecbffce294c8b25e839a2 (patch)
tree4730537159b4b89995bd67c86a636eae7ddf3a9c
parenta0eca8b50fc813cb95b189171f5872e3c1c42852 (diff)
downloadeclipse.jdt.core-I20190509-1800.tar.gz
eclipse.jdt.core-I20190509-1800.tar.xz
eclipse.jdt.core-I20190509-1800.zip
Bug 547061 - [1.8][inference] Unresolved compilation problem forI20190509-1800
exception in lambda Change-Id: I5704a6e714d842156b6509a99e84d618a362be51 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.java48
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java4
2 files changed, 49 insertions, 3 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 8a1217eb45..0b7af701e4 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
@@ -9777,4 +9777,52 @@ public void testBug508834_comment0() {
"}\n"
});
}
+ public void testBug547061() {
+ runConformTest(
+ new String[] {
+ "test2/Problematic.java",
+ "package test2;\n" +
+ "\n" +
+ "import java.io.IOException;\n" +
+ "import java.util.Collections;\n" +
+ "import java.util.Set;\n" +
+ "import java.util.function.Consumer;\n" +
+ "\n" +
+ "public class Problematic {\n" +
+ "\n" +
+ " @FunctionalInterface\n" +
+ " private interface ThrowingConsumer<T, E extends Throwable> {\n" +
+ " void accept(T t) throws E;\n" +
+ " }\n" +
+ "\n" +
+ " private class FileAsset {\n" +
+ " public FileAsset move(String path) throws IOException {\n" +
+ " System.out.println(path);\n" +
+ " return null;\n" +
+ " }\n" +
+ " }\n" +
+ "\n" +
+ " static <T, E extends Exception> void process(Consumer<Consumer<T>> code, ThrowingConsumer<T, E> throwingConsumer)\n" +
+ " throws E {\n" +
+ " code.accept(t -> {\n" +
+ " try {\n" +
+ " throwingConsumer.accept(t);\n" +
+ " } catch (Exception e) {\n" +
+ " e.printStackTrace();\n" +
+ " }\n" +
+ " });\n" +
+ " }\n" +
+ "\n" +
+ " public void execute(String path) throws IOException {\n" +
+ " Set<FileAsset> set = Collections.singleton(new FileAsset());\n" +
+ " process(set::forEach, (asset) -> {\n" +
+ " process(set::forEach, (asset2) -> {\n" +
+ " asset2.move(path);\n" +
+ " });\n" +
+ " });\n" +
+ "\n" +
+ " }\n" +
+ "}\n"
+ });
+ }
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java
index 6e7970e621..f6e8a51e2d 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java
@@ -70,7 +70,6 @@ import static org.eclipse.jdt.internal.compiler.ast.ExpressionContext.*;
import java.util.HashMap;
import org.eclipse.jdt.core.compiler.CharOperation;
-import org.eclipse.jdt.core.compiler.IProblem;
import org.eclipse.jdt.internal.compiler.ASTVisitor;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.codegen.CodeStream;
@@ -678,8 +677,7 @@ public TypeBinding resolveType(BlockScope scope) {
}
this.actualReceiverType = this.receiver.resolveType(scope);
if (this.actualReceiverType instanceof InferenceVariable) {
- scope.referenceContext().tagAsHavingIgnoredMandatoryErrors(IProblem.UndefinedMethod);
- return null; // not yet ready for resolving
+ return null; // not yet ready for resolving
}
this.receiverIsType = this.receiver instanceof NameReference && (((NameReference) this.receiver).bits & Binding.TYPE) != 0;
if (receiverCast && this.actualReceiverType != null) {

Back to the top