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 103733 Details for
Bug 211054
[javadoc] @see package reference should raise a warning except for the package declaration
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
[proposed patch + test cases] on top v_872
v01.txt (text/plain), 7.80 KB, created by
Eric Jodet
on 2008-06-05 09:46:46 EDT
(
hide
)
Description:
[proposed patch + test cases] on top v_872
Filename:
MIME Type:
Creator:
Eric Jodet
Created:
2008-06-05 09:46:46 EDT
Size:
7.80 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.44 >diff -u -r1.44 JavadocBugsTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/JavadocBugsTest.java 27 May 2008 23:54:01 -0000 1.44 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/JavadocBugsTest.java 5 Jun 2008 13:35:22 -0000 >@@ -1247,19 +1247,34 @@ > /** > * Bug 50695. > * @see <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50695">50695</a> >+ * Since bug 211054 was fixed, expect warning to be raised when referencing packages others >+ * than the current one. >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=211054" > */ > public void testBug50695() { >- runConformTest( >+ runNegativeTest( > new String[] { > "X.java", > "public class X {\n" + >- " /**\n" + >- " * @see java\n" + >- " * @see java.util\n" + >- " */\n" + >- " void foo() {}\n" + >- "}\n" >- }); >+ " /**\n" + >+ " * @see java\n" + >+ " * @see java.util\n" + >+ " */\n" + >+ " void foo() {}\n" + >+ "}\n" >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 3)\n" + >+ " * @see java\n" + >+ " ^^^^\n" + >+ "Javadoc: Invalid reference\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 4)\n" + >+ " * @see java.util\n" + >+ " ^^^^^^^^^\n" + >+ "Javadoc: Invalid reference\n" + >+ "----------\n" >+ ); > } > public void testBug50695b() { > runNegativeTest( >@@ -1272,7 +1287,7 @@ > " void foo() {}\n" + > "}\n" > }, >- "----------\n" + >+ "----------\n" + > "1. ERROR in X.java (at line 3)\n" + > " * @see java.unknown\n" + > " ^^^^^^^^^^^^\n" + >@@ -7284,4 +7299,115 @@ > expectedError > ); > } >+ >+ /** >+ * @bug 211054: [javadoc] @see package reference should raise a warning except for the package declaration >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=211054" >+ */ >+ public void testBug211054a() { >+ String[] units = new String[] { >+ "pkg/X.java", >+ "package pkg;\n" + >+ "\n" + >+ "public class X {\n" + >+ " /**\n" + >+ " * @see java\n" + >+ " * @see java.lang\n" + >+ " * @see PKG\n" + >+ " * @see pkg\n" + >+ " */\n" + >+ " public void foo() { \n" + >+ " \n" + >+ " }\n" + >+ "}\n" >+ }; >+ reportInvalidJavadoc = CompilerOptions.WARNING; >+ runNegativeTest(units, >+ // warning - Tag @see: reference not found: java >+ // warning - Tag @see: reference not found: java.lang >+ // warning - Tag @see: reference not found: PKG >+ "----------\n" + >+ "1. WARNING in pkg\\X.java (at line 5)\n" + >+ " * @see java\n" + >+ " ^^^^\n" + >+ "Javadoc: Invalid reference\n" + >+ "----------\n" + >+ "2. WARNING in pkg\\X.java (at line 6)\n" + >+ " * @see java.lang\n" + >+ " ^^^^^^^^^\n" + >+ "Javadoc: Invalid reference\n" + >+ "----------\n" + >+ "3. WARNING in pkg\\X.java (at line 7)\n" + >+ " * @see PKG\n" + >+ " ^^^\n" + >+ "Javadoc: PKG cannot be resolved to a type\n" + >+ "----------\n"); >+ } >+ public void testBug211054b() { >+ String[] units = new String[] { >+ "pkg/X.java", >+ "package pkg;\n" + >+ "\n" + >+ "public class X {\n" + >+ " /**\n" + >+ " * @see java\n" + >+ " * @see java.lang\n" + >+ " * @see PKG\n" + >+ " * @see pkg\n" + >+ " */\n" + >+ " protected void foo() { \n" + >+ " \n" + >+ " }\n" + >+ "}\n" >+ }; >+ reportInvalidJavadoc = CompilerOptions.WARNING; >+ this.reportInvalidJavadocVisibility = CompilerOptions.PUBLIC; >+ runConformTest(units); >+ } >+ public void testBug211054c() { >+ String[] units = new String[] { >+ "x.y.z/X.java", >+ "package x.y.z;\n" + >+ "\n" + >+ "public class X {\n" + >+ " /**\n" + >+ " * @see java\n" + >+ " * @see java.lang\n" + >+ " * @see x\n" + >+ " * @see x.y\n" + >+ " * @see x.y.z\n" + >+ " */\n" + >+ " public void foo() { \n" + >+ " \n" + >+ " }\n" + >+ "}\n" >+ }; >+ reportInvalidJavadoc = CompilerOptions.WARNING; >+ runNegativeTest(units, >+ // warning - Tag @see: reference not found: java >+ // warning - Tag @see: reference not found: java.lang >+ // warning - Tag @see: reference not found: x >+ // warning - Tag @see: reference not found: x.y >+ "----------\n" + >+ "1. WARNING in x.y.z\\X.java (at line 5)\n" + >+ " * @see java\n" + >+ " ^^^^\n" + >+ "Javadoc: Invalid reference\n" + >+ "----------\n" + >+ "2. WARNING in x.y.z\\X.java (at line 6)\n" + >+ " * @see java.lang\n" + >+ " ^^^^^^^^^\n" + >+ "Javadoc: Invalid reference\n" + >+ "----------\n" + >+ "3. WARNING in x.y.z\\X.java (at line 7)\n" + >+ " * @see x\n" + >+ " ^\n" + >+ "Javadoc: Invalid reference\n" + >+ "----------\n" + >+ "4. WARNING in x.y.z\\X.java (at line 8)\n" + >+ " * @see x.y\n" + >+ " ^^^\n" + >+ "Javadoc: Invalid reference\n" + >+ "----------\n"); >+ } > } >\ No newline at end of file >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/ast/JavadocQualifiedTypeReference.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocQualifiedTypeReference.java,v >retrieving revision 1.22 >diff -u -r1.22 JavadocQualifiedTypeReference.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/JavadocQualifiedTypeReference.java 27 May 2008 22:21:13 -0000 1.22 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/JavadocQualifiedTypeReference.java 5 Jun 2008 13:35:23 -0000 >@@ -50,6 +50,12 @@ > Binding binding = scope.getTypeOrPackage(this.tokens); > if (binding instanceof PackageBinding) { > this.packageBinding = (PackageBinding) binding; >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=211054 >+ // allow references to current package only. All other package references should be reported as invalid >+ // @see also https://bugs.eclipse.org/bugs/show_bug.cgi?id=50695 >+ if (scope.compilationUnitScope().fPackage != this.packageBinding) { >+ scope.problemReporter().javadocInvalidReference(this.sourceStart, this.sourceEnd); >+ } > } else { > reportInvalidType(scope); > } >Index: compiler/org/eclipse/jdt/internal/compiler/ast/JavadocSingleTypeReference.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocSingleTypeReference.java,v >retrieving revision 1.25 >diff -u -r1.25 JavadocSingleTypeReference.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/JavadocSingleTypeReference.java 27 May 2008 22:21:13 -0000 1.25 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/JavadocSingleTypeReference.java 5 Jun 2008 13:35:23 -0000 >@@ -65,6 +65,12 @@ > Binding binding = scope.getTypeOrPackage(tokens); > if (binding instanceof PackageBinding) { > this.packageBinding = (PackageBinding) binding; >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=211054 >+ // allow references to current package only. All other package references should be reported as invalid >+ // @see also https://bugs.eclipse.org/bugs/show_bug.cgi?id=50695 >+ if (scope.compilationUnitScope().fPackage != this.packageBinding) { >+ scope.problemReporter().javadocInvalidReference(this.sourceStart, this.sourceEnd); >+ } > } else { > if (this.resolvedType.problemId() == ProblemReasons.NonStaticReferenceInStaticContext) { > TypeBinding closestMatch = this.resolvedType.closestMatch();
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 211054
:
103720
| 103733