diff --git a/java/java-impl/src/com/intellij/psi/impl/PsiSubstitutorImpl.java b/java/java-impl/src/com/intellij/psi/impl/PsiSubstitutorImpl.java index ac2afc346ab8..a71a149a14aa 100644 --- a/java/java-impl/src/com/intellij/psi/impl/PsiSubstitutorImpl.java +++ b/java/java-impl/src/com/intellij/psi/impl/PsiSubstitutorImpl.java @@ -298,7 +298,7 @@ public class PsiSubstitutorImpl implements PsiSubstitutor { PsiType substitutedBoundType = boundType.accept(mySimpleSubstitutionVisitor); PsiWildcardType wildcardType = (PsiWildcardType)substituted; if (substitutedBoundType != null && !(substitutedBoundType instanceof PsiWildcardType) && !substitutedBoundType.equalsToText("java.lang.Object")) { - if (originalBound == null || !TypeConversionUtil.erasure(substitutedBoundType).isAssignableFrom(originalBound)) { //erasure is essential to avoid infinite recursion + if (originalBound == null || !TypeConversionUtil.erasure(substitutedBoundType).isAssignableFrom(TypeConversionUtil.erasure(originalBound))) { //erasure is essential to avoid infinite recursion if (wildcardType.isExtends()) { final PsiType glb = GenericsUtil.getGreatestLowerBound(wildcardType.getBound(), substitutedBoundType); if (glb != null) { diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/SOE.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/SOE.java new file mode 100644 index 000000000000..a5f43e18be90 --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/SOE.java @@ -0,0 +1,24 @@ +public class SOE { +} +abstract class VersionEntity, R extends Ref> + implements Version{} + +interface Version, R extends Ref>{} + +abstract class RefEntity, R extends Ref> + implements Ref {} + +interface Ref, R extends Ref>{} + + +abstract class Node, + GR extends NodeRef> extends VersionEntity {} + +abstract class NodeRef, GR extends NodeRef> extends RefEntity {} + + +class D { + void f() { + Version v = new Node<?, ?>(){} + } +} \ 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 efabf585cf53..00fab84cb81c 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java @@ -81,6 +81,7 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase { public void testIDEADEV24166() throws Exception { doTest(true); } public void testIDEADEV25778() throws Exception { doTest(true); } public void testIDEADEV57343() throws Exception { doTest(false); } + public void testSOE() throws Exception { doTest(true); } public void testGenericExtendException() throws Exception { doTest(false); } public void testSameErasureDifferentReturnTypes() throws Exception { doTest(false); }