Lines 162-169
Link Here
|
162 |
// iterate superclass to avoid recording interfaces if searched supertype is class |
162 |
// iterate superclass to avoid recording interfaces if searched supertype is class |
163 |
if (erasureIsClass) { |
163 |
if (erasureIsClass) { |
164 |
while ((currentType = currentType.superclass()) != null) { |
164 |
while ((currentType = currentType.superclass()) != null) { |
165 |
if (currentType.id == wellKnownErasureID || (!currentType.isTypeVariable() && !currentType.isIntersectionType() && currentType.erasure().id == wellKnownErasureID)) |
165 |
if (currentType.id == wellKnownErasureID) |
166 |
return currentType; |
166 |
return currentType; |
|
|
167 |
switch(currentType.kind()) { |
168 |
case Binding.PARAMETERIZED_TYPE : |
169 |
case Binding.RAW_TYPE : |
170 |
case Binding.ARRAY_TYPE : |
171 |
if (currentType.erasure().id == wellKnownErasureID) |
172 |
return currentType; |
173 |
} |
167 |
} |
174 |
} |
168 |
return null; |
175 |
return null; |
169 |
} |
176 |
} |
Lines 191-199
Link Here
|
191 |
|
198 |
|
192 |
for (int i = 0; i < nextPosition; i++) { |
199 |
for (int i = 0; i < nextPosition; i++) { |
193 |
currentType = interfacesToVisit[i]; |
200 |
currentType = interfacesToVisit[i]; |
194 |
if (currentType.id == wellKnownErasureID || (!currentType.isTypeVariable() && !currentType.isIntersectionType() && currentType.erasure().id == wellKnownErasureID)) |
201 |
if (currentType.id == wellKnownErasureID) |
195 |
return currentType; |
202 |
return currentType; |
196 |
|
203 |
switch(currentType.kind()) { |
|
|
204 |
case Binding.PARAMETERIZED_TYPE : |
205 |
case Binding.RAW_TYPE : |
206 |
case Binding.ARRAY_TYPE : |
207 |
if (currentType.erasure().id == wellKnownErasureID) |
208 |
return currentType; |
209 |
} |
197 |
ReferenceBinding[] itsInterfaces = currentType.superInterfaces(); |
210 |
ReferenceBinding[] itsInterfaces = currentType.superInterfaces(); |
198 |
if (itsInterfaces != null && itsInterfaces != Binding.NO_SUPERINTERFACES) { |
211 |
if (itsInterfaces != null && itsInterfaces != Binding.NO_SUPERINTERFACES) { |
199 |
int itsLength = itsInterfaces.length; |
212 |
int itsLength = itsInterfaces.length; |
Lines 216-222
Link Here
|
216 |
public TypeBinding findSuperTypeWithSameErasure(TypeBinding otherType) { |
229 |
public TypeBinding findSuperTypeWithSameErasure(TypeBinding otherType) { |
217 |
if (this == otherType) return this; |
230 |
if (this == otherType) return this; |
218 |
if (otherType == null) return null; |
231 |
if (otherType == null) return null; |
219 |
switch(kind()) { |
232 |
int kind; |
|
|
233 |
switch(kind = kind()) { |
220 |
case Binding.ARRAY_TYPE : |
234 |
case Binding.ARRAY_TYPE : |
221 |
ArrayBinding arrayType = (ArrayBinding) this; |
235 |
ArrayBinding arrayType = (ArrayBinding) this; |
222 |
int otherDim = otherType.dimensions(); |
236 |
int otherDim = otherType.dimensions(); |
Lines 253-265
Link Here
|
253 |
case Binding.RAW_TYPE : |
267 |
case Binding.RAW_TYPE : |
254 |
case Binding.WILDCARD_TYPE : |
268 |
case Binding.WILDCARD_TYPE : |
255 |
// do not allow type variables/intersection types to match with erasures for free |
269 |
// do not allow type variables/intersection types to match with erasures for free |
256 |
if (!otherType.isTypeVariable() && !otherType.isIntersectionType()) otherType = otherType.erasure(); |
270 |
switch(otherType.kind()) { |
257 |
if (this == otherType || (!isTypeVariable() && !isIntersectionType() && erasure() == otherType)) return this; |
271 |
case Binding.PARAMETERIZED_TYPE : |
|
|
272 |
case Binding.RAW_TYPE : |
273 |
case Binding.ARRAY_TYPE : |
274 |
otherType = otherType.erasure(); |
275 |
} |
276 |
if (this == otherType) |
277 |
return this; |
278 |
switch(kind) { |
279 |
case Binding.PARAMETERIZED_TYPE : |
280 |
case Binding.RAW_TYPE : |
281 |
case Binding.ARRAY_TYPE : |
282 |
if (erasure() == otherType) |
283 |
return this; |
284 |
} |
258 |
|
285 |
|
259 |
ReferenceBinding currentType = (ReferenceBinding)this; |
286 |
ReferenceBinding currentType = (ReferenceBinding)this; |
260 |
if (!otherType.isInterface()) { |
287 |
if (!otherType.isInterface()) { |
261 |
while ((currentType = currentType.superclass()) != null) { |
288 |
while ((currentType = currentType.superclass()) != null) { |
262 |
if (currentType == otherType || (!currentType.isTypeVariable() && !currentType.isIntersectionType() && currentType.erasure() == otherType)) return currentType; |
289 |
if (currentType == otherType) |
|
|
290 |
return currentType; |
291 |
switch(currentType.kind()) { |
292 |
case Binding.PARAMETERIZED_TYPE : |
293 |
case Binding.RAW_TYPE : |
294 |
case Binding.ARRAY_TYPE : |
295 |
if (currentType.erasure() == otherType) |
296 |
return currentType; |
297 |
} |
263 |
} |
298 |
} |
264 |
return null; |
299 |
return null; |
265 |
} |
300 |
} |
Lines 287-295
Link Here
|
287 |
|
322 |
|
288 |
for (int i = 0; i < nextPosition; i++) { |
323 |
for (int i = 0; i < nextPosition; i++) { |
289 |
currentType = interfacesToVisit[i]; |
324 |
currentType = interfacesToVisit[i]; |
290 |
if (currentType == otherType || (!currentType.isTypeVariable() && !currentType.isIntersectionType() && currentType.erasure() == otherType)) |
325 |
if (currentType == otherType) |
291 |
return currentType; |
326 |
return currentType; |
292 |
|
327 |
switch(currentType.kind()) { |
|
|
328 |
case Binding.PARAMETERIZED_TYPE : |
329 |
case Binding.RAW_TYPE : |
330 |
case Binding.ARRAY_TYPE : |
331 |
if (currentType.erasure() == otherType) |
332 |
return currentType; |
333 |
} |
293 |
ReferenceBinding[] itsInterfaces = currentType.superInterfaces(); |
334 |
ReferenceBinding[] itsInterfaces = currentType.superInterfaces(); |
294 |
if (itsInterfaces != Binding.NO_SUPERINTERFACES) { |
335 |
if (itsInterfaces != Binding.NO_SUPERINTERFACES) { |
295 |
int itsLength = itsInterfaces.length; |
336 |
int itsLength = itsInterfaces.length; |