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 101465 Details for
Bug 233187
[javadoc] partially qualified inner types should be warned
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
[proposed patch + test case] on top v_866
v02.txt (text/plain), 7.78 KB, created by
Eric Jodet
on 2008-05-22 06:57:19 EDT
(
hide
)
Description:
[proposed patch + test case] on top v_866
Filename:
MIME Type:
Creator:
Eric Jodet
Created:
2008-05-22 06:57:19 EDT
Size:
7.78 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.42 >diff -u -r1.42 JavadocBugsTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/JavadocBugsTest.java 7 May 2008 17:55:04 -0000 1.42 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/JavadocBugsTest.java 22 May 2008 10:14:28 -0000 >@@ -7247,4 +7247,121 @@ > reportMissingJavadocDescription = CompilerOptions.ALL_STANDARD_TAGS; > runConformTest(units); > } >+ >+ /** >+ * @bug 233187: [javadoc] partially qualified inner types should be warned >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=233187" >+ */ >+ public void testBug233187a() { >+ String[] units = new String[] { >+ "X.java", >+ "package test.bug;\n" + >+ "\n" + >+ "public class X {\n" + >+ " public static class Y {\n" + >+ " public static class Z { \n" + >+ " /**\n" + >+ " * The position in the new method signature depends on\n" + >+ " * the position in the array passed to\n" + >+ " * {@link X.Y#foo(test.bug.X.Y.Z[])} OK for javadoc tool\n" + >+ " * {@link X.Y#foo(test.bug.X.Y.Z)} KO for javadoc tool\n" + >+ " * {@link X.Y#foo(no_test.bug.X.Y.Z[])} KO for javadoc tool\n" + >+ " * {@link X.Y#foo(Y.Z[])} KO for javadoc tool\n" + >+ " * {@link test.bug.X.Y#foo(Y.Z[])} KO for javadoc tool\n" + >+ " */\n" + >+ " public int bar() {\n" + >+ " return 0;\n" + >+ " }\n" + >+ " }\n" + >+ "\n" + >+ " public void foo(Z[] params) {\n" + >+ " }\n" + >+ " }\n" + >+ "}\n" >+ }; >+ this.reportInvalidJavadocVisibility = CompilerOptions.PUBLIC; >+ runNegativeTest(units, >+ // warning - Tag @link: can't find foo(test.bug.X.Y.Z) in test.bug.X.Y >+ // warning - Tag @link: can't find foo(no_test.bug.X.Y.Z[]) in test.bug.X.Y >+ // warning - Tag @link: can't find foo(Y.Z[]) in test.bug.X.Y >+ // warning - Tag @link: can't find foo(Y.Z[]) in test.bug.X.Y >+ "----------\n" + >+ "1. ERROR in X.java (at line 10)\n" + >+ " * {@link X.Y#foo(test.bug.X.Y.Z)} KO for javadoc tool\n" + >+ " ^^^\n" + >+ "Javadoc: The method foo(X.Y.Z[]) in the type X.Y is not applicable for the arguments (X.Y.Z)\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 11)\n" + >+ " * {@link X.Y#foo(no_test.bug.X.Y.Z[])} KO for javadoc tool\n" + >+ " ^^^^^^^^^^^^^^^^^\n" + >+ "Javadoc: no_test[] cannot be resolved to a type\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 12)\n" + >+ " * {@link X.Y#foo(Y.Z[])} KO for javadoc tool\n" + >+ " ^^^\n" + >+ "Javadoc: Invalid member type qualification\n" + >+ "----------\n" + >+ "4. ERROR in X.java (at line 13)\n" + >+ " * {@link test.bug.X.Y#foo(Y.Z[])} KO for javadoc tool\n" + >+ " ^^^\n" + >+ "Javadoc: Invalid member type qualification\n" + >+ "----------\n" >+ ); >+ } >+ public void testBug233187b() { >+ String[] units = new String[] { >+ "X.java", >+ "package test.bug;\n" + >+ "\n" + >+ "public class X {\n" + >+ " public static class Y {\n" + >+ " public static class Z { \n" + >+ " /**\n" + >+ " * The position in the new method signature depends on\n" + >+ " * the position in the array passed to\n" + >+ " * {@link X.Y#foo(test.bug.X.Y.Z)} OK for javadoc tool\n" + >+ " * {@link X.Y#foo(test.bug.X.Y.Z[])} KO for javadoc tool\n" + >+ " * {@link X.Y#foo(no_test.bug.X.Y.Z)} KO for javadoc tool\n" + >+ " * {@link X.Y#foo(Y.Z)} KO for javadoc tool\n" + >+ " * {@link test.bug.X.Y#foo(Y.Z)} KO for javadoc tool\n" + >+ " */\n" + >+ " public int bar() {\n" + >+ " return 0;\n" + >+ " }\n" + >+ " }\n" + >+ "\n" + >+ " public void foo(Z params) {\n" + >+ " }\n" + >+ " }\n" + >+ "}\n" >+ }; >+ this.reportInvalidJavadocVisibility = CompilerOptions.PUBLIC; >+ runNegativeTest(units, >+ // warning - Tag @link: can't find foo(test.bug.X.Y.Z[]) in test.bug.X.Y >+ // warning - Tag @link: can't find foo(no_test.bug.X.Y.Z) in test.bug.X.Y >+ // warning - Tag @link: can't find foo(Y.Z) in test.bug.X.Y >+ // warning - Tag @link: can't find foo(Y.Z) in test.bug.X.Y >+ "----------\n" + >+ "1. ERROR in X.java (at line 10)\n" + >+ " * {@link X.Y#foo(test.bug.X.Y.Z[])} KO for javadoc tool\n" + >+ " ^^^\n" + >+ "Javadoc: The method foo(X.Y.Z) in the type X.Y is not applicable for the arguments (X.Y.Z[])\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 11)\n" + >+ " * {@link X.Y#foo(no_test.bug.X.Y.Z)} KO for javadoc tool\n" + >+ " ^^^^^^^^^^^^^^^^^\n" + >+ "Javadoc: no_test cannot be resolved to a type\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 12)\n" + >+ " * {@link X.Y#foo(Y.Z)} KO for javadoc tool\n" + >+ " ^^^\n" + >+ "Javadoc: Invalid member type qualification\n" + >+ "----------\n" + >+ "4. ERROR in X.java (at line 13)\n" + >+ " * {@link test.bug.X.Y#foo(Y.Z)} KO for javadoc tool\n" + >+ " ^^^\n" + >+ "Javadoc: Invalid member type qualification\n" + >+ "----------\n" >+ ); >+ } > } >\ No newline at end of file >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/ast/JavadocArgumentExpression.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocArgumentExpression.java,v >retrieving revision 1.23 >diff -u -r1.23 JavadocArgumentExpression.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/JavadocArgumentExpression.java 21 May 2008 12:53:48 -0000 1.23 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/JavadocArgumentExpression.java 22 May 2008 10:14:29 -0000 >@@ -49,6 +49,22 @@ > scope.problemReporter().javadocInvalidMemberTypeQualification(this.sourceStart, this.sourceEnd, scope.getDeclarationModifiers()); > // https://bugs.eclipse.org/bugs/show_bug.cgi?id=228648 > // do not return now but report unresolved reference as expected depending on compliance settings >+ } else if (typeRef instanceof QualifiedTypeReference && this.resolvedType != null && this.resolvedType.leafComponentType().enclosingType() != null) { >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=233187 >+ // inner type references should be fully qualified: >+ // as invalid type warning will be warned later, we just need to >+ // verify that the reference is fully qualified by comparing compare name lengths >+ >+ // calculate expected name length >+ int expectedLength = 1; >+ TypeBinding current = this.resolvedType.leafComponentType(); >+ while ((current = current.enclosingType()) != null) expectedLength++; >+ // add package length >+ expectedLength+=this.resolvedType.getPackage().compoundName.length; >+ // compare lengths >+ if (typeRef.getTypeName().length != expectedLength) { >+ scope.problemReporter().javadocInvalidMemberTypeQualification(typeRef.sourceStart, typeRef.sourceEnd, scope.getDeclarationModifiers()); >+ } > } > if (!this.resolvedType.isValidBinding()) { > scope.problemReporter().javadocInvalidType(typeRef, this.resolvedType, scope.getDeclarationModifiers());
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 233187
:
101465
|
112322