Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2019-05-19 14:09:24 -0400
committerStephan Herrmann2019-05-19 14:10:05 -0400
commit554ecdaf2404cd4cd7c4c1107e2e5850e97845e3 (patch)
tree174560d736c6d80e76d855f3b616cf01d53c904d
parentc3bca83c3ba740ea3abc5cd2e334d9ab35a56b82 (diff)
downloadeclipse.jdt.core-554ecdaf2404cd4cd7c4c1107e2e5850e97845e3.tar.gz
eclipse.jdt.core-554ecdaf2404cd4cd7c4c1107e2e5850e97845e3.tar.xz
eclipse.jdt.core-554ecdaf2404cd4cd7c4c1107e2e5850e97845e3.zip
Bug 502327 - [compiler][inference] Problem marker 'method not applicableI20190520-0600I20190519-1800
for the arguments' Change-Id: I0a4c948d6ce72772d5236fd461ee84998f0e0c79
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_8.java26
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java11
2 files changed, 36 insertions, 1 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 5d1bf7e8e5..2becc1c926 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
@@ -9880,4 +9880,30 @@ public void testBug508834_comment0() {
"The method accept(Consumer<String>) is ambiguous for the type ECJTest\n" +
"----------\n");
}
+ public void testBug502327() {
+ runConformTest(
+ new String[] {
+ "Bug.java",
+ "public class Bug {\n" +
+ "\n" +
+ " public void execute() {\n" +
+ " foo(bar(new ExampleType()));\n" +
+ " }\n" +
+ "\n" +
+ " public <VC> void foo(ClassB<VC> a) {}\n" +
+ "\n" +
+ " public <T> ClassC<T> bar(T t) {\n" +
+ " return null;\n" +
+ " }\n" +
+ "\n" +
+ " public class ClassC<T> extends ClassB<ClassC<T>.NestedClassC> {\n" +
+ " public class NestedClassC {}\n" +
+ " }\n" +
+ "\n" +
+ " public abstract static class ClassB<VC> {}\n" +
+ "\n" +
+ " public class ExampleType {}\n" +
+ "}\n"
+ });
+ }
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java
index 822d4c9278..9c91e09abe 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java
@@ -1004,6 +1004,10 @@ public class ParameterizedTypeBinding extends ReferenceBinding implements Substi
@Override
TypeBinding substituteInferenceVariable(InferenceVariable var, TypeBinding substituteType) {
+ ReferenceBinding newEnclosing = this.enclosingType;
+ if (!isStatic() && this.enclosingType != null) {
+ newEnclosing = (ReferenceBinding) this.enclosingType.substituteInferenceVariable(var, substituteType);
+ }
if (this.arguments != null) {
TypeBinding[] newArgs = null;
int length = this.arguments.length;
@@ -1017,7 +1021,9 @@ public class ParameterizedTypeBinding extends ReferenceBinding implements Substi
}
}
if (newArgs != null)
- return this.environment.createParameterizedType(this.type, newArgs, this.enclosingType);
+ return this.environment.createParameterizedType(this.type, newArgs, newEnclosing);
+ } else if (TypeBinding.notEquals(newEnclosing, this.enclosingType)) {
+ return this.environment.createParameterizedType(this.type, this.arguments, newEnclosing);
}
return this;
}
@@ -1099,6 +1105,9 @@ public class ParameterizedTypeBinding extends ReferenceBinding implements Substi
this.arguments[i].collectInferenceVariables(variables);
}
}
+ if (!isStatic() && this.enclosingType != null) {
+ this.enclosingType.collectInferenceVariables(variables);
+ }
}
/**

Back to the top