Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2019-07-23 11:51:49 +0000
committerStephan Herrmann2019-07-23 11:51:49 +0000
commitefd24e7042e7f6e5e796560acd02bd5961efb8a3 (patch)
tree06eeacbd4207b3f904bc61181ac44b9e0d6e7f1b
parent8b588a9d392b6205c522afd3bab1d988cf547452 (diff)
downloadeclipse.jdt.core-efd24e7042e7f6e5e796560acd02bd5961efb8a3.tar.gz
eclipse.jdt.core-efd24e7042e7f6e5e796560acd02bd5961efb8a3.tar.xz
eclipse.jdt.core-efd24e7042e7f6e5e796560acd02bd5961efb8a3.zip
Bug 549024 - [1.8][impl] inconsistent array typing inI20190723-1800
BoundSet.ThreeSets.upperBounds(boolean, InferenceVariable) Change-Id: I9ce3f79c0c1996d76678b42b96f3071bfc21f8d2
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InferenceContext18.java26
1 files changed, 21 insertions, 5 deletions
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InferenceContext18.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InferenceContext18.java
index ae20f29820..d8da7dccf7 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InferenceContext18.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InferenceContext18.java
@@ -1168,18 +1168,18 @@ public class InferenceContext18 {
if (upperBounds.length == 1) {
glb = upperBounds[0];
} else {
- ReferenceBinding[] glbs = Scope.greaterLowerBound((ReferenceBinding[])upperBounds);
+ TypeBinding[] glbs = Scope.greaterLowerBound(upperBounds, this.scope, this.environment);
if (glbs == null) {
return null;
} else if (glbs.length == 1) {
glb = glbs[0];
} else {
- IntersectionTypeBinding18 intersection = (IntersectionTypeBinding18) this.environment.createIntersectionType18(glbs);
- if (!ReferenceBinding.isConsistentIntersection(intersection.intersectingTypes)) {
+ glb = intersectionFromGlb(glbs);
+ if (glb == null) {
+ // inconsistent intersection
tmpBoundSet = prevBoundSet; // clean up
- break variables; // and start over
+ break variables; // and start over
}
- glb = intersection;
}
}
}
@@ -1273,6 +1273,22 @@ public class InferenceContext18 {
return tmpBoundSet;
}
+ private TypeBinding intersectionFromGlb(TypeBinding[] glbs) {
+ ReferenceBinding[] refGlbs = new ReferenceBinding[glbs.length];
+ for (int i = 0; i < glbs.length; i++) {
+ TypeBinding typeBinding = glbs[i];
+ if (typeBinding instanceof ReferenceBinding) {
+ refGlbs[i] = (ReferenceBinding) typeBinding;
+ } else {
+ return null;
+ }
+ }
+ IntersectionTypeBinding18 intersection = (IntersectionTypeBinding18) this.environment.createIntersectionType18(refGlbs);
+ if (ReferenceBinding.isConsistentIntersection(intersection.intersectingTypes))
+ return intersection;
+ return null;
+ }
+
int captureId = 0;
/** For 18.4: "Let Z1, ..., Zn be fresh type variables" use capture bindings. */

Back to the top