Lines 10-15
Link Here
|
10 |
*******************************************************************************/ |
10 |
*******************************************************************************/ |
11 |
package org.eclipse.jdt.internal.compiler.lookup; |
11 |
package org.eclipse.jdt.internal.compiler.lookup; |
12 |
|
12 |
|
|
|
13 |
import org.eclipse.jdt.internal.compiler.ast.MessageSend; |
13 |
import org.eclipse.jdt.internal.compiler.util.HashtableOfObject; |
14 |
import org.eclipse.jdt.internal.compiler.util.HashtableOfObject; |
14 |
|
15 |
|
15 |
class MethodVerifier15 extends MethodVerifier { |
16 |
class MethodVerifier15 extends MethodVerifier { |
Lines 317-338
Link Here
|
317 |
if (inheritedTypeVariables == NoTypeVariables) return inheritedMethod; |
318 |
if (inheritedTypeVariables == NoTypeVariables) return inheritedMethod; |
318 |
TypeVariableBinding[] typeVariables = currentMethod == null ? NoTypeVariables : currentMethod.typeVariables; |
319 |
TypeVariableBinding[] typeVariables = currentMethod == null ? NoTypeVariables : currentMethod.typeVariables; |
319 |
|
320 |
|
320 |
int inheritedLength = inheritedTypeVariables.length; |
321 |
if (inheritedMethod.parameters.length != currentMethod.parameters.length) return inheritedMethod; |
321 |
int length = typeVariables.length; |
322 |
|
322 |
TypeBinding[] arguments = new TypeBinding[inheritedLength]; |
323 |
MessageSend invocationSite = new MessageSend(); |
323 |
if (inheritedLength <= length) { |
324 |
if (currentMethod.returnType instanceof ReferenceBinding) { |
324 |
System.arraycopy(typeVariables, 0, arguments, 0, inheritedLength); |
325 |
invocationSite.expectedType = ((ReferenceBinding)currentMethod.returnType).findSuperTypeWithSameErasure(inheritedMethod.returnType); |
325 |
} else { |
326 |
} |
326 |
System.arraycopy(typeVariables, 0, arguments, 0, length); |
327 |
MethodBinding substitute = ParameterizedGenericMethodBinding.computeCompatibleMethod(inheritedMethod, currentMethod.parameters, this.type.scope, invocationSite); |
327 |
for (int i = length; i < inheritedLength; i++) |
328 |
return substitute == null ? inheritedMethod : substitute; |
328 |
arguments[i] = inheritedTypeVariables[i].erasure(); |
|
|
329 |
} |
330 |
ParameterizedGenericMethodBinding substitute = |
331 |
new ParameterizedGenericMethodBinding(inheritedMethod, arguments, this.environment); |
332 |
for (int i = 0; i < inheritedLength; i++) |
333 |
if (inheritedTypeVariables[i].boundCheck(substitute, arguments[i]) != TypeConstants.OK) |
334 |
return inheritedMethod; // incompatible due to bound check |
335 |
return substitute; |
336 |
} |
329 |
} |
337 |
boolean detectInheritedMethodClash(MethodBinding inherited, MethodBinding otherInherited) { |
330 |
boolean detectInheritedMethodClash(MethodBinding inherited, MethodBinding otherInherited) { |
338 |
if (!inherited.areParameterErasuresEqual(otherInherited) || inherited.returnType.erasure() != otherInherited.returnType.erasure()) return false; |
331 |
if (!inherited.areParameterErasuresEqual(otherInherited) || inherited.returnType.erasure() != otherInherited.returnType.erasure()) return false; |