From 60bdcacc7072db9b2946d673b13155886e6e6c22 Mon Sep 17 00:00:00 2001 From: anna Date: Tue, 24 Aug 2010 17:32:35 +0400 Subject: [PATCH] check whether wildcard bound or not (IDEA-57343) --- .../psi/impl/source/resolve/PsiResolveHelperImpl.java | 2 +- .../genericsHighlighting/IDEADEV57343.java | 6 ++++++ .../codeInsight/daemon/GenericsHighlightingTest.java | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEADEV57343.java diff --git a/java/java-impl/src/com/intellij/psi/impl/source/resolve/PsiResolveHelperImpl.java b/java/java-impl/src/com/intellij/psi/impl/source/resolve/PsiResolveHelperImpl.java index 173ac1533da0..300a9472a3cb 100644 --- a/java/java-impl/src/com/intellij/psi/impl/source/resolve/PsiResolveHelperImpl.java +++ b/java/java-impl/src/com/intellij/psi/impl/source/resolve/PsiResolveHelperImpl.java @@ -502,7 +502,7 @@ public class PsiResolveHelperImpl implements PsiResolveHelper { if (paramBound == null) return null; ConstraintType constrType = wildcardParam.isExtends() ? ConstraintType.SUPERTYPE : ConstraintType.SUBTYPE; if (arg instanceof PsiWildcardType) { - if (((PsiWildcardType)arg).isExtends() == wildcardParam.isExtends()) { + if (((PsiWildcardType)arg).isExtends() == wildcardParam.isExtends() && ((PsiWildcardType)arg).isBounded() == wildcardParam.isBounded()) { Pair res = getSubstitutionForTypeParameterInner(paramBound, ((PsiWildcardType)arg).getBound(), patternType, constrType, depth); if (res != null) return res; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEADEV57343.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEADEV57343.java new file mode 100644 index 000000000000..63ecda1fd9e2 --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEADEV57343.java @@ -0,0 +1,6 @@ +class D { + void foo(D x){ + bar(x,x); + } + void bar(D x, D y){} +} \ 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 797df150a2e5..2b091ef594a1 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java @@ -85,6 +85,8 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase { public void testIDEADEV23157() throws Exception { doTest(true); } public void testIDEADEV24166() throws Exception { doTest(true); } public void testIDEADEV25778() throws Exception { doTest(true); } + public void testIDEADEV57343() throws Exception { doTest(false); } + public void testGenericExtendException() throws Exception { doTest(false); } public void testSameErasureDifferentReturnTypes() throws Exception { doTest(false); } public void testDeepConflictingReturnTypes() throws Exception { doTest(false); }