mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
abstract method overrides abstract: distinguish between covariant returns (IDEA-121930)
(cherry picked from commit 52e7e2b268ad91e5c9a23c8a4671b1a3b9db89f5)
This commit is contained in:
+1
-1
@@ -217,7 +217,7 @@ public class AbstractMethodOverridesAbstractMethodInspection extends BaseInspect
|
||||
if (aClass == null || superClass == null) return false;
|
||||
final PsiSubstitutor substitutor = TypeConversionUtil.getSuperClassSubstitutor(superClass, aClass, PsiSubstitutor.EMPTY);
|
||||
final PsiType type2 = method2.getReturnType();
|
||||
return Comparing.equal(TypeConversionUtil.erasure(type1), TypeConversionUtil.erasure(substitutor.substitute(type2)));
|
||||
return Comparing.equal(type1, substitutor.substitute(type2));
|
||||
}
|
||||
|
||||
private boolean isAbstract(PsiMethod method) {
|
||||
|
||||
+14
-1
@@ -78,4 +78,17 @@ class Java8DefaultMethods {
|
||||
System.out.println("sub");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class CovariantReturnTypes {
|
||||
interface A<T> {}
|
||||
interface Foo {
|
||||
A<? extends Number> test();
|
||||
}
|
||||
|
||||
interface Bar extends Foo {
|
||||
@Override
|
||||
A<Integer> test();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user