### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java,v retrieving revision 1.89 diff -u -r1.89 MethodBinding.java --- compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java 6 Mar 2007 02:38:51 -0000 1.89 +++ compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java 15 Mar 2007 11:02:47 -0000 @@ -93,6 +93,11 @@ return false; return true; } +/* + * Returns true if given parameters are compatible with this method parameters. + * Callers to this method should first check that the number of TypeBindings + * passed as argument matches this MethodBinding number of parameters + */ public final boolean areParametersCompatibleWith(TypeBinding[] arguments) { int paramLength = this.parameters.length; int argLength = arguments.length; Index: compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java,v retrieving revision 1.52 diff -u -r1.52 Javadoc.java --- compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java 13 Mar 2007 11:26:21 -0000 1.52 +++ compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java 15 Mar 2007 11:02:47 -0000 @@ -15,6 +15,7 @@ import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.lookup.*; import org.eclipse.jdt.internal.compiler.parser.JavadocTagConstants; +import org.eclipse.jdt.internal.core.util.Util; /** * Node representing a structured Javadoc comment @@ -284,7 +285,7 @@ if (allocationExpr.arguments == null && methDecl.arguments == null) { superRef = true; } - else if (allocationExpr.arguments != null && methDecl.arguments != null) { + else if (allocationExpr.arguments != null && methDecl.arguments != null && allocationExpr.arguments.length == methDecl.arguments.length) { superRef = methDecl.binding.areParametersCompatibleWith(allocationExpr.binding.parameters); } } @@ -292,8 +293,9 @@ } } } - catch (Exception e) { - // Something wrong happen, forget super ref... + catch (RuntimeException e) { + // Something wrong happen, forget super ref...and log information + Util.log(e, "Exception occured while trying to retrieve a super reference in Javadoc"); //$NON-NLS-1$ } } #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.34 diff -u -r1.34 JavadocBugsTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/JavadocBugsTest.java 13 Mar 2007 11:26:16 -0000 1.34 +++ src/org/eclipse/jdt/core/tests/compiler/regression/JavadocBugsTest.java 15 Mar 2007 11:02:49 -0000 @@ -5704,4 +5704,73 @@ runNegativeTest(units,error50); } } + + /** + * @bug 177009: [javadoc] Missing Javadoc tag not reported + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=177009" + */ + public void testBug177009a() { + String[] units = new String[] { + "pkg/X.java", + "package pkg;\n" + + "\n" + + "public class X {\n" + + " public X(String str, int anInt) {\n" + + " }\n" + + "}\n", + "pkg/Y.java", + "package pkg;\n" + + "\n" + + "public class Y extends X {\n" + + " private static int myInt = 0;\n" + + " /**\n" + + " * @see X#X(String, int)\n" + // case1 potential AIOOBE + " */\n" + + " public Y(String str) {\n" + + " super(str, myInt);\n" + + " }\n" + + "}\n" + }; + reportMissingJavadocTags = CompilerOptions.WARNING; + runNegativeTest(units, + "----------\n" + + "1. WARNING in pkg\\Y.java (at line 8)\n" + + " public Y(String str) {\n" + + " ^^^\n" + + "Javadoc: Missing tag for parameter str\n" + + "----------\n"); + } + + public void testBug177009b() { + String[] units = new String[] { + "pkg/X.java", + "package pkg;\n" + + "\n" + + "public class X {\n" + + " public X(String str, int anInt) {\n" + + " }\n" + + "}\n", + "pkg/Y.java", + "package pkg;\n" + + "\n" + + "public class Y extends X {\n" + + " /**\n" + + " * @param str\n" + + " * @param anInt\n" + + " * @see X#X(String, int)\n" + // case2 find super ref + " */\n" + + " public Y(String str, int anInt, int anotherInt) {\n" + + " super(str, anInt);\n" + + " }\n" + + "}\n" + }; + reportMissingJavadocTags = CompilerOptions.WARNING; + runNegativeTest(units, + "----------\n" + + "1. WARNING in pkg\\Y.java (at line 9)\n" + + " public Y(String str, int anInt, int anotherInt) {\n" + + " ^^^^^^^^^^\n" + + "Javadoc: Missing tag for parameter anotherInt\n" + + "----------\n"); + } }