KT-3307 Compiler exception trying to call Java method
#KT-3307 Fixed
This commit is contained in:
+10
-1
@@ -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() {
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user