Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2019-03-06 17:40:06 -0500
committerStephan Herrmann2019-03-06 17:40:30 -0500
commitc6d7ef991f723f8b37cf85f1d368979f6e5f0485 (patch)
tree7c47cff80e5e693345828ddbc2b02647f3674b28
parent3325ba8a5c8f5838e0a099c7cdf97d24854143fd (diff)
downloadeclipse.jdt.core-c6d7ef991f723f8b37cf85f1d368979f6e5f0485.tar.gz
eclipse.jdt.core-c6d7ef991f723f8b37cf85f1d368979f6e5f0485.tar.xz
eclipse.jdt.core-c6d7ef991f723f8b37cf85f1d368979f6e5f0485.zip
Bug 545121 - [inference] Certain method invocations rejected involvingS4_11_0_RC2R4_11I20190307-0500
loose arguments and boxing/unboxing Change-Id: I2861ff10f0501aa17de6cd1be977c1a7914a7ff5 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.java13
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CaptureBinding18.java23
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/IntersectionTypeBinding18.java21
3 files changed, 28 insertions, 29 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 1504327072..e2fe76ef0e 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
@@ -9572,4 +9572,17 @@ public void testBug508834_comment0() {
"}\n"
});
}
+ public void testBug545121() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " <T extends V, U extends T, V> void foo(U arg1, T arg2, V arg3) {}\n" +
+ "\n" +
+ " void check() {\n" +
+ " foo((Long) 0l, 0d, \"\");\n" +
+ " }\n" +
+ "}\n"
+ });
+ }
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CaptureBinding18.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CaptureBinding18.java
index 2dc50f4c69..447df46720 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CaptureBinding18.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CaptureBinding18.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013, 2014 GK Software AG.
+ * Copyright (c) 2013, 2019 GK Software AG.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -155,22 +155,15 @@ public class CaptureBinding18 extends CaptureBinding {
rightIntersectingTypes = ((IntersectionTypeBinding18) otherType).intersectingTypes;
}
if (rightIntersectingTypes != null) {
- int numRequired = rightIntersectingTypes.length;
- TypeBinding[] required = new TypeBinding[numRequired];
- System.arraycopy(rightIntersectingTypes, 0, required, 0, numRequired);
- for (int i = 0; i < length; i++) {
- TypeBinding provided = this.upperBounds[i];
- for (int j = 0; j < required.length; j++) {
- if (required[j] == null) continue;
- if (provided.isCompatibleWith(required[j], captureScope)) {
- required[j] = null;
- if (--numRequired == 0)
- return true;
- break;
- }
+ nextRequired:
+ for (TypeBinding required : rightIntersectingTypes) {
+ for (TypeBinding provided : this.upperBounds) {
+ if (provided.isCompatibleWith(required, captureScope))
+ continue nextRequired;
}
+ return false;
}
- return false;
+ return true;
}
for (int i = 0; i < length; i++) {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/IntersectionTypeBinding18.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/IntersectionTypeBinding18.java
index 649ff04324..e30bbb5442 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/IntersectionTypeBinding18.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/IntersectionTypeBinding18.java
@@ -187,22 +187,15 @@ public class IntersectionTypeBinding18 extends ReferenceBinding {
rightIntersectingTypes = ((IntersectionTypeBinding18) right).intersectingTypes;
}
if (rightIntersectingTypes != null) {
- int numRequired = rightIntersectingTypes.length;
- TypeBinding[] required = new TypeBinding[numRequired];
- System.arraycopy(rightIntersectingTypes, 0, required, 0, numRequired);
- for (int i = 0; i < this.length; i++) {
- TypeBinding provided = this.intersectingTypes[i];
- for (int j = 0; j < required.length; j++) {
- if (required[j] == null) continue;
- if (provided.isCompatibleWith(required[j], scope)) {
- required[j] = null;
- if (--numRequired == 0)
- return true;
- break;
- }
+ nextRequired:
+ for (TypeBinding required : rightIntersectingTypes) {
+ for (TypeBinding provided : this.intersectingTypes) {
+ if (provided.isCompatibleWith(required, scope))
+ continue nextRequired;
}
+ return false;
}
- return false;
+ return true;
}
// normal case:

Back to the top