### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core.tests.compiler Index: src/org/eclipse/jdt/core/tests/compiler/regression/JavadocBugsTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocBugsTest.java,v retrieving revision 1.31 diff -u -r1.31 JavadocBugsTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/JavadocBugsTest.java 21 Nov 2006 12:09:44 -0000 1.31 +++ src/org/eclipse/jdt/core/tests/compiler/regression/JavadocBugsTest.java 24 Nov 2006 18:55:26 -0000 @@ -5031,4 +5031,44 @@ ); } } + + /** + * @bug 165794: [javadoc] Should not report ambiguous on method with parameterized types as parameters + * @test Ensure that no warning are raised when ambiguous parameterized methods are present in javadoc comments + * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=165794" + */ + public void testBug165794() { + String[] testFiles = new String[] { + "X.java", + "/**\n" + + " * No reasonable hint for resolving the {@link #getMax(A)}.\n" + + " */\n" + + "public class X {\n" + + " /**\n" + + " * Extends Number method.\n" + + " * @see #getMax(A ipZ)\n" + + " */\n" + + " public T getMax(final A ipY) {\n" + + " return ipY.t();\n" + + " }\n" + + " \n" + + " /**\n" + + " * Extends Exception method.\n" + + " * @see #getMax(A ipY)\n" + + " */\n" + + " public T getMax(final A ipZ) {\n" + + " return ipZ.t();\n" + + " }\n" + + "}\n" + + "class A {\n" + + " T t() { return null; }\n" + + "}\n" + + "class Y {}\n" + + "class Z {}" + }; + if (complianceLevel.equals(COMPLIANCE_1_3) || complianceLevel.equals(COMPLIANCE_1_4)) { + return; + } + runConformTest(testFiles); + } } #P org.eclipse.jdt.core.tests.model Index: src/org/eclipse/jdt/core/tests/model/SelectionJavadocModelTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SelectionJavadocModelTests.java,v retrieving revision 1.8 diff -u -r1.8 SelectionJavadocModelTests.java --- src/org/eclipse/jdt/core/tests/model/SelectionJavadocModelTests.java 14 Jun 2006 10:53:55 -0000 1.8 +++ src/org/eclipse/jdt/core/tests/model/SelectionJavadocModelTests.java 24 Nov 2006 18:55:27 -0000 @@ -919,4 +919,70 @@ elements ); } + + /** + * @bug 165701: [model] No hint for ambiguous javadoc + * @test Ensure that no exception is thrown while selecting method in javadoc comment + * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=165701" + */ + public void testBug165701() throws JavaModelException { + setUnit("b165701/Test.java", + "package b165701;\n" + + "/**\n" + + " * @see #fooo(int)\n" + + " */\n" + + "public class Test {\n" + + " public void foo() {}\n" + + "}\n" + ); + int[] selectionPositions = selectionInfo(workingCopies[0], "fooo", 1); + IJavaElement[] elements = workingCopies[0].codeSelect(selectionPositions[0], 0); + assertElementsEqual("Invalid selection(s)", + "Test [in [Working copy] Test.java [in b165701 [in [in Tests]]]]", + elements + ); + } + + /** + * @bug 165794: [model] No hint for ambiguous javadoc + * @test Ensure that no exception is thrown while selecting method in javadoc comment + * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=165794" + */ + public void testBug165794() throws JavaModelException { + setUnit("b165794/Test.java", + "package b165794;\n" + + "/**\n" + + " * No reasonable hint for resolving the {@link #getMax(A)}.\n" + + " */\n" + + "public class X {\n" + + " /**\n" + + " * Extends Number method.\n" + + " * @see #getMax(A ipZ)\n" + + " */\n" + + " public T getMax(final A ipY) {\n" + + " return ipY.t();\n" + + " }\n" + + " \n" + + " /**\n" + + " * Extends Exception method.\n" + + " * @see #getMax(A ipY)\n" + + " */\n" + + " public T getMax(final A ipZ) {\n" + + " return ipZ.t();\n" + + " }\n" + + "}\n" + + "class A {\n" + + " T t() { return null; }\n" + + "}\n" + + "class Y {}\n" + + "class Z {}" + ); + int[] selectionPositions = selectionInfo(workingCopies[0], "getMax", 1); + IJavaElement[] elements = workingCopies[0].codeSelect(selectionPositions[0], 0); + assertElementsEqual("Invalid selection(s)", + "getMax(A) [in X [in [Working copy] Test.java [in b165794 [in [in Tests]]]]]\n" + + "getMax(A) [in X [in [Working copy] Test.java [in b165794 [in [in Tests]]]]]", + elements + ); + } } #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/internal/compiler/ast/JavadocMessageSend.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocMessageSend.java,v retrieving revision 1.29 diff -u -r1.29 JavadocMessageSend.java --- compiler/org/eclipse/jdt/internal/compiler/ast/JavadocMessageSend.java 10 Nov 2006 17:40:01 -0000 1.29 +++ compiler/org/eclipse/jdt/internal/compiler/ast/JavadocMessageSend.java 24 Nov 2006 18:55:28 -0000 @@ -135,9 +135,11 @@ return null; } } - scope.problemReporter().javadocInvalidMethod(this, this.binding, scope.getDeclarationModifiers()); + if (this.binding.problemId() != ProblemReasons.Ambiguous) { + scope.problemReporter().javadocInvalidMethod(this, this.binding, scope.getDeclarationModifiers()); + } // record the closest match, for clients who may still need hint about possible method match - if (this.binding instanceof ProblemMethodBinding){ + if (this.binding instanceof ProblemMethodBinding) { MethodBinding closestMatch = ((ProblemMethodBinding)this.binding).closestMatch; if (closestMatch != null) this.binding = closestMatch; } Index: compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java,v retrieving revision 1.292 diff -u -r1.292 Scope.java --- compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 23 Nov 2006 17:27:18 -0000 1.292 +++ compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 24 Nov 2006 18:55:29 -0000 @@ -3388,7 +3388,8 @@ } // if all moreSpecific methods are equal then see if duplicates exist because of substitution - return new ProblemMethodBinding(visible[0].selector, visible[0].parameters, ProblemReasons.Ambiguous); + return new ProblemMethodBinding(visible[0], visible[0].selector, visible[0].parameters, ProblemReasons.Ambiguous); + } public final ClassScope outerMostClassScope() {