Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 54908 Details for
Bug 166365
[javadoc] severity level of malformed javadoc comments did not work properly
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
v00.txt (text/plain), 14.43 KB, created by
Frederic Fusier
on 2006-12-01 13:06:53 EST
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Frederic Fusier
Created:
2006-12-01 13:06:53 EST
Size:
14.43 KB
patch
obsolete
>### 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.32 >diff -u -r1.32 JavadocBugsTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/JavadocBugsTest.java 25 Nov 2006 19:49:48 -0000 1.32 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/JavadocBugsTest.java 1 Dec 2006 18:02:26 -0000 >@@ -73,6 +73,7 @@ > options.put(CompilerOptions.OPTION_ReportDeprecation, reportDeprecation); > options.put(CompilerOptions.OPTION_ReportUnusedImport, CompilerOptions.ERROR); > options.put(CompilerOptions.OPTION_ReportRawTypeReference, CompilerOptions.IGNORE); >+ options.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.IGNORE); > return options; > } > /* (non-Javadoc) >@@ -4811,67 +4812,6 @@ > } > > /** >- * @bug 160015: [1.5][javadoc] Missing warning on autoboxing compatible methods >- * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=160015" >- */ >- public void testBug160015() { >- runNegativeTest(new String[] { >- "Test.java", >- "/**\n" + >- " * @see #method(Long) Warning!\n" + >- " */\n" + >- "public class Test {\n" + >- " public void method(long l) {}\n" + >- " /**\n" + >- " * @see #method(Long) Warning!\n" + >- " */\n" + >- " void bar() {}\n" + >- "}\n" >- }, >- "----------\n" + >- "1. ERROR in Test.java (at line 2)\n" + >- " * @see #method(Long) Warning!\n" + >- " ^^^^^^\n" + >- "Javadoc: The method method(long) in the type Test is not applicable for the arguments (Long)\n" + >- "----------\n" + >- "2. ERROR in Test.java (at line 7)\n" + >- " * @see #method(Long) Warning!\n" + >- " ^^^^^^\n" + >- "Javadoc: The method method(long) in the type Test is not applicable for the arguments (Long)\n" + >- "----------\n" >- ); >- } >- >- /** >- * @bug 163659: [javadoc] Compiler should warn when method parameters are not identical >- * @test Ensure that a warning is raised when method parameter types are not identical >- * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=163659" >- */ >- public void testBug163659() { >- runNegativeTest( >- new String[] { >- "Test.java", >- "/**\n" + >- " * @see #foo(MyInterface)\n" + >- " * @see #foo(MySubInterface)\n" + >- " */\n" + >- "public class Test {\n" + >- " public void foo(MyInterface mi) {\n" + >- " }\n" + >- "}\n" + >- "interface MyInterface {}\n" + >- "interface MySubInterface extends MyInterface {} \n" >- }, >- "----------\n" + >- "1. ERROR in Test.java (at line 3)\n" + >- " * @see #foo(MySubInterface)\n" + >- " ^^^\n" + >- "Javadoc: The method foo(MyInterface) in the type Test is not applicable for the arguments (MySubInterface)\n" + >- "----------\n" >- ); >- } >- >- /** > * @bug 153399: [javadoc] JDT Core should warn if the @value tag is not used correctly > * @test Ensure that 'value' tag is well warned when not used correctly > * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=153399" >@@ -4981,12 +4921,12 @@ > "1. ERROR in X.java (at line 3)\n" + > " * {@value #MY_VALUE}\n" + > " ^^^^^\n" + >- "Javadoc: Unexpected duplicated tag @value\n" + >+ "Javadoc: Unexpected tag\n" + > "----------\n" + > "2. ERROR in X.java (at line 4)\n" + > " * {@value}\n" + > " ^^^^^\n" + >- "Javadoc: Unexpected duplicated tag @value\n" + >+ "Javadoc: Unexpected tag\n" + > "----------\n" > ); > } else { >@@ -5017,7 +4957,7 @@ > "1. ERROR in X.java (at line 3)\n" + > " * {@value Invalid}\n" + > " ^^^^^\n" + >- "Javadoc: Unexpected duplicated tag @value\n" + >+ "Javadoc: Unexpected tag\n" + > "----------\n" > ); > } else { >@@ -5033,6 +4973,67 @@ > } > > /** >+ * @bug 160015: [1.5][javadoc] Missing warning on autoboxing compatible methods >+ * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=160015" >+ */ >+ public void testBug160015() { >+ runNegativeTest(new String[] { >+ "Test.java", >+ "/**\n" + >+ " * @see #method(Long) Warning!\n" + >+ " */\n" + >+ "public class Test {\n" + >+ " public void method(long l) {}\n" + >+ " /**\n" + >+ " * @see #method(Long) Warning!\n" + >+ " */\n" + >+ " void bar() {}\n" + >+ "}\n" >+ }, >+ "----------\n" + >+ "1. ERROR in Test.java (at line 2)\n" + >+ " * @see #method(Long) Warning!\n" + >+ " ^^^^^^\n" + >+ "Javadoc: The method method(long) in the type Test is not applicable for the arguments (Long)\n" + >+ "----------\n" + >+ "2. ERROR in Test.java (at line 7)\n" + >+ " * @see #method(Long) Warning!\n" + >+ " ^^^^^^\n" + >+ "Javadoc: The method method(long) in the type Test is not applicable for the arguments (Long)\n" + >+ "----------\n" >+ ); >+ } >+ >+ /** >+ * @bug 163659: [javadoc] Compiler should warn when method parameters are not identical >+ * @test Ensure that a warning is raised when method parameter types are not identical >+ * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=163659" >+ */ >+ public void testBug163659() { >+ runNegativeTest( >+ new String[] { >+ "Test.java", >+ "/**\n" + >+ " * @see #foo(MyInterface)\n" + >+ " * @see #foo(MySubInterface)\n" + >+ " */\n" + >+ "public class Test {\n" + >+ " public void foo(MyInterface mi) {\n" + >+ " }\n" + >+ "}\n" + >+ "interface MyInterface {}\n" + >+ "interface MySubInterface extends MyInterface {} \n" >+ }, >+ "----------\n" + >+ "1. ERROR in Test.java (at line 3)\n" + >+ " * @see #foo(MySubInterface)\n" + >+ " ^^^\n" + >+ "Javadoc: The method foo(MyInterface) in the type Test is not applicable for the arguments (MySubInterface)\n" + >+ "----------\n" >+ ); >+ } >+ >+ /** > * @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" >@@ -5071,4 +5072,123 @@ > } > runConformTest(testFiles); > } >+ >+ /** >+ * @bug 166365: [javadoc] severity level of malformed javadoc comments did not work properly >+ * @test Ensure that no warning is raised when visibility is lower than the javadoc option one >+ * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=166365" >+ */ >+ public void testBug166365() { >+ String[] testFiles = new String[] { >+ "X.java", >+ "public class X {\n" + >+ " /**\n" + >+ " * @return\n" + >+ " */\n" + >+ " private String getSomePrivate() {\n" + >+ " return \"SomePrivate\";\n" + >+ " }\n" + >+ " /**\n" + >+ " * @return\n" + >+ " */\n" + >+ " protected String getSomeProtected() {\n" + >+ " return \"SomeProtected\";\n" + >+ " }\n" + >+ " /**\n" + >+ " * @return\n" + >+ " */\n" + >+ " String getSomeDefault() {\n" + >+ " return \"SomeDefault\";\n" + >+ " }\n" + >+ " /**\n" + >+ " * @return\n" + >+ " */\n" + >+ " public String getSomePublic() {\n" + >+ " return \"SomePublic\";\n" + >+ " }\n" + >+ "}\n" >+ }; >+ this.reportInvalidJavadocVisibility = CompilerOptions.PUBLIC; >+ runNegativeTest(testFiles, >+ "----------\n" + >+ "1. ERROR in X.java (at line 21)\n" + >+ " * @return\n" + >+ " ^^^^^^\n" + >+ "Javadoc: Missing return type description\n" + >+ "----------\n" >+ ); >+ } >+ >+ /** >+ * @bug 166436: [javadoc] Potentially wrong javadoc warning for unexpected duplicate tag value >+ * @test Ensure that no duplicate warning is raised for value tag >+ * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=166436" >+ */ >+ public void testBug166436() { >+ String[] testFiles = new String[] { >+ "X.java", >+ "public class X {\n" + >+ " public static final String PUBLIC_CONST = \"public\";\n" + >+ " protected static final String PROTECTED_CONST = \"protected\";\n" + >+ " static final String DEFAULT_CONST = \"default\"; \n" + >+ " private static final String PRIVATE_CONST = \"private\"; \n" + >+ " /**\n" + >+ " * Values:\n" + >+ " * <ul>\n" + >+ " * <li>{@value #PUBLIC_CONST}</li>\n" + >+ " * <li>{@value #PROTECTED_CONST}</li>\n" + >+ " * <li>{@value #DEFAULT_CONST}</li>\n" + >+ " * <li>{@value #PRIVATE_CONST}</li>\n" + >+ " * </ul>\n" + >+ " */\n" + >+ " public X() {\n" + >+ " }\n" + >+ "}\n" >+ }; >+ this.reportInvalidJavadocVisibility = CompilerOptions.PUBLIC; >+ if (complianceLevel.equals(COMPLIANCE_1_3) || complianceLevel.equals(COMPLIANCE_1_4)) { >+ runNegativeTest(testFiles, >+ "----------\n" + >+ "1. ERROR in X.java (at line 9)\n" + >+ " * <li>{@value #PUBLIC_CONST}</li>\n" + >+ " ^^^^^\n" + >+ "Javadoc: Unexpected tag\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 10)\n" + >+ " * <li>{@value #PROTECTED_CONST}</li>\n" + >+ " ^^^^^\n" + >+ "Javadoc: Unexpected tag\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 11)\n" + >+ " * <li>{@value #DEFAULT_CONST}</li>\n" + >+ " ^^^^^\n" + >+ "Javadoc: Unexpected tag\n" + >+ "----------\n" + >+ "4. ERROR in X.java (at line 12)\n" + >+ " * <li>{@value #PRIVATE_CONST}</li>\n" + >+ " ^^^^^\n" + >+ "Javadoc: Unexpected tag\n" + >+ "----------\n" >+ ); >+ } else { >+ runNegativeTest(testFiles, >+ "----------\n" + >+ "1. ERROR in X.java (at line 10)\n" + >+ " * <li>{@value #PROTECTED_CONST}</li>\n" + >+ " ^^^^^^^^^^^^^^^^\n" + >+ "Javadoc: \'public\' visibility for malformed doc comments hides this \'protected\' reference\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 11)\n" + >+ " * <li>{@value #DEFAULT_CONST}</li>\n" + >+ " ^^^^^^^^^^^^^^\n" + >+ "Javadoc: \'public\' visibility for malformed doc comments hides this \'default\' reference\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 12)\n" + >+ " * <li>{@value #PRIVATE_CONST}</li>\n" + >+ " ^^^^^^^^^^^^^^\n" + >+ "Javadoc: \'public\' visibility for malformed doc comments hides this \'private\' reference\n" + >+ "----------\n" >+ ); >+ } >+ } > } >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/ast/JavadocReturnStatement.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocReturnStatement.java,v >retrieving revision 1.12 >diff -u -r1.12 JavadocReturnStatement.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/JavadocReturnStatement.java 13 Oct 2006 19:20:46 -0000 1.12 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/JavadocReturnStatement.java 1 Dec 2006 18:02:32 -0000 >@@ -37,7 +37,7 @@ > if (methodType == null || methodType == TypeBinding.VOID) { > scope.problemReporter().javadocUnexpectedTag(this.sourceStart, this.sourceEnd); > } else if (this.empty) { >- scope.problemReporter().javadocEmptyReturnTag(this.sourceStart, this.sourceEnd); >+ scope.problemReporter().javadocEmptyReturnTag(this.sourceStart, this.sourceEnd, scope.getDeclarationModifiers()); > } > } > >Index: compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java,v >retrieving revision 1.333 >diff -u -r1.333 ProblemReporter.java >--- compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 28 Nov 2006 03:54:19 -0000 1.333 >+++ compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 1 Dec 2006 18:02:36 -0000 >@@ -1044,6 +1044,7 @@ > case IProblem.JavadocIncorrectArityForParameterizedConstructor: > case IProblem.JavadocParameterizedConstructorArgumentTypeMismatch: > case IProblem.JavadocTypeArgumentsForRawGenericConstructor: >+ case IProblem.JavadocEmptyReturnTag: > if (!this.options.reportInvalidJavadocTags) { > return ProblemSeverities.Ignore; > } >@@ -3649,8 +3650,12 @@ > typeReference.sourceEnd); > } > } >-public void javadocEmptyReturnTag(int sourceStart, int sourceEnd) { >- this.handle(IProblem.JavadocEmptyReturnTag, NoArgument, NoArgument, sourceStart, sourceEnd); >+public void javadocEmptyReturnTag(int sourceStart, int sourceEnd, int modifiers) { >+ int severity = computeSeverity(IProblem.JavadocEmptyReturnTag); >+ if (severity == ProblemSeverities.Ignore) return; >+ if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) { >+ this.handle(IProblem.JavadocEmptyReturnTag, NoArgument, NoArgument, sourceStart, sourceEnd); >+ } > } > public void javadocErrorNoMethodFor(MessageSend messageSend, TypeBinding recType, TypeBinding[] params, int modifiers) { > int id = recType.isArrayType() ? IProblem.JavadocNoMessageSendOnArrayType : IProblem.JavadocNoMessageSendOnBaseType; >Index: compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java,v >retrieving revision 1.175 >diff -u -r1.175 CompilerOptions.java >--- compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java 24 Nov 2006 01:32:07 -0000 1.175 >+++ compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java 1 Dec 2006 18:02:32 -0000 >@@ -20,6 +20,7 @@ > import org.eclipse.jdt.internal.compiler.Compiler; > import org.eclipse.jdt.internal.compiler.ast.ASTNode; > import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; >+import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers; > import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities; > import org.eclipse.jdt.internal.compiler.util.Util; > >@@ -434,7 +435,7 @@ > } > > public String getVisibilityString(int level) { >- switch (level) { >+ switch (level & ExtraCompilerModifiers.AccVisibilityMASK) { > case ClassFileConstants.AccPublic: > return PUBLIC; > case ClassFileConstants.AccProtected:
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 166365
:
54797
| 54908