Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorptff2004-09-20 04:56:32 -0400
committerptff2004-09-20 04:56:32 -0400
commita4a1c3ef157499cd65847ad0a2c2d810e6a45b64 (patch)
tree3b3bd431d44b0506a23f9643c2bd60289889fb0f
parentecc31fe7d06d2033c9b06ad94becec075d78320c (diff)
downloadeclipse.jdt.core-a4a1c3ef157499cd65847ad0a2c2d810e6a45b64.tar.gz
eclipse.jdt.core-a4a1c3ef157499cd65847ad0a2c2d810e6a45b64.tar.xz
eclipse.jdt.core-a4a1c3ef157499cd65847ad0a2c2d810e6a45b64.zip
71267
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchJavadocTests.java54
-rw-r--r--org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PackageReferenceLocator.java17
2 files changed, 64 insertions, 7 deletions
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchJavadocTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchJavadocTests.java
index 91dc0da18a..21583c65aa 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchJavadocTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchJavadocTests.java
@@ -88,6 +88,9 @@ public class JavaSearchJavadocTests extends JavaSearchTests {
System.err.println("WARNING: only subset of tests will be executed!!!");
suite.addTest(new JavaSearchJavadocTests("testBug54962"));
suite.addTest(new JavaSearchJavadocTests("testBug54962qualified"));
+ suite.addTest(new JavaSearchJavadocTests("testBug71267"));
+ suite.addTest(new JavaSearchJavadocTests("testBug71267qualified"));
+ suite.addTest(new JavaSearchJavadocTests("testBug73551"));
return suite;
}
@@ -153,6 +156,8 @@ public class JavaSearchJavadocTests extends JavaSearchTests {
suite.addTest(new JavaSearchJavadocTests("testBug49994constructor", support));
suite.addTest(new JavaSearchJavadocTests("testBug54962", support));
suite.addTest(new JavaSearchJavadocTests("testBug54962qualified", support));
+ suite.addTest(new JavaSearchJavadocTests("testBug71267", support));
+ suite.addTest(new JavaSearchJavadocTests("testBug71267qualified", support));
}
/* (non-Javadoc)
@@ -1005,10 +1010,10 @@ public class JavaSearchJavadocTests extends JavaSearchTests {
IPackageDeclaration packDecl = getCompilationUnit("JavaSearch", "src", "j6", "Bug54962.java").getPackageDeclaration("j6");
search(packDecl, REFERENCES, getJavaSearchScope(), result);
assertSearchResults(
- "src/j6/Bug54962.java [j6] EXACT_MATCH INSIDE_JAVADOC\n" +
- "src/j6/Bug54962.java j6.Bug54962 [j6] POTENTIAL_MATCH INSIDE_JAVADOC\n" +
- "src/j6/Bug54962.java j6.Bug54962 [j6] EXACT_MATCH INSIDE_JAVADOC\n" +
- "src/j7/qua/li/fied/Bug54962a.java [j6] EXACT_MATCH OUTSIDE_JAVADOC",
+ "src/j6/Bug54962.java j6.Bug54962 [j6] EXACT_MATCH INSIDE_JAVADOC\n" +
+ "src/j6/Bug54962.java j6.Bug54962 [j6] POTENTIAL_MATCH INSIDE_JAVADOC\n" +
+ "src/j6/Bug54962.java j6.Bug54962 [j6] EXACT_MATCH INSIDE_JAVADOC\n" +
+ "src/j7/qua/li/fied/Bug54962a.java [j6] EXACT_MATCH OUTSIDE_JAVADOC",
result);
}
public void testBug54962qualified() throws CoreException {
@@ -1019,9 +1024,44 @@ public class JavaSearchJavadocTests extends JavaSearchTests {
IPackageDeclaration packDecl = getCompilationUnit("JavaSearch", "src", "j7.qua.li.fied", "Bug54962a.java").getPackageDeclaration("j7.qua.li.fied");
search(packDecl, REFERENCES, getJavaSearchScope(), result);
assertSearchResults(
- "src/j7/qua/li/fied/Bug54962a.java [j7.qua.li.fied] EXACT_MATCH INSIDE_JAVADOC\n" +
- "src/j7/qua/li/fied/Bug54962a.java j7.qua.li.fied.Bug54962a [j7.qua.li.fied] POTENTIAL_MATCH INSIDE_JAVADOC\n" +
- "src/j7/qua/li/fied/Bug54962a.java j7.qua.li.fied.Bug54962a [j7.qua.li.fied] EXACT_MATCH INSIDE_JAVADOC",
+ "src/j7/qua/li/fied/Bug54962a.java j7.qua.li.fied.Bug54962a [j7.qua.li.fied] EXACT_MATCH INSIDE_JAVADOC\n" +
+ "src/j7/qua/li/fied/Bug54962a.java j7.qua.li.fied.Bug54962a [j7.qua.li.fied] POTENTIAL_MATCH INSIDE_JAVADOC\n" +
+ "src/j7/qua/li/fied/Bug54962a.java j7.qua.li.fied.Bug54962a [j7.qua.li.fied] EXACT_MATCH INSIDE_JAVADOC",
+ result);
+ }
+
+ /**
+ * Test fix for bug 71267: [Search][Javadoc] SearchMatch in class javadoc reported with element of type IImportDeclaration
+ * @see <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=71267">71267</a>
+ * @throws CoreException
+ */
+ public void testBug71267() throws CoreException {
+ setJavadocOptions();
+ JavaSearchResultCollector result = new JavaSearchResultCollector();
+ result.showAccuracy = true;
+ result.showInsideDoc = true;
+ IPackageDeclaration packDecl = getCompilationUnit("JavaSearch", "src", "p71267", "Test.java").getPackageDeclaration("p71267");
+ search(packDecl, REFERENCES, getJavaSearchScope(), result);
+ assertSearchResults(
+ "src/p71267/Test.java p71267.Test [p71267] EXACT_MATCH INSIDE_JAVADOC\n" +
+ "src/p71267/Test.java p71267.Test [p71267] EXACT_MATCH INSIDE_JAVADOC\n" +
+ "src/p71267/q71267/Test.java p71267.q71267.Test [p71267] EXACT_MATCH INSIDE_JAVADOC",
+ result);
+ }
+ public void testBug71267qualified() throws CoreException {
+ setJavadocOptions();
+ JavaSearchResultCollector result = new JavaSearchResultCollector();
+ result.showAccuracy = true;
+ result.showInsideDoc = true;
+ IPackageDeclaration packDecl = getCompilationUnit("JavaSearch", "src", "p71267.q71267", "Test.java").getPackageDeclaration("p71267.q71267");
+ search(packDecl, REFERENCES, getJavaSearchScope(), result);
+ assertSearchResults(
+ "src/p71267/q71267/Test.java p71267.q71267.Test [p71267.q71267] EXACT_MATCH INSIDE_JAVADOC\n" +
+ "src/p71267/q71267/Test.java p71267.q71267.Test [p71267.q71267] EXACT_MATCH INSIDE_JAVADOC\n" +
+ "src/p71267/q71267/Test.java p71267.q71267.Test.field [p71267.q71267] EXACT_MATCH INSIDE_JAVADOC\n" +
+ "src/p71267/q71267/Test.java p71267.q71267.Test.field [p71267.q71267] EXACT_MATCH INSIDE_JAVADOC\n" +
+ "src/p71267/q71267/Test.java void p71267.q71267.Test.method() [p71267.q71267] EXACT_MATCH INSIDE_JAVADOC\n" +
+ "src/p71267/q71267/Test.java void p71267.q71267.Test.method() [p71267.q71267] EXACT_MATCH INSIDE_JAVADOC",
result);
}
}
diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PackageReferenceLocator.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PackageReferenceLocator.java
index 77d76a99f4..d6f4015018 100644
--- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PackageReferenceLocator.java
+++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PackageReferenceLocator.java
@@ -179,6 +179,11 @@ protected void matchReportReference(ASTNode reference, IJavaElement element, int
QualifiedTypeReference qTypeRef = (QualifiedTypeReference) reference;
positions = qTypeRef.sourcePositions;
typeBinding = qTypeRef.resolvedType;
+ } else if (reference instanceof JavadocSingleTypeReference) {
+ JavadocSingleTypeReference jsTypeRef = (JavadocSingleTypeReference) reference;
+ positions = new long[1];
+ positions[0] = (((long)jsTypeRef.sourceStart) << 32) + jsTypeRef.sourceEnd;
+ typeBinding = jsTypeRef.resolvedType;
}
if (typeBinding instanceof ArrayBinding)
typeBinding = ((ArrayBinding) typeBinding).leafComponentType;
@@ -204,6 +209,18 @@ protected int referenceType() {
return IJavaElement.PACKAGE_FRAGMENT;
}
public int resolveLevel(ASTNode node) {
+ if (node instanceof JavadocQualifiedTypeReference) {
+ JavadocQualifiedTypeReference qualifRef = (JavadocQualifiedTypeReference) node;
+ if (qualifRef.packageBinding != null)
+ return resolveLevel(qualifRef.packageBinding);
+ return resolveLevel(qualifRef.resolvedType);
+ }
+ if (node instanceof JavadocSingleTypeReference) {
+ JavadocSingleTypeReference singleRef = (JavadocSingleTypeReference) node;
+ if (singleRef.packageBinding != null)
+ return resolveLevel(singleRef.packageBinding);
+ return IMPOSSIBLE_MATCH;
+ }
if (node instanceof QualifiedTypeReference)
return resolveLevel(((QualifiedTypeReference) node).resolvedType);
if (node instanceof QualifiedNameReference)

Back to the top