Lines 898-904
Link Here
|
898 |
// in >= 1.5 mode, ensure the exactMatch did not match raw types |
898 |
// in >= 1.5 mode, ensure the exactMatch did not match raw types |
899 |
if (compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5) |
899 |
if (compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5) |
900 |
for (int i = argumentTypes.length; --i >= 0;) |
900 |
for (int i = argumentTypes.length; --i >= 0;) |
901 |
if (argumentTypes[i].isRawType()) |
901 |
if (isSubtypeOfRawType(argumentTypes[i])) |
902 |
return null; |
902 |
return null; |
903 |
// must find both methods for this case: <S extends A> void foo() {} and <N extends B> N foo() { return null; } |
903 |
// must find both methods for this case: <S extends A> void foo() {} and <N extends B> N foo() { return null; } |
904 |
// or find an inherited method when the exact match is to a bridge method |
904 |
// or find an inherited method when the exact match is to a bridge method |
Lines 2784-2805
Link Here
|
2784 |
if (oneParam == twoParam || oneParam.isCompatibleWith(twoParam)) { |
2784 |
if (oneParam == twoParam || oneParam.isCompatibleWith(twoParam)) { |
2785 |
if (two.declaringClass.isRawType()) continue next; |
2785 |
if (two.declaringClass.isRawType()) continue next; |
2786 |
|
2786 |
|
2787 |
TypeBinding originalOneParam = one.original().parameters[i].leafComponentType(); |
2787 |
TypeBinding originalTwoParam = two.original().parameters[i].leafComponentType(); |
2788 |
switch (originalOneParam.kind()) { |
2788 |
switch (originalTwoParam.kind()) { |
2789 |
case Binding.TYPE_PARAMETER : |
2789 |
case Binding.TYPE_PARAMETER : |
2790 |
if (!((TypeVariableBinding) originalOneParam).upperBound().isRawType()) break; |
2790 |
if (((TypeVariableBinding) originalTwoParam).hasOnlyRawBounds()) |
|
|
2791 |
continue next; |
2791 |
//$FALL-THROUGH$ |
2792 |
//$FALL-THROUGH$ |
2792 |
case Binding.RAW_TYPE: |
2793 |
case Binding.WILDCARD_TYPE : |
2793 |
// originalOneParam is RAW so it cannot be more specific than a wildcard or parameterized type |
2794 |
case Binding.INTERSECTION_TYPE: |
2794 |
TypeBinding originalTwoParam = two.original().parameters[i].leafComponentType(); |
2795 |
case Binding.PARAMETERIZED_TYPE : |
2795 |
switch (originalTwoParam.kind()) { |
2796 |
TypeBinding originalOneParam = one.original().parameters[i].leafComponentType(); |
|
|
2797 |
switch (originalOneParam.kind()) { |
2798 |
case Binding.TYPE : |
2799 |
case Binding.GENERIC_TYPE : |
2800 |
TypeBinding inheritedTwoParam = oneParam.findSuperTypeOriginatingFrom(twoParam); |
2801 |
if (inheritedTwoParam == null || !inheritedTwoParam.leafComponentType().isRawType()) break; |
2802 |
return false; |
2796 |
case Binding.TYPE_PARAMETER : |
2803 |
case Binding.TYPE_PARAMETER : |
2797 |
if (((TypeVariableBinding) originalTwoParam).hasOnlyRawBounds()) |
2804 |
if (!((TypeVariableBinding) originalOneParam).upperBound().isRawType()) break; |
2798 |
continue next; |
2805 |
return false; |
2799 |
return false; |
2806 |
case Binding.RAW_TYPE: |
2800 |
case Binding.WILDCARD_TYPE : |
2807 |
// originalOneParam is RAW so it cannot be more specific than a wildcard or parameterized type |
2801 |
case Binding.INTERSECTION_TYPE: |
|
|
2802 |
case Binding.PARAMETERIZED_TYPE : |
2803 |
return false; |
2808 |
return false; |
2804 |
} |
2809 |
} |
2805 |
} |
2810 |
} |
Lines 2970-2975
Link Here
|
2970 |
return false; |
2975 |
return false; |
2971 |
} |
2976 |
} |
2972 |
|
2977 |
|
|
|
2978 |
public boolean isSubtypeOfRawType(TypeBinding paramType) { |
2979 |
TypeBinding t = paramType.leafComponentType(); |
2980 |
if (t.isBaseType()) return false; |
2981 |
|
2982 |
ReferenceBinding currentType = (ReferenceBinding) t; |
2983 |
ReferenceBinding[] interfacesToVisit = null; |
2984 |
int nextPosition = 0; |
2985 |
do { |
2986 |
if (currentType.isRawType()) return true; |
2987 |
|
2988 |
ReferenceBinding[] itsInterfaces = currentType.superInterfaces(); |
2989 |
if (itsInterfaces != null && itsInterfaces != Binding.NO_SUPERINTERFACES) { |
2990 |
if (interfacesToVisit == null) { |
2991 |
interfacesToVisit = itsInterfaces; |
2992 |
nextPosition = interfacesToVisit.length; |
2993 |
} else { |
2994 |
int itsLength = itsInterfaces.length; |
2995 |
if (nextPosition + itsLength >= interfacesToVisit.length) |
2996 |
System.arraycopy(interfacesToVisit, 0, interfacesToVisit = new ReferenceBinding[nextPosition + itsLength + 5], 0, nextPosition); |
2997 |
nextInterface : for (int a = 0; a < itsLength; a++) { |
2998 |
ReferenceBinding next = itsInterfaces[a]; |
2999 |
for (int b = 0; b < nextPosition; b++) |
3000 |
if (next == interfacesToVisit[b]) continue nextInterface; |
3001 |
interfacesToVisit[nextPosition++] = next; |
3002 |
} |
3003 |
} |
3004 |
} |
3005 |
} while ((currentType = currentType.superclass()) != null); |
3006 |
|
3007 |
for (int i = 0; i < nextPosition; i++) { |
3008 |
currentType = interfacesToVisit[i]; |
3009 |
if (currentType.isRawType()) return true; |
3010 |
|
3011 |
ReferenceBinding[] itsInterfaces = currentType.superInterfaces(); |
3012 |
if (itsInterfaces != null && itsInterfaces != Binding.NO_SUPERINTERFACES) { |
3013 |
int itsLength = itsInterfaces.length; |
3014 |
if (nextPosition + itsLength >= interfacesToVisit.length) |
3015 |
System.arraycopy(interfacesToVisit, 0, interfacesToVisit = new ReferenceBinding[nextPosition + itsLength + 5], 0, nextPosition); |
3016 |
nextInterface : for (int a = 0; a < itsLength; a++) { |
3017 |
ReferenceBinding next = itsInterfaces[a]; |
3018 |
for (int b = 0; b < nextPosition; b++) |
3019 |
if (next == interfacesToVisit[b]) continue nextInterface; |
3020 |
interfacesToVisit[nextPosition++] = next; |
3021 |
} |
3022 |
} |
3023 |
} |
3024 |
return false; |
3025 |
} |
3026 |
|
2973 |
private TypeBinding leastContainingInvocation(TypeBinding mec, Object invocationData, List lubStack) { |
3027 |
private TypeBinding leastContainingInvocation(TypeBinding mec, Object invocationData, List lubStack) { |
2974 |
if (invocationData == null) return mec; // no alternate invocation |
3028 |
if (invocationData == null) return mec; // no alternate invocation |
2975 |
if (invocationData instanceof TypeBinding) { // only one invocation, simply return it (array only allocated if more than one) |
3029 |
if (invocationData instanceof TypeBinding) { // only one invocation, simply return it (array only allocated if more than one) |