KT-3307 Compiler exception trying to call Java method

#KT-3307 Fixed
This commit is contained in:
Andrey Breslav
2013-02-07 15:40:12 +04:00
parent 091399aa4b
commit 0b4b87fc3a
7 changed files with 81 additions and 6 deletions
@@ -95,7 +95,8 @@ public class RawTypesCheck {
}
for (HierarchicalMethodSignature superSignature : method.getHierarchicalMethodSignature().getSuperSignatures()) {
if (superSignature.isRaw() || hasRawTypesInSignature(superSignature.getMethod())) {
PsiMethod superMethod = superSignature.getMethod();
if (superSignature.isRaw() || typeParameterIsErased(method, superMethod) || hasRawTypesInSignature(superMethod)) {
return true;
}
}
@@ -103,6 +104,14 @@ public class RawTypesCheck {
return false;
}
private static boolean typeParameterIsErased(@NotNull PsiMethod a, @NotNull PsiMethod b) {
// Java allows you to write
// <T extends Foo> T foo(), in the superclass and then
// Foo foo(), in the subclass
// this is a valid Java override, but in fact it is an erasure
return a.getTypeParameters().length != b.getTypeParameters().length;
}
private RawTypesCheck() {
}
}