From 4e3928010ba25ed1f9b6adff0b4d33a97532e799 Mon Sep 17 00:00:00 2001 From: anna Date: Tue, 30 Apr 2013 16:11:47 +0200 Subject: [PATCH] generics: choose least bound symmetric (IDEA-57500) --- .../src/com/intellij/psi/GenericsUtil.java | 2 +- .../pck/AmbiguousMethodCall.java | 14 ++++++++++++++ .../daemon/AdvHighlightingJdk7Test.java | 4 ++++ 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA57500/pck/AmbiguousMethodCall.java diff --git a/java/java-psi-api/src/com/intellij/psi/GenericsUtil.java b/java/java-psi-api/src/com/intellij/psi/GenericsUtil.java index 1f91685ec32b..8a6bb464e63d 100644 --- a/java/java-psi-api/src/com/intellij/psi/GenericsUtil.java +++ b/java/java-psi-api/src/com/intellij/psi/GenericsUtil.java @@ -150,7 +150,7 @@ public class GenericsUtil { if (type2 instanceof PsiWildcardType) { PsiWildcardType wild2 = (PsiWildcardType)type2; final PsiType bound2 = wild2.getBound(); - if (bound2 == null) return wild1; + if (bound2 == null) return type2; if (wild1.isExtends() == wild2.isExtends()) { return wild1.isExtends() ? PsiWildcardType.createExtends(manager, getLeastUpperBound(bound1, bound2, compared, manager)) : diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA57500/pck/AmbiguousMethodCall.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA57500/pck/AmbiguousMethodCall.java new file mode 100644 index 000000000000..c252485568d3 --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA57500/pck/AmbiguousMethodCall.java @@ -0,0 +1,14 @@ +package pck; + +interface I {} +interface A extends I>{} +interface B extends I>{} + +abstract class X { + abstract T foo(T x, T y); + + void bar(A x, B y){ + foo(x, y); + foo(y, y); + } +} \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/AdvHighlightingJdk7Test.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/AdvHighlightingJdk7Test.java index 85f4fcaa4697..25bb907dbddd 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/AdvHighlightingJdk7Test.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/AdvHighlightingJdk7Test.java @@ -192,6 +192,10 @@ public class AdvHighlightingJdk7Test extends DaemonAnalyzerTestCase { doTestAmbiguous(); } + public void testAmbiguousIDEA57500() throws Exception { + doTestAmbiguous(); + } + public void testAmbiguousMethodsFromSameClassAccess() throws Exception { doTestAmbiguous(); }