Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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