mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
return type equivalence: compare supers with current method (IDEA-147335)
This commit is contained in:
+3
-4
@@ -1302,9 +1302,8 @@ public class HighlightMethodUtil {
|
||||
}
|
||||
if (currentMethod.getTypeParameters().length > 0 && JavaGenericsUtil.isRawToGeneric(currentType, otherSuperReturnType)) continue;
|
||||
}
|
||||
return createIncompatibleReturnTypeMessage(currentMethod, otherSuperMethod, otherSuperReturnType,
|
||||
currentType, JavaErrorMessages.message("unrelated.overriding.methods.return.types"),
|
||||
TextRange.EMPTY_RANGE);
|
||||
return createIncompatibleReturnTypeMessage(otherSuperMethod, currentMethod, currentType, otherSuperReturnType,
|
||||
JavaErrorMessages.message("unrelated.overriding.methods.return.types"), TextRange.EMPTY_RANGE);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -1327,7 +1326,7 @@ public class HighlightMethodUtil {
|
||||
HighlightInfo highlightInfo;
|
||||
if (allAbstracts) {
|
||||
superSignatures = new ArrayList<HierarchicalMethodSignature>(superSignatures);
|
||||
superSignatures.add(signature);
|
||||
superSignatures.add(0, signature);
|
||||
highlightInfo = checkInterfaceInheritedMethodsReturnTypes(superSignatures, languageLevel);
|
||||
}
|
||||
else {
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
abstract class Child implements Human {}
|
||||
interface Human extends Mother, Father {
|
||||
Human me();
|
||||
}
|
||||
|
||||
interface Father {
|
||||
Father me();
|
||||
}
|
||||
|
||||
interface Mother {
|
||||
Mother me();
|
||||
}
|
||||
@@ -555,6 +555,10 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false);
|
||||
}
|
||||
|
||||
public void testReturnTypeOverrideEquivalenceWithTypeHierarchy() throws Exception {
|
||||
doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false);
|
||||
}
|
||||
|
||||
public void testLeastUpperBoundWithRecursiveTypes() throws Exception {
|
||||
final PsiManager manager = getPsiManager();
|
||||
final GlobalSearchScope scope = GlobalSearchScope.allScope(getProject());
|
||||
|
||||
Reference in New Issue
Block a user