Lines 60-121
Link Here
|
60 |
if (this.superclass == null) |
60 |
if (this.superclass == null) |
61 |
return TypeConstants.OK; |
61 |
return TypeConstants.OK; |
62 |
|
62 |
|
63 |
if (argumentType.isWildcard() && !argumentType.isIntersectionType()) { |
63 |
switch(argumentType.kind()) { |
64 |
WildcardBinding wildcard = (WildcardBinding) argumentType; |
64 |
case Binding.TYPE_PARAMETER : |
65 |
switch(wildcard.boundKind) { |
65 |
if (argumentType.isCapture()) { |
66 |
case Wildcard.EXTENDS : |
66 |
CaptureBinding capture = (CaptureBinding) argumentType; |
67 |
TypeBinding wildcardBound = wildcard.bound; |
67 |
if (capture.lowerBound != null) { |
68 |
if (wildcardBound == this) |
68 |
return boundCheck(substitution, capture.lowerBound); |
|
|
69 |
} else if (capture.wildcard.boundKind == Wildcard.UNBOUND) { |
69 |
return TypeConstants.OK; |
70 |
return TypeConstants.OK; |
70 |
ReferenceBinding superclassBound = hasSubstitution ? (ReferenceBinding)Scope.substitute(substitution, this.superclass) : this.superclass; |
71 |
} |
71 |
boolean isArrayBound = wildcardBound.isArrayType(); |
72 |
} |
72 |
if (!wildcardBound.isInterface()) { |
73 |
break; |
73 |
if (superclassBound.id != TypeIds.T_JavaLangObject) { |
74 |
case Binding.WILDCARD_TYPE : |
74 |
if (isArrayBound) { |
75 |
if (!argumentType.isIntersectionType()) { |
75 |
if (!wildcardBound.isCompatibleWith(superclassBound)) |
76 |
WildcardBinding wildcard = (WildcardBinding) argumentType; |
76 |
return TypeConstants.MISMATCH; |
77 |
switch(wildcard.boundKind) { |
77 |
} else { |
78 |
case Wildcard.EXTENDS : |
78 |
TypeBinding match = ((ReferenceBinding)wildcardBound).findSuperTypeWithSameErasure(superclassBound); |
79 |
TypeBinding wildcardBound = wildcard.bound; |
79 |
if (match != null) { |
80 |
if (wildcardBound == this) |
80 |
if (!match.isIntersectingWith(superclassBound)) { |
81 |
return TypeConstants.OK; |
81 |
return TypeConstants.MISMATCH; |
82 |
ReferenceBinding superclassBound = hasSubstitution ? (ReferenceBinding)Scope.substitute(substitution, this.superclass) : this.superclass; |
|
|
83 |
boolean isArrayBound = wildcardBound.isArrayType(); |
84 |
if (!wildcardBound.isInterface()) { |
85 |
if (superclassBound.id != TypeIds.T_JavaLangObject) { |
86 |
if (isArrayBound) { |
87 |
if (!wildcardBound.isCompatibleWith(superclassBound)) |
88 |
return TypeConstants.MISMATCH; |
89 |
} else { |
90 |
TypeBinding match = ((ReferenceBinding)wildcardBound).findSuperTypeWithSameErasure(superclassBound); |
91 |
if (match != null) { |
92 |
if (!match.isIntersectingWith(superclassBound)) { |
93 |
return TypeConstants.MISMATCH; |
94 |
} |
95 |
} else { |
96 |
return TypeConstants.MISMATCH; |
97 |
} |
82 |
} |
98 |
} |
83 |
} else { |
|
|
84 |
return TypeConstants.MISMATCH; |
85 |
} |
99 |
} |
86 |
} |
100 |
} |
87 |
} |
101 |
ReferenceBinding[] superInterfaceBounds = hasSubstitution ? Scope.substitute(substitution, this.superInterfaces) : this.superInterfaces; |
88 |
} |
102 |
int length = superInterfaceBounds.length; |
89 |
ReferenceBinding[] superInterfaceBounds = hasSubstitution ? Scope.substitute(substitution, this.superInterfaces) : this.superInterfaces; |
103 |
boolean mustImplement = isArrayBound || ((ReferenceBinding)wildcardBound).isFinal(); |
90 |
int length = superInterfaceBounds.length; |
104 |
for (int i = 0; i < length; i++) { |
91 |
boolean mustImplement = isArrayBound || ((ReferenceBinding)wildcardBound).isFinal(); |
105 |
TypeBinding superInterfaceBound = superInterfaceBounds[i]; |
92 |
for (int i = 0; i < length; i++) { |
106 |
if (isArrayBound) { |
93 |
TypeBinding superInterfaceBound = superInterfaceBounds[i]; |
107 |
if (!wildcardBound.isCompatibleWith(superInterfaceBound)) |
94 |
if (isArrayBound) { |
108 |
return TypeConstants.MISMATCH; |
95 |
if (!wildcardBound.isCompatibleWith(superInterfaceBound)) |
109 |
} else { |
96 |
return TypeConstants.MISMATCH; |
110 |
TypeBinding match = wildcardBound.findSuperTypeWithSameErasure(superInterfaceBound); |
97 |
} else { |
111 |
if (match != null) { |
98 |
TypeBinding match = wildcardBound.findSuperTypeWithSameErasure(superInterfaceBound); |
112 |
if (!match.isIntersectingWith(superInterfaceBound)) { |
99 |
if (match != null) { |
113 |
return TypeConstants.MISMATCH; |
100 |
if (!match.isIntersectingWith(superInterfaceBound)) { |
114 |
} |
101 |
return TypeConstants.MISMATCH; |
115 |
} else if (mustImplement) { |
|
|
116 |
return TypeConstants.MISMATCH; // cannot be extended further to satisfy missing bounds |
117 |
} |
102 |
} |
118 |
} |
103 |
} else if (mustImplement) { |
|
|
104 |
return TypeConstants.MISMATCH; // cannot be extended further to satisfy missing bounds |
105 |
} |
106 |
} |
107 |
|
119 |
|
|
|
120 |
} |
121 |
break; |
122 |
|
123 |
case Wildcard.SUPER : |
124 |
return boundCheck(substitution, wildcard.bound); |
125 |
|
126 |
case Wildcard.UNBOUND : |
127 |
break; |
108 |
} |
128 |
} |
109 |
break; |
129 |
return TypeConstants.OK; |
110 |
|
130 |
} |
111 |
case Wildcard.SUPER : |
|
|
112 |
return boundCheck(substitution, wildcard.bound); |
113 |
|
114 |
case Wildcard.UNBOUND : |
115 |
break; |
116 |
} |
117 |
return TypeConstants.OK; |
118 |
} |
131 |
} |
|
|
132 |
|
119 |
boolean unchecked = false; |
133 |
boolean unchecked = false; |
120 |
if (this.superclass.id != TypeIds.T_JavaLangObject) { |
134 |
if (this.superclass.id != TypeIds.T_JavaLangObject) { |
121 |
TypeBinding superType = this.superclass; |
135 |
TypeBinding superType = this.superclass; |