mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
generics: do not prefer interface over super class even if return type is more specific (IDEA-110568)
This commit is contained in:
+1
@@ -302,6 +302,7 @@ public class JavaMethodsConflictResolver implements PsiConflictResolver{
|
||||
final PsiType returnType = eSubstitutor.substitute(existingMethod.getReturnType());
|
||||
final PsiType returnType1 = cSubstitutor.substitute(method.getReturnType());
|
||||
if (returnType != null && returnType1 != null && !returnType1.equals(returnType) && TypeConversionUtil.isAssignable(returnType, returnType1, false)) {
|
||||
if (class1.isInterface() && !existingClass.isInterface()) continue;
|
||||
conflicts.remove(existing);
|
||||
} else {
|
||||
conflicts.remove(i);
|
||||
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
import java.util.Collection;
|
||||
|
||||
public class IncorrectError extends NarrowClass {
|
||||
public Collection<String> bar() {
|
||||
return super.doStuff();
|
||||
}
|
||||
}
|
||||
|
||||
interface Interface {
|
||||
Collection<String> doStuff();
|
||||
}
|
||||
|
||||
class NarrowClass extends BaseClass implements Interface {
|
||||
}
|
||||
|
||||
class BaseClass {
|
||||
public Collection doStuff() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -244,6 +244,7 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testIllegalForwardReferenceInTypeParameterDefinition() throws Exception { doTest5(false);}
|
||||
|
||||
public void testIDEA57877() throws Exception { doTest5(false);}
|
||||
public void testIDEA110568() throws Exception { doTest5(false);}
|
||||
public void testTypeParamsCyclicInference() throws Exception { doTest5(false);}
|
||||
public void testCaptureTopLevelWildcardsForConditionalExpression() throws Exception { doTest5(false);}
|
||||
public void testGenericsOverrideMethodInRawInheritor() throws Exception { doTest5(false);}
|
||||
|
||||
Reference in New Issue
Block a user