diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java index 48e10ee31035..718c222a1be3 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java @@ -68,7 +68,7 @@ public class GenericsHighlightUtil { for (PsiClassType type : extendsTypes) { PsiType extendsType = substitutor.substitute(type); if (substituted instanceof PsiWildcardType) { - if (!((PsiWildcardType)substituted).isExtends()) { + if (((PsiWildcardType)substituted).isSuper()) { continue; } final PsiType extendsBound = ((PsiWildcardType)substituted).getExtendsBound(); diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/PsiResolveHelperImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/PsiResolveHelperImpl.java index a73436417d44..3f4eba1db48d 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/PsiResolveHelperImpl.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/PsiResolveHelperImpl.java @@ -902,8 +902,11 @@ public class PsiResolveHelperImpl implements PsiResolveHelper { PsiType substituted = argResult.getSubstitutor().substitute(typeParameter); if (substituted != null) { Pair res = getSubstitutionForTypeParameterInner( - superSubstitutor.substitute(typeParameter), substituted, patternType, ConstraintType.EQUALS, depth); - if (res != null) return res; + superSubstitutor.substitute(typeParameter), substituted, patternType, ConstraintType.EQUALS, depth + 1); + if (res != null) { + if (res == FAILED_INFERENCE) continue; + return res; + } } } } diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA110869.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA110869.java new file mode 100644 index 000000000000..488d6c70024c --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA110869.java @@ -0,0 +1,12 @@ +class A { +} + +abstract class B { + public T getA(Class aClass) { + return null; + } + + void foo(Class aClass) { + A a = getA(aClass); + } +} \ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA67744.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA67744.java index 42b62e9983ed..f0684d55d19e 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA67744.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA67744.java @@ -2,12 +2,15 @@ import java.util.List; abstract class B { abstract T[] foo(List> x); + abstract T foo0(List> x); abstract T[] foo1(List> x); abstract T[] foo2(List>> x); void bar(List> x, List>> y){ foo(x) [0] = ""; foo1(x) [0] = ""; - foo2(y) [0] = ""; + foo2(y) [0] = ""; + + String s = foo0(x); } } \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java index 268c9651a5ad..fb9c28436107 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java @@ -300,6 +300,7 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase { public void testIDEA67744() { doTest5(false); } public void testIDEA67682() { doTest5(false); } public void testIDEA57391() { doTest5(false); } + public void testIDEA110869() { doTest5(false); } public void testJavaUtilCollections_NoVerify() throws Exception { PsiClass collectionsClass = getJavaFacade().findClass("java.util.Collections", GlobalSearchScope.moduleWithLibrariesScope(getModule()));