mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
incompatible return types in hierarchy fixed (IDEA-173809)
take parameter bounds into account
This commit is contained in:
@@ -195,7 +195,9 @@ public class HighlightMethodUtil {
|
||||
|
||||
if (returnType.equals(substitutedSuperReturnType)) return null;
|
||||
if (!(returnType instanceof PsiPrimitiveType) && substitutedSuperReturnType.getDeepComponentType() instanceof PsiClassType) {
|
||||
if (isJdk15 && TypeConversionUtil.isAssignable(substitutedSuperReturnType, returnType)) {
|
||||
if (isJdk15 && LambdaUtil.performWithSubstitutedParameterBounds(methodSignature.getTypeParameters(),
|
||||
methodSignature.getSubstitutor(),
|
||||
() -> TypeConversionUtil.isAssignable(substitutedSuperReturnType, returnType))) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
class ListA<Ta> {
|
||||
public <R extends Ta> Ta foo() { throw new Error(); }
|
||||
}
|
||||
|
||||
class ListB<Tb> extends ListA<Tb> {
|
||||
public <Rb extends Tb> Rb foo() { throw new Error(); }
|
||||
}
|
||||
|
||||
class ListC<Tc> extends ListB<Tc> {
|
||||
}
|
||||
@@ -180,6 +180,7 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testInaccessibleThroughWildcard() { doTest7Incompatibility(false);}
|
||||
public void testInconvertibleTypes() { doTest5(false); }
|
||||
public void testIncompatibleReturnType() { doTest5(false); }
|
||||
|
||||
public void testContinueInferenceAfterFirstRawResult() { doTest5(false); }
|
||||
public void testDoNotAcceptLowerBoundIfRaw() { doTest5(false); }
|
||||
public void testStaticOverride() { doTest5(false); }
|
||||
@@ -342,6 +343,7 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testIDEA71582() { doTest5(false); }
|
||||
public void testIDEA65377() { doTest5(false); }
|
||||
public void testIDEA113526() { doTest5(true); }
|
||||
public void testIncompatibleReturnTypeBounds() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
|
||||
public void testIDEA116493() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
|
||||
public void testIDEA117827() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
|
||||
public void testIDEA118037() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
|
||||
|
||||
Reference in New Issue
Block a user