View | Details | Raw Unified | Return to bug 203318
Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/lookup/CaptureBinding.java (-3 / +12 lines)
Lines 101-107 Link Here
101
		switch (wildcard.boundKind) {
101
		switch (wildcard.boundKind) {
102
			case Wildcard.EXTENDS :
102
			case Wildcard.EXTENDS :
103
				// still need to capture bound supertype as well so as not to expose wildcards to the outside (111208)
103
				// still need to capture bound supertype as well so as not to expose wildcards to the outside (111208)
104
				TypeBinding substitutedWildcardBound = originalWildcardBound.capture(scope, this.position);
104
				TypeBinding capturedWildcardBound = originalWildcardBound.capture(scope, this.position);
105
				TypeBinding substitutedWildcardBound = Scope.substitute(capturedParameterizedType, capturedWildcardBound);
105
				if (wildcard.bound.isInterface()) {
106
				if (wildcard.bound.isInterface()) {
106
					this.superclass = substitutedVariableSuperclass;
107
					this.superclass = substitutedVariableSuperclass;
107
					// merge wildcard bound into variable superinterfaces using glb
108
					// merge wildcard bound into variable superinterfaces using glb
Lines 114-121 Link Here
114
						this.superInterfaces = Scope.greaterLowerBound(substitutedVariableInterfaces);
115
						this.superInterfaces = Scope.greaterLowerBound(substitutedVariableInterfaces);
115
					}
116
					}
116
				} else {
117
				} else {
117
					// per construction the wildcard bound is a subtype of variable superclass
118
					// the wildcard bound should be a subtype of variable superclass
118
					this.superclass = wildcard.bound.isArrayType() ? substitutedVariableSuperclass : (ReferenceBinding) substitutedWildcardBound;
119
					// it may occur that the bound is less specific, then consider glb (202404)
120
					if (substitutedWildcardBound.isArrayType() || substitutedWildcardBound == this) {
121
						this.superclass = substitutedVariableSuperclass;
122
					} else {
123
						this.superclass = (ReferenceBinding) substitutedWildcardBound;
124
						if (this.superclass.isSuperclassOf(substitutedVariableSuperclass)) {
125
							this.superclass = substitutedVariableSuperclass;
126
						}
127
					}
119
					this.superInterfaces = substitutedVariableInterfaces;
128
					this.superInterfaces = substitutedVariableInterfaces;
120
				}
129
				}
121
				this.firstBound =  substitutedWildcardBound;
130
				this.firstBound =  substitutedWildcardBound;

Return to bug 203318