768 if (!types.isSameTypes(m1.erasure(types).getParameterTypes(), |
768 if (!types.isSameTypes(m1.erasure(types).getParameterTypes(), |
769 m2.erasure(types).getParameterTypes())) |
769 m2.erasure(types).getParameterTypes())) |
770 return ambiguityError(m1, m2); |
770 return ambiguityError(m1, m2); |
771 // both abstract, neither overridden; merge throws clause and result type |
771 // both abstract, neither overridden; merge throws clause and result type |
772 Symbol mostSpecific; |
772 Symbol mostSpecific; |
773 Type result2 = mt2.getReturnType(); |
773 if (types.returnTypeSubstitutable(mt1, mt2)) |
774 if (mt2.tag == FORALL) |
|
775 result2 = types.subst(result2, ((ForAll)mt2).tvars, ((ForAll)mt1).tvars); |
|
776 if (types.isSubtype(mt1.getReturnType(), result2)) |
|
777 mostSpecific = m1; |
774 mostSpecific = m1; |
778 else if (types.isSubtype(result2, mt1.getReturnType())) |
775 else if (types.returnTypeSubstitutable(mt2, mt1)) |
779 mostSpecific = m2; |
776 mostSpecific = m2; |
780 else { |
777 else { |
781 // Theoretically, this can't happen, but it is possible |
778 // Theoretically, this can't happen, but it is possible |
782 // due to error recovery or mixing incompatible class files |
779 // due to error recovery or mixing incompatible class files |
783 return ambiguityError(m1, m2); |
780 return ambiguityError(m1, m2); |