### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core.tests.model Index: src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java,v retrieving revision 1.132 diff -u -r1.132 JavaSearchBugsTests.java --- src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java 27 Nov 2007 08:42:06 -0000 1.132 +++ src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java 27 Nov 2007 15:09:15 -0000 @@ -9216,8 +9216,8 @@ this.resultCollector.showSelection = true; search("*", TYPE, REFERENCES, getJavaSearchWorkingCopiesScope(), this.resultCollector); assertSearchResults( - "src/generics/Generic.java [import java.io.§|Serializable|§;] EXACT_MATCH\n" + - "src/generics/Generic.java [import type.def.§|Types|§;] EXACT_MATCH\n" + + "src/generics/Generic.java [import §|java.io.Serializable|§;] EXACT_MATCH\n" + + "src/generics/Generic.java [import §|type.def.Types|§;] EXACT_MATCH\n" + "src/generics/Generic.java generics.Generic [public class Generic & Serializable, V extends A> {] EXACT_MATCH\n" + "src/generics/Generic.java generics.Generic [public class Generic & Serializable, V extends A> {] EXACT_MATCH\n" + "src/generics/Generic.java generics.Generic [public class Generic & Serializable, V extends A> {] EXACT_MATCH\n" + @@ -9255,8 +9255,9 @@ this.resultCollector.showSelection = true; search("*", TYPE, REFERENCES, getJavaSearchWorkingCopiesScope(), this.resultCollector); assertSearchResults( - "src/test/Ref.java [import pack.§|Test|§;] EXACT_MATCH\n" + + "src/test/Ref.java [import §|pack.Test|§;] EXACT_MATCH\n" + "src/test/Ref.java test.Ref.test [ §|Test|§ test;] EXACT_MATCH" ); } + } \ No newline at end of file Index: src/org/eclipse/jdt/core/tests/model/RunJavaSearchTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/RunJavaSearchTests.java,v retrieving revision 1.16 diff -u -r1.16 RunJavaSearchTests.java --- src/org/eclipse/jdt/core/tests/model/RunJavaSearchTests.java 29 Mar 2006 04:03:07 -0000 1.16 +++ src/org/eclipse/jdt/core/tests/model/RunJavaSearchTests.java 27 Nov 2007 15:09:15 -0000 @@ -23,6 +23,8 @@ public final static List TEST_CLASSES = new ArrayList(); static { + // All test suites put in this list should use the same tests projects + // (eg. JavaSearch and JavaSearch15) TEST_CLASSES.add(JavaSearchTests.class); TEST_CLASSES.add(JavaSearchGenericTypeTests.class); TEST_CLASSES.add(JavaSearchGenericTypeEquivalentTests.class); @@ -36,6 +38,7 @@ TEST_CLASSES.add(JavaSearchGenericConstructorEquivalentTests.class); TEST_CLASSES.add(WorkingCopySearchTests.class); TEST_CLASSES.add(JavaSearchJavadocTests.class); + TEST_CLASSES.add(JavaSearchFineGrainTests.class); } public static Class[] getTestClasses() { Index: src/org/eclipse/jdt/core/tests/model/AbstractJavaSearchTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaSearchTests.java,v retrieving revision 1.30 diff -u -r1.30 AbstractJavaSearchTests.java --- src/org/eclipse/jdt/core/tests/model/AbstractJavaSearchTests.java 27 Nov 2007 08:42:06 -0000 1.30 +++ src/org/eclipse/jdt/core/tests/model/AbstractJavaSearchTests.java 27 Nov 2007 15:09:13 -0000 @@ -59,6 +59,7 @@ public boolean showPotential = true; public boolean showProject; public boolean showSynthetic; + public boolean showOffset = false; public int showFlavors = 0; public int count = 0; List lines = new ArrayList(); @@ -177,6 +178,10 @@ if (lineEnd == -1) lineEnd = contents.length; line.append(CharOperation.subarray(contents, end, lineEnd)); } + if (this.showOffset) { + line.append('@'); + line.append(start); + } } else { line.append("No source"); } Index: src/org/eclipse/jdt/core/tests/model/JavaSearchFineGrainTests.java =================================================================== RCS file: src/org/eclipse/jdt/core/tests/model/JavaSearchFineGrainTests.java diff -N src/org/eclipse/jdt/core/tests/model/JavaSearchFineGrainTests.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/eclipse/jdt/core/tests/model/JavaSearchFineGrainTests.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,1628 @@ +/******************************************************************************* + * Copyright (c) 2000, 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.jdt.core.tests.model; + +import junit.framework.Test; + +import org.eclipse.core.runtime.*; +import org.eclipse.jdt.core.*; +import org.eclipse.jdt.core.search.IJavaSearchScope; +import org.eclipse.jdt.core.search.SearchEngine; +import org.eclipse.jdt.core.search.SearchPattern; + + +/** + * Specific test suite for fine grained search. + * + * @bug 155013: [search] [DCR] More finegrained options for Java search + * @test Several tests sets trying to cover as many cases as possible. + *

+ * Each set is organize the same way: + *

    + *
  • specific method defining the test case called by all the tests of the set,
  • + *
  • first test performs a search request without any fine grain flag defined + * to have a precise idea of what are the entire expected references,
  • + *
  • second test performs a search request with all fine grain flags + * defined to verify that flags combination works well
  • + *
  • each following test each defines one of the possible fine grain flag + * to verify that it works properly with the given test case,
  • + *
+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=155013" + */ +public class JavaSearchFineGrainTests extends JavaSearchTests { + +public JavaSearchFineGrainTests(String name) { + super(name); +} +public static Test suite() { + return buildModelTestSuite(JavaSearchFineGrainTests.class); +} +static { +// org.eclipse.jdt.internal.core.search.BasicSearchEngine.VERBOSE = true; +} + +IJavaSearchScope getJavaSearchScope() { + return super.getJavaSearchScope15(); +} +public ICompilationUnit getWorkingCopy(String path, String source) throws JavaModelException { + if (this.wcOwner == null) { + this.wcOwner = new WorkingCopyOwner() {}; + } + return getWorkingCopy(path, source, this.wcOwner); +} + +protected void setUp () throws Exception { + super.setUp(); + this.resultCollector = new JavaSearchResultCollector(); + resultCollector.showInsideDoc = false; + resultCollector.showAccuracy = true; + this.resultCollector.showSelection = true; + this.resultCollector.showOffset = true; +} + +static { +// TESTS_PREFIX = "testMethodRef"; +} + +/* + * References to a specific IField + */ +private final static int ALL_FIELD_METHOD_FINE_GRAIN_FLAGS = + SUPER_REFERENCE | + QUALIFIED_REFERENCE | + THIS_REFERENCE | + IMPLICIT_THIS_REFERENCE; +private IField setUpFieldRef() throws JavaModelException { + final ProblemRequestor problemRequestor = new ProblemRequestor(); + this.wcOwner = new WorkingCopyOwner() { + public IProblemRequestor getProblemRequestor(ICompilationUnit workingCopy) { + return problemRequestor; + } + }; + workingCopies = new ICompilationUnit[2]; + workingCopies[0] = getWorkingCopy("/JavaSearch15/src/field/def/Fields.java", + "package field.def;\n" + + "public class Fields {\n" + + " public Object field;\n" + + "}\n" + ); + workingCopies[1] = getWorkingCopy("/JavaSearch15/src/field/ref/TestFields.java", + "package field.ref;\n" + + "import field.def.Fields;\n" + + "public class TestFields extends Fields {\n" + + " boolean foo(Fields param) {\n" + + " return super.field == null ||\n" + + " param.field == null ||\n" + + " this.field == null ||\n" + + " field == null;\n" + + " }\n" + + "}\n" + ); + assertEquals("CU Should not have any problem!", + "----------\n" + + "----------\n", + problemRequestor.problems.toString() + ); + this.resultCollector.showSelection = true; + this.resultCollector.showOffset = true; + return workingCopies[0].getType("Fields").getField("field"); +} +public void testFieldRef() throws CoreException { + search(setUpFieldRef(), REFERENCES); + assertSearchResults( + "src/field/ref/TestFields.java boolean field.ref.TestFields.foo(Fields) [ return super.§|field|§ == null ||@129] EXACT_MATCH\n" + + "src/field/ref/TestFields.java boolean field.ref.TestFields.foo(Fields) [ param.§|field|§ == null ||@155] EXACT_MATCH\n" + + "src/field/ref/TestFields.java boolean field.ref.TestFields.foo(Fields) [ this.§|field|§ == null ||@180] EXACT_MATCH\n" + + "src/field/ref/TestFields.java boolean field.ref.TestFields.foo(Fields) [ §|field|§ == null;@200] EXACT_MATCH" + ); +} +public void testFieldRef_AllFlags() throws CoreException { + search(setUpFieldRef(), ALL_FIELD_METHOD_FINE_GRAIN_FLAGS); + assertSearchResults( + "src/field/ref/TestFields.java boolean field.ref.TestFields.foo(Fields) [ return super.§|field|§ == null ||@129] EXACT_MATCH\n" + + "src/field/ref/TestFields.java boolean field.ref.TestFields.foo(Fields) [ param.§|field|§ == null ||@155] EXACT_MATCH\n" + + "src/field/ref/TestFields.java boolean field.ref.TestFields.foo(Fields) [ this.§|field|§ == null ||@180] EXACT_MATCH\n" + + "src/field/ref/TestFields.java boolean field.ref.TestFields.foo(Fields) [ §|field|§ == null;@200] EXACT_MATCH" + ); +} +public void testFieldRef_Qualified() throws CoreException { + search(setUpFieldRef(), QUALIFIED_REFERENCE); + assertSearchResults( + "src/field/ref/TestFields.java boolean field.ref.TestFields.foo(Fields) [ param.§|field|§ == null ||@155] EXACT_MATCH" + ); +} +public void testFieldRef_Simple() throws CoreException { + search(setUpFieldRef(), IMPLICIT_THIS_REFERENCE); + assertSearchResults( + "src/field/ref/TestFields.java boolean field.ref.TestFields.foo(Fields) [ §|field|§ == null;@200] EXACT_MATCH" + ); +} +public void testFieldRef_Super() throws CoreException { + search(setUpFieldRef(), SUPER_REFERENCE); + assertSearchResults( + "src/field/ref/TestFields.java boolean field.ref.TestFields.foo(Fields) [ return super.§|field|§ == null ||@129] EXACT_MATCH" + ); +} +public void testFieldRef_This() throws CoreException { + search(setUpFieldRef(), THIS_REFERENCE); + assertSearchResults( + "src/field/ref/TestFields.java boolean field.ref.TestFields.foo(Fields) [ this.§|field|§ == null ||@180] EXACT_MATCH" + ); +} + +/* + * References to a specific IMethod + */ +private IMethod setUpMethodRef() throws JavaModelException { + final ProblemRequestor problemRequestor = new ProblemRequestor(); + this.wcOwner = new WorkingCopyOwner() { + public IProblemRequestor getProblemRequestor(ICompilationUnit workingCopy) { + return problemRequestor; + } + }; + workingCopies = new ICompilationUnit[2]; + workingCopies[0] = getWorkingCopy("/JavaSearch15/src/meth/def/Methods.java", + "package meth.def;\n" + + "public class Methods {\n" + + " public void method() {}\n" + + "}\n" + ); + workingCopies[1] = getWorkingCopy("/JavaSearch15/src/meth/ref/TestMethods.java", + "package meth.ref;\n" + + "import meth.def.Methods;\n" + + "public class TestMethods extends Methods {\n" + + " void foo(Methods param) {\n" + + " super.method();\n" + + " param.method();\n" + + " this.method();\n" + + " method();\n" + + " }\n" + + "}\n" + ); + assertEquals("CU Should not have any problem!", + "----------\n" + + "----------\n", + problemRequestor.problems.toString() + ); + this.resultCollector.showSelection = true; + this.resultCollector.showOffset = true; + return workingCopies[0].getType("Methods").getMethod("method", new String[0]); +} +public void testMethodRef() throws CoreException { + search(setUpMethodRef(), REFERENCES); + assertSearchResults( + "src/meth/ref/TestMethods.java void meth.ref.TestMethods.foo(Methods) [ super.§|method()|§;@121] EXACT_MATCH\n" + + "src/meth/ref/TestMethods.java void meth.ref.TestMethods.foo(Methods) [ param.§|method()|§;@139] EXACT_MATCH\n" + + "src/meth/ref/TestMethods.java void meth.ref.TestMethods.foo(Methods) [ this.§|method()|§;@156] EXACT_MATCH\n" + + "src/meth/ref/TestMethods.java void meth.ref.TestMethods.foo(Methods) [ §|method()|§;@168] EXACT_MATCH" + ); +} +public void testMethodRef_AllFlags() throws CoreException { + search(setUpMethodRef(), ALL_FIELD_METHOD_FINE_GRAIN_FLAGS); + assertSearchResults( + "src/meth/ref/TestMethods.java void meth.ref.TestMethods.foo(Methods) [ super.§|method()|§;@121] EXACT_MATCH\n" + + "src/meth/ref/TestMethods.java void meth.ref.TestMethods.foo(Methods) [ param.§|method()|§;@139] EXACT_MATCH\n" + + "src/meth/ref/TestMethods.java void meth.ref.TestMethods.foo(Methods) [ this.§|method()|§;@156] EXACT_MATCH\n" + + "src/meth/ref/TestMethods.java void meth.ref.TestMethods.foo(Methods) [ §|method()|§;@168] EXACT_MATCH" + ); +} +public void testMethodRef_Qualified() throws CoreException { + search(setUpMethodRef(), QUALIFIED_REFERENCE); + assertSearchResults( + "src/meth/ref/TestMethods.java void meth.ref.TestMethods.foo(Methods) [ param.§|method()|§;@139] EXACT_MATCH" + ); +} +public void testMethodRef_Simple() throws CoreException { + search(setUpMethodRef(), IMPLICIT_THIS_REFERENCE); + assertSearchResults( + "src/meth/ref/TestMethods.java void meth.ref.TestMethods.foo(Methods) [ §|method()|§;@168] EXACT_MATCH" + ); +} +public void testMethodRef_Super() throws CoreException { + search(setUpMethodRef(), SUPER_REFERENCE); + assertSearchResults( + "src/meth/ref/TestMethods.java void meth.ref.TestMethods.foo(Methods) [ super.§|method()|§;@121] EXACT_MATCH" + ); +} +public void testMethodRef_This() throws CoreException { + search(setUpMethodRef(), THIS_REFERENCE); + assertSearchResults( + "src/meth/ref/TestMethods.java void meth.ref.TestMethods.foo(Methods) [ this.§|method()|§;@156] EXACT_MATCH" + ); +} + +private final static int ALL_TYPE_FINE_GRAIN_FLAGS = + FIELD_TYPE_DECLARATION_TYPE_REFERENCE | + LOCAL_VARIABLE_DECLARATION_TYPE_REFERENCE | + PARAMETER_TYPE_DECLARATION_TYPE_REFERENCE | + SUPERTYPE_TYPE_REFERENCE | + SUPERINTERFACE_TYPE_REFERENCE | + THROWS_CLAUSE_TYPE_REFERENCE | + CAST_TYPE_REFERENCE | + CATCH_TYPE_REFERENCE | + ALLOCATION_EXPRESSION_TYPE_REFERENCE | + RETURN_TYPE_REFERENCE | + IMPORT_DECLARATION_TYPE_REFERENCE | + ANNOTATION_TYPE_REFERENCE | + TYPE_VARIABLE_BOUND_TYPE_REFERENCE | + PARAMETERIZED_TYPE_REFERENCE | + WILDCARD_BOUND_TYPE_REFERENCE; + +/* + * References to a specific IType + */ +private IType setUpTypeRef(int typeIndex) throws JavaModelException { + final ProblemRequestor problemRequestor = new ProblemRequestor(); + this.wcOwner = new WorkingCopyOwner() { + public IProblemRequestor getProblemRequestor(ICompilationUnit workingCopy) { + return problemRequestor; + } + }; + workingCopies = new ICompilationUnit[3]; + workingCopies[0] = getWorkingCopy("/JavaSearch15/src/type/def/Types.java", + "package type.def;\n" + + "@Bug\n" + + "@ATest\n" + + "public class Types extends Exception implements ITest1, ITest2 {\n" + + " ITest1 test1;\n" + + " ITest2 test2;\n" + + "}\n" + + "@Bug\n" + + "interface ITest1 {}\n" + + "@ATest\n" + + "interface ITest2 extends ITest1 {}\n" + + "@Bug\n" + + "@ATest\n" + + "enum ETest {}\n" + + "@Bug\n" + + "@interface ATest {}\n" + ); + workingCopies[1] = getWorkingCopy("/JavaSearch15/src/type/def/Bug.java", + "package type.def;\n" + + "public @interface Bug {\n" + + " int num() default 0;\n" + + " String comment() default \"\";\n" + + "}\n" + ); + workingCopies[2] = getWorkingCopy("/JavaSearch15/src/type/ref/TestTypes.java", + "package type.ref;\n" + + "import type.def.Types;\n" + + "import type.def.Bug;\n" + + "\n" + + "@Bug(num=155013)\n" + + "public class TestTypes extends Types {\n" + + " @Bug(comment=\"field\")\n" + + " Types field;\n" + + " @Bug(comment=\"method\", num=155013)\n" + + " Types method(Types param) throws Types {\n" + + " Object obj = new Types();\n" + + " Types local = (Types) obj;\n" + + " return local;\n" + + " }\n" + + " Bug bar(Bug bug) {\n" + + " try {\n" + + " method(this);\n" + + " } catch (Types ex) {\n" + + " }\n" + + " return bug;\n" + + " }\n" + + "}\n" + ); + assertEquals("CU Should not have any problem!", + "----------\n" + + "----------\n", + problemRequestor.problems.toString() + ); + ICompilationUnit cu = workingCopies[typeIndex]; + String cuName = cu.getElementName(); + return cu.getType(cuName.substring(0, cuName.indexOf('.'))); +} +public void testTypeRef() throws CoreException { + search(setUpTypeRef(0), REFERENCES); + assertSearchResults( + "src/type/ref/TestTypes.java [import §|type.def.Types|§;@25] EXACT_MATCH\n" + + "src/type/ref/TestTypes.java type.ref.TestTypes [public class TestTypes extends §|Types|§ {@111] EXACT_MATCH\n" + + "src/type/ref/TestTypes.java type.ref.TestTypes.field [ §|Types|§ field;@143] EXACT_MATCH\n" + + "src/type/ref/TestTypes.java Types type.ref.TestTypes.method(Types) [ §|Types|§ method(Types param) throws Types {@193] EXACT_MATCH\n" + + "src/type/ref/TestTypes.java Types type.ref.TestTypes.method(Types) [ Types method(§|Types|§ param) throws Types {@206] EXACT_MATCH\n" + + "src/type/ref/TestTypes.java Types type.ref.TestTypes.method(Types) [ Types method(Types param) throws §|Types|§ {@226] EXACT_MATCH\n" + + "src/type/ref/TestTypes.java Types type.ref.TestTypes.method(Types) [ Object obj = new §|Types|§();@253] EXACT_MATCH\n" + + "src/type/ref/TestTypes.java Types type.ref.TestTypes.method(Types) [ §|Types|§ local = (Types) obj;@264] EXACT_MATCH\n" + + "src/type/ref/TestTypes.java Types type.ref.TestTypes.method(Types) [ Types local = (§|Types|§) obj;@279] EXACT_MATCH\n" + + "src/type/ref/TestTypes.java Bug type.ref.TestTypes.bar(Bug) [ } catch (§|Types|§ ex) {@366] EXACT_MATCH" + ); +} +public void testTypeRef_AllFlags() throws CoreException { + search(setUpTypeRef(0), ALL_TYPE_FINE_GRAIN_FLAGS); + assertSearchResults( + "src/type/ref/TestTypes.java [import §|type.def.Types|§;@25] EXACT_MATCH\n" + + "src/type/ref/TestTypes.java type.ref.TestTypes [public class TestTypes extends §|Types|§ {@111] EXACT_MATCH\n" + + "src/type/ref/TestTypes.java type.ref.TestTypes.field [ §|Types|§ field;@143] EXACT_MATCH\n" + + "src/type/ref/TestTypes.java Types type.ref.TestTypes.method(Types) [ Types method(§|Types|§ param) throws Types {@206] EXACT_MATCH\n" + + "src/type/ref/TestTypes.java Types type.ref.TestTypes.method(Types) [ Types method(Types param) throws §|Types|§ {@226] EXACT_MATCH\n" + + "src/type/ref/TestTypes.java Types type.ref.TestTypes.method(Types) [ §|Types|§ method(Types param) throws Types {@193] EXACT_MATCH\n" + + "src/type/ref/TestTypes.java Types type.ref.TestTypes.method(Types) [ Object obj = new §|Types|§();@253] EXACT_MATCH\n" + + "src/type/ref/TestTypes.java Types type.ref.TestTypes.method(Types) [ §|Types|§ local = (Types) obj;@264] EXACT_MATCH\n" + + "src/type/ref/TestTypes.java Types type.ref.TestTypes.method(Types) [ Types local = (§|Types|§) obj;@279] EXACT_MATCH\n" + + "src/type/ref/TestTypes.java Bug type.ref.TestTypes.bar(Bug) [ } catch (§|Types|§ ex) {@366] EXACT_MATCH" + ); +} +public void testTypeRef_Allocation() throws CoreException { + search(setUpTypeRef(0), ALLOCATION_EXPRESSION_TYPE_REFERENCE); + assertSearchResults( + "src/type/ref/TestTypes.java Types type.ref.TestTypes.method(Types) [ Object obj = new §|Types|§();@253] EXACT_MATCH" + ); +} +public void testTypeRef_Annotation() throws CoreException { + search(setUpTypeRef(1), ANNOTATION_TYPE_REFERENCE); + assertSearchResults( + "src/type/def/Types.java type.def.Types [@§|Bug|§@19] EXACT_MATCH\n" + + "src/type/def/Types.java type.def.ITest1 [@§|Bug|§@128] EXACT_MATCH\n" + + "src/type/def/Types.java type.def.ETest [@§|Bug|§@195] EXACT_MATCH\n" + + "src/type/def/Types.java type.def.ATest [@§|Bug|§@221] EXACT_MATCH\n" + + "src/type/ref/TestTypes.java type.ref.TestTypes [@§|Bug|§(num=155013)@64] EXACT_MATCH\n" + + "src/type/ref/TestTypes.java type.ref.TestTypes.field [ @§|Bug|§(comment=\"field\")@121] EXACT_MATCH\n" + + "src/type/ref/TestTypes.java Types type.ref.TestTypes.method(Types) [ @§|Bug|§(comment=\"method\", num=155013)@158] EXACT_MATCH" + ); +} +public void testTypeRef_Cast() throws CoreException { + search(setUpTypeRef(0), CAST_TYPE_REFERENCE); + assertSearchResults( + "src/type/ref/TestTypes.java Types type.ref.TestTypes.method(Types) [ Types local = (§|Types|§) obj;@279] EXACT_MATCH" + ); +} +public void testTypeRef_Catch() throws CoreException { + search(setUpTypeRef(0), CATCH_TYPE_REFERENCE); + assertSearchResults( + "src/type/ref/TestTypes.java Bug type.ref.TestTypes.bar(Bug) [ } catch (§|Types|§ ex) {@366] EXACT_MATCH" + ); +} +public void testTypeRef_Field() throws CoreException { + search(setUpTypeRef(0), FIELD_TYPE_DECLARATION_TYPE_REFERENCE); + assertSearchResults( + "src/type/ref/TestTypes.java type.ref.TestTypes.field [ §|Types|§ field;@143] EXACT_MATCH" + ); +} +public void testTypeRef_Import() throws CoreException { + search(setUpTypeRef(0), IMPORT_DECLARATION_TYPE_REFERENCE); + assertSearchResults( + "src/type/ref/TestTypes.java [import §|type.def.Types|§;@25] EXACT_MATCH" + ); +} +public void testTypeRef_MethodParameter() throws CoreException { + search(setUpTypeRef(0), PARAMETER_TYPE_DECLARATION_TYPE_REFERENCE); + assertSearchResults( + "src/type/ref/TestTypes.java Types type.ref.TestTypes.method(Types) [ Types method(§|Types|§ param) throws Types {@206] EXACT_MATCH" + ); +} +public void testTypeRef_Return() throws CoreException { + search(setUpTypeRef(0), RETURN_TYPE_REFERENCE); + assertSearchResults( + "src/type/ref/TestTypes.java Types type.ref.TestTypes.method(Types) [ §|Types|§ method(Types param) throws Types {@193] EXACT_MATCH" + ); +} +public void testTypeRef_Superinterface() throws CoreException { + IType type = setUpTypeRef(0); + search(((ICompilationUnit) type.getParent()).getType("ITest1"), SUPERINTERFACE_TYPE_REFERENCE, getJavaSearchWorkingCopiesScope()); + assertSearchResults( + "src/type/def/Types.java type.def.Types [public class Types extends Exception implements §|ITest1|§, ITest2 {@78] EXACT_MATCH\n" + + "src/type/def/Types.java type.def.ITest2 [interface ITest2 extends §|ITest1|§ {}@184] EXACT_MATCH" + ); +} +public void testTypeRef_Supertype() throws CoreException { + search(setUpTypeRef(0), SUPERTYPE_TYPE_REFERENCE); + assertSearchResults( + "src/type/ref/TestTypes.java type.ref.TestTypes [public class TestTypes extends §|Types|§ {@111] EXACT_MATCH" + ); +} +public void testTypeRef_Throws() throws CoreException { + search(setUpTypeRef(0), THROWS_CLAUSE_TYPE_REFERENCE); + assertSearchResults( + "src/type/ref/TestTypes.java Types type.ref.TestTypes.method(Types) [ Types method(Types param) throws §|Types|§ {@226] EXACT_MATCH" + ); +} +public void testTypeRef_Variable() throws CoreException { + search(setUpTypeRef(0), LOCAL_VARIABLE_DECLARATION_TYPE_REFERENCE); + assertSearchResults( + "src/type/ref/TestTypes.java Types type.ref.TestTypes.method(Types) [ §|Types|§ local = (Types) obj;@264] EXACT_MATCH" + ); +} + +/* + * References to a all types (using '*' string pattern) + */ +private void setUpTypeRefAll() throws JavaModelException { + final ProblemRequestor problemRequestor = new ProblemRequestor(); + this.wcOwner = new WorkingCopyOwner() { + public IProblemRequestor getProblemRequestor(ICompilationUnit workingCopy) { + return problemRequestor; + } + }; + workingCopies = new ICompilationUnit[3]; + workingCopies[0] = getWorkingCopy("/JavaSearch15/src/type/def/Types.java", + "package type.def;\n" + + "@Bug\n" + + "@ATest\n" + + "public class Types extends Exception implements ITest1, ITest2 {\n" + + " ITest1 test1;\n" + + " ITest2 test2;\n" + + "}\n" + + "@Bug\n" + + "interface ITest1 {}\n" + + "@ATest\n" + + "interface ITest2 extends ITest1 {}\n" + + "@Bug\n" + + "@ATest\n" + + "enum ETest {}\n" + + "@Bug\n" + + "@interface ATest {}\n" + ); + workingCopies[1] = getWorkingCopy("/JavaSearch15/src/type/def/Bug.java", + "package type.def;\n" + + "public @interface Bug {\n" + + " int num() default 0;\n" + + " String comment() default \"\";\n" + + "}\n" + ); + workingCopies[2] = getWorkingCopy("/JavaSearch15/src/all/types/ref/TestTypes.java", + "package all.types.ref;\n" + + "\n" + + "import type.def.Bug;\n" + + "import type.def.Types;\n" + + "\n" + + "@Bug(num=155013)\n" + + "public class TestTypes extends Types {\n" + + " @Bug(comment=\"field\")\n" + + " Types field = new Types(), local, other = new Types();\n" + + " {\n" + + " Object o;\n" + + " Types t;\n" + + " if (this.field == null) {\n" + + " try {\n" + + " t = new TestTypes();\n" + + " } catch (RuntimeException e) {\n" + + " t = new Types();\n" + + " } \n" + + " } else {\n" + + " o = this.field;\n" + + " t = (Types) o;\n" + + " }\n" + + " local = t;\n" + + " };\n" + + " @Bug(comment=\"method\", num=155013)\n" + + " Types method(Types param) throws Types {\n" + + " Object obj = new Types();\n" + + " Types local = (Types) obj;\n" + + " return local;\n" + + " }\n" + + " Bug bar(Bug bug) {\n" + + " try {\n" + + " method(this);\n" + + " }\n" + + " catch (Types ex) {}\n" + + " catch (Exception ex) {}\n" + + " return bug; \n" + + " }\n" + + " // Other types references\n" + + " Object object;\n" + + " String str;\n" + + " TestTypes() throws Types, RuntimeException {\n" + + " if (this.object instanceof String) {\n" + + " this.str = (String) this.object;\n" + + " } else {\n" + + " this.str = new String();\n" + + " this.object = new Object();\n" + + " }\n" + + " }\n" + + "}\n" + ); + assertEquals("CU Should not have any problem!", + "----------\n" + + "----------\n", + problemRequestor.problems.toString() + ); + this.resultCollector.showSelection = true; + this.resultCollector.showOffset = true; +} +public void testTypeRefAll_Allocation() throws CoreException { + setUpTypeRefAll(); + search("*", TYPE, ALLOCATION_EXPRESSION_TYPE_REFERENCE, getJavaSearchWorkingCopiesScope()); + assertSearchResults( + "src/all/types/ref/TestTypes.java all.types.ref.TestTypes.field [ Types field = new §|Types|§(), local, other = new Types();@167] EXACT_MATCH\n" + + "src/all/types/ref/TestTypes.java all.types.ref.TestTypes.other [ Types field = new Types(), local, other = new §|Types|§();@195] EXACT_MATCH\n" + + "src/all/types/ref/TestTypes.java all.types.ref.TestTypes.{} [ t = new §|TestTypes|§();@279] EXACT_MATCH\n" + + "src/all/types/ref/TestTypes.java all.types.ref.TestTypes.{} [ t = new §|Types|§();@338] EXACT_MATCH\n" + + "src/all/types/ref/TestTypes.java Types all.types.ref.TestTypes.method(Types) [ Object obj = new §|Types|§();@519] EXACT_MATCH\n" + + "src/all/types/ref/TestTypes.java all.types.ref.TestTypes() [ this.str = new §|String|§();@897] EXACT_MATCH\n" + + "src/all/types/ref/TestTypes.java all.types.ref.TestTypes() [ this.object = new §|Object|§();@928] EXACT_MATCH" + ); +} +public void testTypeRefAll_Annotation() throws CoreException { + setUpTypeRefAll(); + search("*", TYPE, ANNOTATION_TYPE_REFERENCE, getJavaSearchWorkingCopiesScope()); + assertSearchResults( + "src/all/types/ref/TestTypes.java all.types.ref.TestTypes [@§|Bug|§(num=155013)@70] EXACT_MATCH\n" + + "src/all/types/ref/TestTypes.java all.types.ref.TestTypes.field [ @§|Bug|§(comment=\"field\")@127] EXACT_MATCH\n" + + "src/all/types/ref/TestTypes.java Types all.types.ref.TestTypes.method(Types) [ @§|Bug|§(comment=\"method\", num=155013)@424] EXACT_MATCH\n" + + "src/type/def/Types.java type.def.Types [@§|Bug|§@19] EXACT_MATCH\n" + + "src/type/def/Types.java type.def.Types [@§|ATest|§@24] EXACT_MATCH\n" + + "src/type/def/Types.java type.def.ITest1 [@§|Bug|§@128] EXACT_MATCH\n" + + "src/type/def/Types.java type.def.ITest2 [@§|ATest|§@153] EXACT_MATCH\n" + + "src/type/def/Types.java type.def.ETest [@§|Bug|§@195] EXACT_MATCH\n" + + "src/type/def/Types.java type.def.ETest [@§|ATest|§@200] EXACT_MATCH\n" + + "src/type/def/Types.java type.def.ATest [@§|Bug|§@221] EXACT_MATCH" + ); +} +public void testTypeRefAll_Cast() throws CoreException { + setUpTypeRefAll(); + search("*", TYPE, CAST_TYPE_REFERENCE, getJavaSearchWorkingCopiesScope()); + assertSearchResults( + "src/all/types/ref/TestTypes.java all.types.ref.TestTypes.{} [ t = (§|Types|§) o;@391] EXACT_MATCH\n" + + "src/all/types/ref/TestTypes.java Types all.types.ref.TestTypes.method(Types) [ Types local = (§|Types|§) obj;@545] EXACT_MATCH\n" + + "src/all/types/ref/TestTypes.java all.types.ref.TestTypes() [ this.str = (§|String|§) this.object;@847] EXACT_MATCH" + ); +} +public void testTypeRefAll_Catch() throws CoreException { + setUpTypeRefAll(); + search("*", TYPE, CATCH_TYPE_REFERENCE, getJavaSearchWorkingCopiesScope()); + assertSearchResults( + "src/all/types/ref/TestTypes.java all.types.ref.TestTypes.{} [ } catch (§|RuntimeException|§ e) {@304] EXACT_MATCH\n" + + "src/all/types/ref/TestTypes.java Bug all.types.ref.TestTypes.bar(Bug) [ catch (§|Types|§ ex) {}@634] EXACT_MATCH\n" + + "src/all/types/ref/TestTypes.java Bug all.types.ref.TestTypes.bar(Bug) [ catch (§|Exception|§ ex) {}@656] EXACT_MATCH" + ); +} +public void testTypeRefAll_Field() throws CoreException { + setUpTypeRefAll(); + search("*", TYPE, FIELD_TYPE_DECLARATION_TYPE_REFERENCE, getJavaSearchWorkingCopiesScope()); + assertSearchResults( + "src/all/types/ref/TestTypes.java all.types.ref.TestTypes.field [ §|Types|§ field = new Types(), local, other = new Types();@149] EXACT_MATCH\n" + + "src/all/types/ref/TestTypes.java all.types.ref.TestTypes.object [ §|Object|§ object;@719] EXACT_MATCH\n" + + "src/all/types/ref/TestTypes.java all.types.ref.TestTypes.str [ §|String|§ str;@735] EXACT_MATCH\n" + + "src/type/def/Types.java type.def.Types.test1 [ §|ITest1|§ test1;@96] EXACT_MATCH\n" + + "src/type/def/Types.java type.def.Types.test2 [ §|ITest2|§ test2;@111] EXACT_MATCH" + ); +} +public void testTypeRefAll_Import() throws CoreException { + setUpTypeRefAll(); + search("*", TYPE, IMPORT_DECLARATION_TYPE_REFERENCE, getJavaSearchWorkingCopiesScope()); + assertSearchResults( + "src/all/types/ref/TestTypes.java [import §|type.def.Bug|§;@31] EXACT_MATCH\n" + + "src/all/types/ref/TestTypes.java [import §|type.def.Types|§;@52] EXACT_MATCH" + ); +} +public void testTypeRefAll_MethodParameter() throws CoreException { + setUpTypeRefAll(); + search("*", TYPE, PARAMETER_TYPE_DECLARATION_TYPE_REFERENCE, getJavaSearchWorkingCopiesScope()); + assertSearchResults( + "src/all/types/ref/TestTypes.java Types all.types.ref.TestTypes.method(Types) [ Types method(§|Types|§ param) throws Types {@472] EXACT_MATCH\n" + + "src/all/types/ref/TestTypes.java Bug all.types.ref.TestTypes.bar(Bug) [ Bug bar(§|Bug|§ bug) {@585] EXACT_MATCH" + ); +} +public void testTypeRefAll_Return() throws CoreException { + setUpTypeRefAll(); + search("*", TYPE, RETURN_TYPE_REFERENCE, getJavaSearchWorkingCopiesScope()); + assertSearchResults( + "src/all/types/ref/TestTypes.java Types all.types.ref.TestTypes.method(Types) [ §|Types|§ method(Types param) throws Types {@459] EXACT_MATCH\n" + + "src/all/types/ref/TestTypes.java Bug all.types.ref.TestTypes.bar(Bug) [ §|Bug|§ bar(Bug bug) {@577] EXACT_MATCH" + ); +} +public void testTypeRefAll_Superinterface() throws CoreException { + setUpTypeRefAll(); + search("*", TYPE, SUPERINTERFACE_TYPE_REFERENCE, getJavaSearchWorkingCopiesScope()); + assertSearchResults( + "src/type/def/Types.java type.def.Types [public class Types extends Exception implements §|ITest1|§, ITest2 {@78] EXACT_MATCH\n" + + "src/type/def/Types.java type.def.Types [public class Types extends Exception implements ITest1, §|ITest2|§ {@86] EXACT_MATCH\n" + + "src/type/def/Types.java type.def.ITest2 [interface ITest2 extends §|ITest1|§ {}@184] EXACT_MATCH" + ); +} +public void testTypeRefAll_Supertype() throws CoreException { + setUpTypeRefAll(); + search("*", TYPE, SUPERTYPE_TYPE_REFERENCE, getJavaSearchWorkingCopiesScope()); + assertSearchResults( + "src/all/types/ref/TestTypes.java all.types.ref.TestTypes [public class TestTypes extends §|Types|§ {@117] EXACT_MATCH\n" + + "src/type/def/Types.java type.def.Types [public class Types extends §|Exception|§ implements ITest1, ITest2 {@57] EXACT_MATCH" + ); +} +public void testTypeRefAll_Throws() throws CoreException { + setUpTypeRefAll(); + search("*", TYPE, THROWS_CLAUSE_TYPE_REFERENCE, getJavaSearchWorkingCopiesScope()); + assertSearchResults( + "src/all/types/ref/TestTypes.java Types all.types.ref.TestTypes.method(Types) [ Types method(Types param) throws §|Types|§ {@492] EXACT_MATCH\n" + + "src/all/types/ref/TestTypes.java all.types.ref.TestTypes() [ TestTypes() throws §|Types|§, RuntimeException {@767] EXACT_MATCH\n" + + "src/all/types/ref/TestTypes.java all.types.ref.TestTypes() [ TestTypes() throws Types, §|RuntimeException|§ {@774] EXACT_MATCH" + ); +} +public void testTypeRefAll_Variable() throws CoreException { + setUpTypeRefAll(); + search("*", TYPE, LOCAL_VARIABLE_DECLARATION_TYPE_REFERENCE, getJavaSearchWorkingCopiesScope()); + assertSearchResults( + "src/all/types/ref/TestTypes.java all.types.ref.TestTypes.{} [ §|Object|§ o;@209] EXACT_MATCH\n" + + "src/all/types/ref/TestTypes.java all.types.ref.TestTypes.{} [ §|Types|§ t;@221] EXACT_MATCH\n" + + "src/all/types/ref/TestTypes.java Types all.types.ref.TestTypes.method(Types) [ §|Object|§ obj = new Types();@502] EXACT_MATCH\n" + + "src/all/types/ref/TestTypes.java Types all.types.ref.TestTypes.method(Types) [ §|Types|§ local = (Types) obj;@530] EXACT_MATCH" + ); +} + +private final static int ALL_GENERIC_TYPE_FINE_GRAIN_FLAGS = + TYPE_VARIABLE_BOUND_TYPE_REFERENCE | + PARAMETERIZED_TYPE_REFERENCE | + WILDCARD_BOUND_TYPE_REFERENCE; + +/* + * References to a specific generic IType and all types. + */ +private IType setUpTypeRefGeneric01() throws JavaModelException { + final ProblemRequestor problemRequestor = new ProblemRequestor(); + this.wcOwner = new WorkingCopyOwner() { + public IProblemRequestor getProblemRequestor(ICompilationUnit workingCopy) { + return problemRequestor; + } + }; + workingCopies = new ICompilationUnit[3]; + workingCopies[0] = getWorkingCopy("/JavaSearch15/src/type/def/Types.java", + "package type.def;\n" + + "public class Types {}\n" + ); + workingCopies[1] = getWorkingCopy("/JavaSearch15/src/test01/Generic.java", + "package test01;\n" + + "import java.io.Serializable;\n" + + "import type.def.Types;\n" + + "public class Generic & Serializable, V extends A> {\n" + + " Generic field;\n" + + " Comparable comp;\n" + + " Class clazz;\n" + + "}\n" + + "class A {}\n" + ); + workingCopies[2] = getWorkingCopy("/JavaSearch15/src/test01/TestGeneric.java", + "package test01;\n" + + "import java.io.Serializable;\n" + + "import type.def.Types;\n" + + "public class TestGeneric extends Generic {\n" + + " TestGeneric test;\n" + + " TestGeneric foo(TestGeneric param1, Comparable param2) {\n" + + " return null;\n" + + " }\n" + + " Comparable> bar() {\n" + + " return null;\n" + + " } \n" + + "}\n" + + "class UClass extends Types implements Comparable, Serializable {\n" + + " private static final long serialVersionUID = 1L;\n" + + " public int compareTo(Types o) {\n" + + " return 0;\n" + + " }\n" + + "}\n" + + "class VClass extends A {}\n" + ); + assertEquals("CU Should not have any problem!", + "----------\n" + + "----------\n", + problemRequestor.problems.toString() + ); + this.resultCollector.showSelection = true; + this.resultCollector.showOffset = true; + return workingCopies[0].getType("Types"); +} +public void testTypeRefGeneric01() throws CoreException { + search(setUpTypeRefGeneric01(), REFERENCES); + assertSearchResults( + "src/test01/Generic.java [import §|type.def.Types|§;@52] EXACT_MATCH\n" + + "src/test01/Generic.java test01.Generic [public class Generic & Serializable, V extends A> {@99] EXACT_MATCH\n" + + "src/test01/Generic.java test01.Generic [public class Generic & Serializable, V extends A> {@116] EXACT_MATCH\n" + + "src/test01/Generic.java test01.Generic [public class Generic & Serializable, V extends A> {@135] EXACT_MATCH\n" + + "src/test01/Generic.java test01.Generic [public class Generic & Serializable, V extends A> {@178] EXACT_MATCH\n" + + "src/test01/Generic.java test01.Generic.field [ Generic field;@207] EXACT_MATCH\n" + + "src/test01/TestGeneric.java [import §|type.def.Types|§;@52] EXACT_MATCH\n" + + "src/test01/TestGeneric.java test01.TestGeneric [public class TestGeneric extends Generic<§|Types|§, UClass, VClass> {@112] EXACT_MATCH\n" + + "src/test01/TestGeneric.java test01.TestGeneric.test [ TestGeneric<§|Types|§> test;@150] EXACT_MATCH\n" + + "src/test01/TestGeneric.java TestGeneric test01.TestGeneric.foo(TestGeneric, Comparable) [ TestGeneric foo(TestGeneric<§|Types|§> param1, Comparable param2) {@200] EXACT_MATCH\n" + + "src/test01/TestGeneric.java Comparable> test01.TestGeneric.bar() [ Comparable> bar() {@287] EXACT_MATCH\n" + + "src/test01/TestGeneric.java test01.UClass [class UClass extends §|Types|§ implements Comparable, Serializable {@345] EXACT_MATCH\n" + + "src/test01/TestGeneric.java test01.UClass [class UClass extends Types implements Comparable<§|Types|§>, Serializable {@373] EXACT_MATCH\n" + + "src/test01/TestGeneric.java int test01.UClass.compareTo(Types) [ public int compareTo(§|Types|§ o) {@468] EXACT_MATCH\n" + + "src/test01/TestGeneric.java test01.VClass [class VClass extends A<§|Types|§> {}@519] EXACT_MATCH" + ); +} +public void testTypeRefGeneric01_AllFlags() throws CoreException { + search(setUpTypeRefGeneric01(), ALL_TYPE_FINE_GRAIN_FLAGS); + assertSearchResults( + "src/test01/Generic.java [import §|type.def.Types|§;@52] EXACT_MATCH\n" + + "src/test01/Generic.java test01.Generic [public class Generic & Serializable, V extends A> {@99] EXACT_MATCH\n" + + "src/test01/Generic.java test01.Generic [public class Generic & Serializable, V extends A> {@116] EXACT_MATCH\n" + + "src/test01/Generic.java test01.Generic [public class Generic & Serializable, V extends A> {@135] EXACT_MATCH\n" + + "src/test01/Generic.java test01.Generic [public class Generic & Serializable, V extends A> {@178] EXACT_MATCH\n" + + "src/test01/Generic.java test01.Generic.field [ Generic field;@207] EXACT_MATCH\n" + + "src/test01/TestGeneric.java [import §|type.def.Types|§;@52] EXACT_MATCH\n" + + "src/test01/TestGeneric.java test01.TestGeneric [public class TestGeneric extends Generic<§|Types|§, UClass, VClass> {@112] EXACT_MATCH\n" + + "src/test01/TestGeneric.java test01.TestGeneric.test [ TestGeneric<§|Types|§> test;@150] EXACT_MATCH\n" + + "src/test01/TestGeneric.java TestGeneric test01.TestGeneric.foo(TestGeneric, Comparable) [ TestGeneric foo(TestGeneric<§|Types|§> param1, Comparable param2) {@200] EXACT_MATCH\n" + + "src/test01/TestGeneric.java Comparable> test01.TestGeneric.bar() [ Comparable> bar() {@287] EXACT_MATCH\n" + + "src/test01/TestGeneric.java test01.UClass [class UClass extends §|Types|§ implements Comparable, Serializable {@345] EXACT_MATCH\n" + + "src/test01/TestGeneric.java test01.UClass [class UClass extends Types implements Comparable<§|Types|§>, Serializable {@373] EXACT_MATCH\n" + + "src/test01/TestGeneric.java int test01.UClass.compareTo(Types) [ public int compareTo(§|Types|§ o) {@468] EXACT_MATCH\n" + + "src/test01/TestGeneric.java test01.VClass [class VClass extends A<§|Types|§> {}@519] EXACT_MATCH" + ); +} +public void testTypeRefGeneric01_Parameterized() throws CoreException { + search(setUpTypeRefGeneric01(), PARAMETERIZED_TYPE_REFERENCE); + assertSearchResults( + "src/test01/Generic.java test01.Generic [public class Generic & Serializable, V extends A> {@135] EXACT_MATCH\n" + + "src/test01/TestGeneric.java test01.TestGeneric [public class TestGeneric extends Generic<§|Types|§, UClass, VClass> {@112] EXACT_MATCH\n" + + "src/test01/TestGeneric.java test01.TestGeneric.test [ TestGeneric<§|Types|§> test;@150] EXACT_MATCH\n" + + "src/test01/TestGeneric.java TestGeneric test01.TestGeneric.foo(TestGeneric, Comparable) [ TestGeneric foo(TestGeneric<§|Types|§> param1, Comparable param2) {@200] EXACT_MATCH\n" + + "src/test01/TestGeneric.java Comparable> test01.TestGeneric.bar() [ Comparable> bar() {@287] EXACT_MATCH\n" + + "src/test01/TestGeneric.java test01.UClass [class UClass extends Types implements Comparable<§|Types|§>, Serializable {@373] EXACT_MATCH\n" + + "src/test01/TestGeneric.java test01.VClass [class VClass extends A<§|Types|§> {}@519] EXACT_MATCH" + ); +} +public void testTypeRefGeneric01_TypeVariableBound() throws CoreException { + search(setUpTypeRefGeneric01(), TYPE_VARIABLE_BOUND_TYPE_REFERENCE); + assertSearchResults( + "src/test01/Generic.java test01.Generic [public class Generic & Serializable, V extends A> {@99] EXACT_MATCH\n" + + "src/test01/Generic.java test01.Generic [public class Generic & Serializable, V extends A> {@116] EXACT_MATCH" + ); +} +public void testTypeRefGeneric01_WildcardBound() throws CoreException { + search(setUpTypeRefGeneric01(), WILDCARD_BOUND_TYPE_REFERENCE); + assertSearchResults( + "src/test01/Generic.java test01.Generic [public class Generic & Serializable, V extends A> {@178] EXACT_MATCH\n" + + "src/test01/Generic.java test01.Generic.field [ Generic field;@207] EXACT_MATCH" + ); +} +public void testTypeRefGenericAll01() throws CoreException { + setUpTypeRefGeneric01(); + search("*", TYPE, REFERENCES, getJavaSearchWorkingCopiesScope()); + assertSearchResults( + "src/test01/Generic.java [import §|java.io.Serializable|§;@23] EXACT_MATCH\n" + + "src/test01/Generic.java [import §|type.def.Types|§;@52] EXACT_MATCH\n" + + "src/test01/Generic.java test01.Generic [public class Generic & Serializable, V extends A> {@99] EXACT_MATCH\n" + + "src/test01/Generic.java test01.Generic [public class Generic & Serializable, V extends A> {@116] EXACT_MATCH\n" + + "src/test01/Generic.java test01.Generic [public class Generic & Serializable, V extends A> {@124] EXACT_MATCH\n" + + "src/test01/Generic.java test01.Generic [public class Generic & Serializable, V extends A> {@135] EXACT_MATCH\n" + + "src/test01/Generic.java test01.Generic [public class Generic & §|Serializable|§, V extends A> {@144] EXACT_MATCH\n" + + "src/test01/Generic.java test01.Generic [public class Generic & Serializable, V extends §|A|§> {@168] EXACT_MATCH\n" + + "src/test01/Generic.java test01.Generic [public class Generic & Serializable, V extends A> {@178] EXACT_MATCH\n" + + "src/test01/Generic.java test01.Generic.field [ §|Generic|§ field;@189] EXACT_MATCH\n" + + "src/test01/Generic.java test01.Generic.field [ Generic field;@207] EXACT_MATCH\n" + + "src/test01/Generic.java test01.Generic.comp [ §|Comparable|§ comp;@228] EXACT_MATCH\n" + + "src/test01/Generic.java test01.Generic.comp [ Comparable<§|String|§> comp;@239] EXACT_MATCH\n" + + "src/test01/Generic.java test01.Generic.clazz [ §|Class|§ clazz;@254] EXACT_MATCH\n" + + "src/test01/Generic.java test01.Generic.clazz [ Class clazz;@270] EXACT_MATCH\n" + + "src/test01/TestGeneric.java [import §|java.io.Serializable|§;@23] EXACT_MATCH\n" + + "src/test01/TestGeneric.java [import §|type.def.Types|§;@52] EXACT_MATCH\n" + + "src/test01/TestGeneric.java test01.TestGeneric [public class TestGeneric extends §|Generic|§ {@104] EXACT_MATCH\n" + + "src/test01/TestGeneric.java test01.TestGeneric [public class TestGeneric extends Generic<§|Types|§, UClass, VClass> {@112] EXACT_MATCH\n" + + "src/test01/TestGeneric.java test01.TestGeneric [public class TestGeneric extends Generic {@119] EXACT_MATCH\n" + + "src/test01/TestGeneric.java test01.TestGeneric [public class TestGeneric extends Generic {@127] EXACT_MATCH\n" + + "src/test01/TestGeneric.java test01.TestGeneric.test [ §|TestGeneric|§ test;@138] EXACT_MATCH\n" + + "src/test01/TestGeneric.java test01.TestGeneric.test [ TestGeneric<§|Types|§> test;@150] EXACT_MATCH\n" + + "src/test01/TestGeneric.java TestGeneric test01.TestGeneric.foo(TestGeneric, Comparable) [ §|TestGeneric|§ foo(TestGeneric param1, Comparable param2) {@164] EXACT_MATCH\n" + + "src/test01/TestGeneric.java TestGeneric test01.TestGeneric.foo(TestGeneric, Comparable) [ TestGeneric<§|String|§> foo(TestGeneric param1, Comparable param2) {@176] EXACT_MATCH\n" + + "src/test01/TestGeneric.java TestGeneric test01.TestGeneric.foo(TestGeneric, Comparable) [ TestGeneric foo(§|TestGeneric|§ param1, Comparable param2) {@188] EXACT_MATCH\n" + + "src/test01/TestGeneric.java TestGeneric test01.TestGeneric.foo(TestGeneric, Comparable) [ TestGeneric foo(TestGeneric<§|Types|§> param1, Comparable param2) {@200] EXACT_MATCH\n" + + "src/test01/TestGeneric.java TestGeneric test01.TestGeneric.foo(TestGeneric, Comparable) [ TestGeneric foo(TestGeneric param1, §|Comparable|§ param2) {@215] EXACT_MATCH\n" + + "src/test01/TestGeneric.java TestGeneric test01.TestGeneric.foo(TestGeneric, Comparable) [ TestGeneric foo(TestGeneric param1, Comparable<§|String|§> param2) {@226] EXACT_MATCH\n" + + "src/test01/TestGeneric.java Comparable> test01.TestGeneric.bar() [ §|Comparable|§> bar() {@264] EXACT_MATCH\n" + + "src/test01/TestGeneric.java Comparable> test01.TestGeneric.bar() [ Comparable<§|TestGeneric|§> bar() {@275] EXACT_MATCH\n" + + "src/test01/TestGeneric.java Comparable> test01.TestGeneric.bar() [ Comparable> bar() {@287] EXACT_MATCH\n" + + "src/test01/TestGeneric.java test01.UClass [class UClass extends §|Types|§ implements Comparable, Serializable {@345] EXACT_MATCH\n" + + "src/test01/TestGeneric.java test01.UClass [class UClass extends Types implements §|Comparable|§, Serializable {@362] EXACT_MATCH\n" + + "src/test01/TestGeneric.java test01.UClass [class UClass extends Types implements Comparable<§|Types|§>, Serializable {@373] EXACT_MATCH\n" + + "src/test01/TestGeneric.java test01.UClass [class UClass extends Types implements Comparable, §|Serializable|§ {@381] EXACT_MATCH\n" + + "src/test01/TestGeneric.java test01.UClass.serialVersionUID [ private static final §|long|§ serialVersionUID = 1L;@418] EXACT_MATCH\n" + + "src/test01/TestGeneric.java int test01.UClass.compareTo(Types) [ public §|int|§ compareTo(Types o) {@454] EXACT_MATCH\n" + + "src/test01/TestGeneric.java int test01.UClass.compareTo(Types) [ public int compareTo(§|Types|§ o) {@468] EXACT_MATCH\n" + + "src/test01/TestGeneric.java test01.VClass [class VClass extends §|A|§ {}@517] EXACT_MATCH\n" + + "src/test01/TestGeneric.java test01.VClass [class VClass extends A<§|Types|§> {}@519] EXACT_MATCH" + ); +} +public void testTypeRefGenericAll01_AllGenericFlags() throws CoreException { + setUpTypeRefGeneric01(); + search("*", TYPE, ALL_GENERIC_TYPE_FINE_GRAIN_FLAGS, getJavaSearchWorkingCopiesScope()); + assertSearchResults( + "src/test01/Generic.java test01.Generic [public class Generic & Serializable, V extends A> {@99] EXACT_MATCH\n" + + "src/test01/Generic.java test01.Generic [public class Generic & Serializable, V extends A> {@116] EXACT_MATCH\n" + + "src/test01/Generic.java test01.Generic [public class Generic & Serializable, V extends A> {@124] EXACT_MATCH\n" + + "src/test01/Generic.java test01.Generic [public class Generic & Serializable, V extends A> {@135] EXACT_MATCH\n" + + "src/test01/Generic.java test01.Generic [public class Generic & §|Serializable|§, V extends A> {@144] EXACT_MATCH\n" + + "src/test01/Generic.java test01.Generic [public class Generic & Serializable, V extends §|A|§> {@168] EXACT_MATCH\n" + + "src/test01/Generic.java test01.Generic [public class Generic & Serializable, V extends A> {@178] EXACT_MATCH\n" + + "src/test01/Generic.java test01.Generic.field [ Generic field;@207] EXACT_MATCH\n" + + "src/test01/Generic.java test01.Generic.comp [ Comparable<§|String|§> comp;@239] EXACT_MATCH\n" + + "src/test01/Generic.java test01.Generic.clazz [ Class clazz;@270] EXACT_MATCH\n" + + "src/test01/TestGeneric.java test01.TestGeneric [public class TestGeneric extends Generic<§|Types|§, UClass, VClass> {@112] EXACT_MATCH\n" + + "src/test01/TestGeneric.java test01.TestGeneric [public class TestGeneric extends Generic {@119] EXACT_MATCH\n" + + "src/test01/TestGeneric.java test01.TestGeneric [public class TestGeneric extends Generic {@127] EXACT_MATCH\n" + + "src/test01/TestGeneric.java test01.TestGeneric.test [ TestGeneric<§|Types|§> test;@150] EXACT_MATCH\n" + + "src/test01/TestGeneric.java TestGeneric test01.TestGeneric.foo(TestGeneric, Comparable) [ TestGeneric<§|String|§> foo(TestGeneric param1, Comparable param2) {@176] EXACT_MATCH\n" + + "src/test01/TestGeneric.java TestGeneric test01.TestGeneric.foo(TestGeneric, Comparable) [ TestGeneric foo(TestGeneric<§|Types|§> param1, Comparable param2) {@200] EXACT_MATCH\n" + + "src/test01/TestGeneric.java TestGeneric test01.TestGeneric.foo(TestGeneric, Comparable) [ TestGeneric foo(TestGeneric param1, Comparable<§|String|§> param2) {@226] EXACT_MATCH\n" + + "src/test01/TestGeneric.java Comparable> test01.TestGeneric.bar() [ Comparable<§|TestGeneric|§> bar() {@275] EXACT_MATCH\n" + + "src/test01/TestGeneric.java Comparable> test01.TestGeneric.bar() [ Comparable> bar() {@287] EXACT_MATCH\n" + + "src/test01/TestGeneric.java test01.UClass [class UClass extends Types implements Comparable<§|Types|§>, Serializable {@373] EXACT_MATCH\n" + + "src/test01/TestGeneric.java test01.VClass [class VClass extends A<§|Types|§> {}@519] EXACT_MATCH" + ); +} +public void testTypeRefGenericAll01_Parameterized() throws CoreException { + setUpTypeRefGeneric01(); + search("*", TYPE, PARAMETERIZED_TYPE_REFERENCE, getJavaSearchWorkingCopiesScope()); + assertSearchResults( + "src/test01/Generic.java test01.Generic [public class Generic & Serializable, V extends A> {@135] EXACT_MATCH\n" + + "src/test01/Generic.java test01.Generic.comp [ Comparable<§|String|§> comp;@239] EXACT_MATCH\n" + + "src/test01/TestGeneric.java test01.TestGeneric [public class TestGeneric extends Generic<§|Types|§, UClass, VClass> {@112] EXACT_MATCH\n" + + "src/test01/TestGeneric.java test01.TestGeneric [public class TestGeneric extends Generic {@119] EXACT_MATCH\n" + + "src/test01/TestGeneric.java test01.TestGeneric [public class TestGeneric extends Generic {@127] EXACT_MATCH\n" + + "src/test01/TestGeneric.java test01.TestGeneric.test [ TestGeneric<§|Types|§> test;@150] EXACT_MATCH\n" + + "src/test01/TestGeneric.java TestGeneric test01.TestGeneric.foo(TestGeneric, Comparable) [ TestGeneric<§|String|§> foo(TestGeneric param1, Comparable param2) {@176] EXACT_MATCH\n" + + "src/test01/TestGeneric.java TestGeneric test01.TestGeneric.foo(TestGeneric, Comparable) [ TestGeneric foo(TestGeneric<§|Types|§> param1, Comparable param2) {@200] EXACT_MATCH\n" + + "src/test01/TestGeneric.java TestGeneric test01.TestGeneric.foo(TestGeneric, Comparable) [ TestGeneric foo(TestGeneric param1, Comparable<§|String|§> param2) {@226] EXACT_MATCH\n" + + "src/test01/TestGeneric.java Comparable> test01.TestGeneric.bar() [ Comparable<§|TestGeneric|§> bar() {@275] EXACT_MATCH\n" + + "src/test01/TestGeneric.java Comparable> test01.TestGeneric.bar() [ Comparable> bar() {@287] EXACT_MATCH\n" + + "src/test01/TestGeneric.java test01.UClass [class UClass extends Types implements Comparable<§|Types|§>, Serializable {@373] EXACT_MATCH\n" + + "src/test01/TestGeneric.java test01.VClass [class VClass extends A<§|Types|§> {}@519] EXACT_MATCH" + ); +} +public void testTypeRefGenericAll01_TypeVariableBound() throws CoreException { + setUpTypeRefGeneric01(); + search("*", TYPE, TYPE_VARIABLE_BOUND_TYPE_REFERENCE, getJavaSearchWorkingCopiesScope()); + assertSearchResults( + "src/test01/Generic.java test01.Generic [public class Generic & Serializable, V extends A> {@99] EXACT_MATCH\n" + + "src/test01/Generic.java test01.Generic [public class Generic & Serializable, V extends A> {@116] EXACT_MATCH\n" + + "src/test01/Generic.java test01.Generic [public class Generic & Serializable, V extends A> {@124] EXACT_MATCH\n" + + "src/test01/Generic.java test01.Generic [public class Generic & §|Serializable|§, V extends A> {@144] EXACT_MATCH\n" + + "src/test01/Generic.java test01.Generic [public class Generic & Serializable, V extends §|A|§> {@168] EXACT_MATCH" + ); +} +public void testTypeRefGenericAll01_WildcardBound() throws CoreException { + setUpTypeRefGeneric01(); + search("*", TYPE, WILDCARD_BOUND_TYPE_REFERENCE, getJavaSearchWorkingCopiesScope()); + assertSearchResults( + "src/test01/Generic.java test01.Generic [public class Generic & Serializable, V extends A> {@178] EXACT_MATCH\n" + + "src/test01/Generic.java test01.Generic.field [ Generic field;@207] EXACT_MATCH\n" + + "src/test01/Generic.java test01.Generic.clazz [ Class clazz;@270] EXACT_MATCH" + ); +} +/* + * Same test than previous ones with another example + */ +private IType setUpTypeRefGeneric02() throws JavaModelException { + final ProblemRequestor problemRequestor = new ProblemRequestor(); + this.wcOwner = new WorkingCopyOwner() { + public IProblemRequestor getProblemRequestor(ICompilationUnit workingCopy) { + return problemRequestor; + } + }; + workingCopies = new ICompilationUnit[1]; + workingCopies[0] = getWorkingCopy("/JavaSearch15/src/test02/Test.java", + "package test02;\n" + + "public class Test {\n" + + " Test field = new Test, X> () {\n" + + " X x;\n" + + " Test t;\n" + + " Test>>, Y>, Z> bar() {\n" + + " return new Test>>, Y>, Z>();\n" + + " }\n" + + " };\n" + + " Test foo(Test param) {\n" + + " return null;\n" + + " };\n" + + "}\n" + + "class A {}\n" + + "class B {}\n" + + "class C extends X {}\n" + + "class X {}\n" + + "class Y extends A {}\n" + + "class Z

extends B {}\n" + + "\n" + ); + assertEquals("CU Should not have any problem!", + "----------\n" + + "----------\n", + problemRequestor.problems.toString() + ); + this.resultCollector.showSelection = true; + this.resultCollector.showOffset = true; + return workingCopies[0].getType("Types"); +} +public void testTypeRefGenericAll02() throws CoreException { + setUpTypeRefGeneric02(); + search("*", TYPE, REFERENCES, getJavaSearchWorkingCopiesScope()); + assertSearchResults( + "src/test02/Test.java test02.Test.field:#1 [ Test field = new §|Test|§, X> () {@91] EXACT_MATCH\n" + + "src/test02/Test.java test02.Test.field:#1.x [ §|X|§ x;@128] EXACT_MATCH\n" + + "src/test02/Test.java test02.Test.field:#1.x [ X<§|String|§> x;@130] EXACT_MATCH\n" + + "src/test02/Test.java test02.Test.field:#1.t [ §|Test|§ t;@143] EXACT_MATCH\n" + + "src/test02/Test.java test02.Test.field:#1.t [ Test<§|A|§, B, C> t;@148] EXACT_MATCH\n" + + "src/test02/Test.java test02.Test.field:#1.t [ Test t;@151] EXACT_MATCH\n" + + "src/test02/Test.java test02.Test.field:#1.t [ Test t;@154] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ §|Test|§>>, Y>, Z> bar() {@162] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ Test<§|X|§>>, Y>, Z> bar() {@167] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ Test>>, Y>, Z> bar() {@169] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ Test>>, Y>, Z> bar() {@171] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ Test>>, Y>, Z> bar() {@173] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ Test>>, §|Y|§>, Z> bar() {@184] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ Test>>, Y<§|Z|§>, Z> bar() {@186] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ Test>>, Y>, Z> bar() {@188] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ Test>>, Y>, §|Z|§> bar() {@198] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ Test>>, Y>, Z<§|String|§>> bar() {@200] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ return new §|Test|§>>, Y>, Z>();@231] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ return new Test<§|X|§>>, Y>, Z>();@236] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ return new Test>>, Y>, Z>();@238] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ return new Test>>, Y>, Z>();@240] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ return new Test>>, Y>, Z>();@242] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ return new Test>>, §|Y|§>, Z>();@253] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ return new Test>>, Y<§|Z|§>, Z>();@255] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ return new Test>>, Y>, Z>();@257] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ return new Test>>, Y>, §|Z|§>();@267] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ return new Test>>, Y>, Z<§|String|§>>();@269] EXACT_MATCH\n" + + "src/test02/Test.java test02.Test.field [ §|Test|§ field = new Test, X> () {@47] EXACT_MATCH\n" + + "src/test02/Test.java test02.Test.field [ Test<§|A|§, ? extends B, ? super C> field = new Test, X> () {@52] EXACT_MATCH\n" + + "src/test02/Test.java test02.Test.field [ Test field = new Test, X> () {@65] EXACT_MATCH\n" + + "src/test02/Test.java test02.Test.field [ Test field = new Test, X> () {@76] EXACT_MATCH\n" + + "src/test02/Test.java test02.Test.field [ Test field = new Test<§|A|§, Z, X> () {@96] EXACT_MATCH\n" + + "src/test02/Test.java test02.Test.field [ Test field = new Test, X> () {@99] EXACT_MATCH\n" + + "src/test02/Test.java test02.Test.field [ Test field = new Test, X> () {@101] EXACT_MATCH\n" + + "src/test02/Test.java test02.Test.field [ Test field = new Test, §|X|§> () {@110] EXACT_MATCH\n" + + "src/test02/Test.java test02.Test.field [ Test field = new Test, X<§|String|§>> () {@112] EXACT_MATCH\n" + + "src/test02/Test.java Test test02.Test.foo(Test) [ §|Test|§ foo(Test param) {@290] EXACT_MATCH\n" + + "src/test02/Test.java Test test02.Test.foo(Test) [ Test foo(Test param) {@303] EXACT_MATCH\n" + + "src/test02/Test.java Test test02.Test.foo(Test) [ Test foo(Test param) {@306] EXACT_MATCH\n" + + "src/test02/Test.java Test test02.Test.foo(Test) [ Test foo(Test param) {@319] EXACT_MATCH\n" + + "src/test02/Test.java Test test02.Test.foo(Test) [ Test foo(§|Test|§ param) {@326] EXACT_MATCH\n" + + "src/test02/Test.java Test test02.Test.foo(Test) [ Test foo(Test param) {@341] EXACT_MATCH\n" + + "src/test02/Test.java Test test02.Test.foo(Test) [ Test foo(Test param) {@352] EXACT_MATCH\n" + + "src/test02/Test.java Test test02.Test.foo(Test) [ Test foo(Test param) {@355] EXACT_MATCH\n" + + "src/test02/Test.java test02.C [class C extends §|X|§ {}@426] EXACT_MATCH\n" + + "src/test02/Test.java test02.C [class C extends X<§|String|§> {}@428] EXACT_MATCH\n" + + "src/test02/Test.java test02.Y [class Y extends §|A|§ {}@472] EXACT_MATCH\n" + + "src/test02/Test.java test02.Z [class Z

extends §|B|§ {}@496] EXACT_MATCH" + ); +} +public void testTypeRefGenericAll02_AllGenericFlags() throws CoreException { + setUpTypeRefGeneric02(); + search("*", TYPE, ALL_GENERIC_TYPE_FINE_GRAIN_FLAGS, getJavaSearchWorkingCopiesScope()); + assertSearchResults( + "src/test02/Test.java test02.Test.field:#1.x [ X<§|String|§> x;@130] EXACT_MATCH\n" + + "src/test02/Test.java test02.Test.field:#1.t [ Test<§|A|§, B, C> t;@148] EXACT_MATCH\n" + + "src/test02/Test.java test02.Test.field:#1.t [ Test t;@151] EXACT_MATCH\n" + + "src/test02/Test.java test02.Test.field:#1.t [ Test t;@154] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ Test<§|X|§>>, Y>, Z> bar() {@167] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ Test>>, Y>, Z> bar() {@169] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ Test>>, Y>, Z> bar() {@171] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ Test>>, Y>, Z> bar() {@173] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ Test>>, §|Y|§>, Z> bar() {@184] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ Test>>, Y<§|Z|§>, Z> bar() {@186] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ Test>>, Y>, Z> bar() {@188] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ Test>>, Y>, §|Z|§> bar() {@198] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ Test>>, Y>, Z<§|String|§>> bar() {@200] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ return new Test<§|X|§>>, Y>, Z>();@236] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ return new Test>>, Y>, Z>();@238] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ return new Test>>, Y>, Z>();@240] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ return new Test>>, Y>, Z>();@242] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ return new Test>>, §|Y|§>, Z>();@253] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ return new Test>>, Y<§|Z|§>, Z>();@255] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ return new Test>>, Y>, Z>();@257] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ return new Test>>, Y>, §|Z|§>();@267] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ return new Test>>, Y>, Z<§|String|§>>();@269] EXACT_MATCH\n" + + "src/test02/Test.java test02.Test.field [ Test<§|A|§, ? extends B, ? super C> field = new Test, X> () {@52] EXACT_MATCH\n" + + "src/test02/Test.java test02.Test.field [ Test field = new Test, X> () {@65] EXACT_MATCH\n" + + "src/test02/Test.java test02.Test.field [ Test field = new Test, X> () {@76] EXACT_MATCH\n" + + "src/test02/Test.java test02.Test.field [ Test field = new Test<§|A|§, Z, X> () {@96] EXACT_MATCH\n" + + "src/test02/Test.java test02.Test.field [ Test field = new Test, X> () {@99] EXACT_MATCH\n" + + "src/test02/Test.java test02.Test.field [ Test field = new Test, X> () {@101] EXACT_MATCH\n" + + "src/test02/Test.java test02.Test.field [ Test field = new Test, §|X|§> () {@110] EXACT_MATCH\n" + + "src/test02/Test.java test02.Test.field [ Test field = new Test, X<§|String|§>> () {@112] EXACT_MATCH\n" + + "src/test02/Test.java Test test02.Test.foo(Test) [ Test foo(Test param) {@303] EXACT_MATCH\n" + + "src/test02/Test.java Test test02.Test.foo(Test) [ Test foo(Test param) {@306] EXACT_MATCH\n" + + "src/test02/Test.java Test test02.Test.foo(Test) [ Test foo(Test param) {@319] EXACT_MATCH\n" + + "src/test02/Test.java Test test02.Test.foo(Test) [ Test foo(Test param) {@341] EXACT_MATCH\n" + + "src/test02/Test.java Test test02.Test.foo(Test) [ Test foo(Test param) {@352] EXACT_MATCH\n" + + "src/test02/Test.java Test test02.Test.foo(Test) [ Test foo(Test param) {@355] EXACT_MATCH\n" + + "src/test02/Test.java test02.C [class C extends X<§|String|§> {}@428] EXACT_MATCH" + ); +} +public void testTypeRefGenericAll02_Parameterizedl() throws CoreException { + setUpTypeRefGeneric02(); + search("*", TYPE, PARAMETERIZED_TYPE_REFERENCE, getJavaSearchWorkingCopiesScope()); + assertSearchResults( + "src/test02/Test.java test02.Test.field:#1.x [ X<§|String|§> x;@130] EXACT_MATCH\n" + + "src/test02/Test.java test02.Test.field:#1.t [ Test<§|A|§, B, C> t;@148] EXACT_MATCH\n" + + "src/test02/Test.java test02.Test.field:#1.t [ Test t;@151] EXACT_MATCH\n" + + "src/test02/Test.java test02.Test.field:#1.t [ Test t;@154] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ Test<§|X|§>>, Y>, Z> bar() {@167] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ Test>>, Y>, Z> bar() {@169] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ Test>>, Y>, Z> bar() {@171] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ Test>>, Y>, Z> bar() {@173] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ Test>>, §|Y|§>, Z> bar() {@184] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ Test>>, Y<§|Z|§>, Z> bar() {@186] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ Test>>, Y>, Z> bar() {@188] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ Test>>, Y>, §|Z|§> bar() {@198] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ Test>>, Y>, Z<§|String|§>> bar() {@200] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ return new Test<§|X|§>>, Y>, Z>();@236] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ return new Test>>, Y>, Z>();@238] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ return new Test>>, Y>, Z>();@240] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ return new Test>>, Y>, Z>();@242] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ return new Test>>, §|Y|§>, Z>();@253] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ return new Test>>, Y<§|Z|§>, Z>();@255] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ return new Test>>, Y>, Z>();@257] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ return new Test>>, Y>, §|Z|§>();@267] EXACT_MATCH\n" + + "src/test02/Test.java Test>>,Y>,Z> test02.Test.field:#1.bar() [ return new Test>>, Y>, Z<§|String|§>>();@269] EXACT_MATCH\n" + + "src/test02/Test.java test02.Test.field [ Test<§|A|§, ? extends B, ? super C> field = new Test, X> () {@52] EXACT_MATCH\n" + + "src/test02/Test.java test02.Test.field [ Test field = new Test<§|A|§, Z, X> () {@96] EXACT_MATCH\n" + + "src/test02/Test.java test02.Test.field [ Test field = new Test, X> () {@99] EXACT_MATCH\n" + + "src/test02/Test.java test02.Test.field [ Test field = new Test, X> () {@101] EXACT_MATCH\n" + + "src/test02/Test.java test02.Test.field [ Test field = new Test, §|X|§> () {@110] EXACT_MATCH\n" + + "src/test02/Test.java test02.Test.field [ Test field = new Test, X<§|String|§>> () {@112] EXACT_MATCH\n" + + "src/test02/Test.java Test test02.Test.foo(Test) [ Test foo(Test param) {@306] EXACT_MATCH\n" + + "src/test02/Test.java Test test02.Test.foo(Test) [ Test foo(Test param) {@355] EXACT_MATCH\n" + + "src/test02/Test.java test02.C [class C extends X<§|String|§> {}@428] EXACT_MATCH" + ); +} +public void testTypeRefGenericAll02_TypeVariableBound() throws CoreException { + setUpTypeRefGeneric02(); + search("*", TYPE, TYPE_VARIABLE_BOUND_TYPE_REFERENCE, getJavaSearchWorkingCopiesScope()); + assertSearchResults(""); +} +public void testTypeRefGenericAll02_WildcardBound() throws CoreException { + setUpTypeRefGeneric02(); + search("*", TYPE, WILDCARD_BOUND_TYPE_REFERENCE, getJavaSearchWorkingCopiesScope()); + assertSearchResults( + "src/test02/Test.java test02.Test.field [ Test field = new Test, X> () {@65] EXACT_MATCH\n" + + "src/test02/Test.java test02.Test.field [ Test field = new Test, X> () {@76] EXACT_MATCH\n" + + "src/test02/Test.java Test test02.Test.foo(Test) [ Test foo(Test param) {@303] EXACT_MATCH\n" + + "src/test02/Test.java Test test02.Test.foo(Test) [ Test foo(Test param) {@319] EXACT_MATCH\n" + + "src/test02/Test.java Test test02.Test.foo(Test) [ Test foo(Test param) {@341] EXACT_MATCH\n" + + "src/test02/Test.java Test test02.Test.foo(Test) [ Test foo(Test param) {@352] EXACT_MATCH" + ); +} + +/* + * References to all qualified types (using '*' string pattern) + */ +private void setUpTypeRefGenericMethod() throws JavaModelException { + final ProblemRequestor problemRequestor = new ProblemRequestor(); + this.wcOwner = new WorkingCopyOwner() { + public IProblemRequestor getProblemRequestor(ICompilationUnit workingCopy) { + return problemRequestor; + } + }; + workingCopies = new ICompilationUnit[1]; + workingCopies[0] = getWorkingCopy("/JavaSearch15/src/test/Test.java", + "package test;\n" + + "public class Test {\n" + + " void foo(A a) {\n" + + " a.foo();\n" + + " a.>foo();\n" + + " }\n" + + "}\n" + + "class A {\n" + + " void foo() {}\n" + + "}\n" + ); + assertEquals("CU Should not have any problem!", + "----------\n" + + "----------\n", + problemRequestor.problems.toString() + ); + this.resultCollector.showSelection = true; + this.resultCollector.showOffset = true; +} +public void testTypeRefGenericMethod_AllGenericFlags() throws CoreException { + setUpTypeRefGenericMethod(); + search("*", TYPE, ALL_GENERIC_TYPE_FINE_GRAIN_FLAGS, getJavaSearchWorkingCopiesScope()); + assertSearchResults( + "src/test/Test.java void test.Test.foo(A) [ void foo(A<§|String|§> a) {@46] EXACT_MATCH\n" + + "src/test/Test.java void test.Test.foo(A) [ a.<§|String|§>foo();@64] EXACT_MATCH\n" + + "src/test/Test.java void test.Test.foo(A) [ a.<§|A|§>foo();@83] EXACT_MATCH\n" + + "src/test/Test.java void test.Test.foo(A) [ a.>foo();@95] EXACT_MATCH" + ); +} +public void testTypeRefGenericMethod_Parameterized() throws CoreException { + setUpTypeRefGenericMethod(); + search("*", TYPE, PARAMETERIZED_TYPE_REFERENCE, getJavaSearchWorkingCopiesScope()); + assertSearchResults( + "src/test/Test.java void test.Test.foo(A) [ void foo(A<§|String|§> a) {@46] EXACT_MATCH\n" + + "src/test/Test.java void test.Test.foo(A) [ a.<§|String|§>foo();@64] EXACT_MATCH\n" + + "src/test/Test.java void test.Test.foo(A) [ a.<§|A|§>foo();@83] EXACT_MATCH" + ); +} +public void testTypeRefGenericMethod_TypeVariableBound() throws CoreException { + setUpTypeRefGenericMethod(); + search("*", TYPE, TYPE_VARIABLE_BOUND_TYPE_REFERENCE, getJavaSearchWorkingCopiesScope()); + assertSearchResults(""); +} +public void testTypeRefGenericMethod_WildcardBound() throws CoreException { + setUpTypeRefGenericMethod(); + search("*", TYPE, WILDCARD_BOUND_TYPE_REFERENCE, getJavaSearchWorkingCopiesScope()); + assertSearchResults( + "src/test/Test.java void test.Test.foo(A) [ a.>foo();@95] EXACT_MATCH" + ); +} + +/* + * References to all qualified types (using '*' string pattern) + */ +private void setUpTypeRefQualifiedAll() throws JavaModelException { + final ProblemRequestor problemRequestor = new ProblemRequestor(); + this.wcOwner = new WorkingCopyOwner() { + public IProblemRequestor getProblemRequestor(ICompilationUnit workingCopy) { + return problemRequestor; + } + }; + workingCopies = new ICompilationUnit[3]; + workingCopies[0] = getWorkingCopy("/JavaSearch15/src/type/def/Types.java", + "package type.def;\n" + + "@Bug\n" + + "@ATest\n" + + "public class Types extends Exception implements ITest1, ITest2 {\n" + + " ITest1 test1;\n" + + " ITest2 test2;\n" + + "}\n" + + "@Bug\n" + + "interface ITest1 {}\n" + + "@ATest\n" + + "interface ITest2 extends ITest1 {}\n" + + "@Bug\n" + + "@ATest\n" + + "enum ETest {}\n" + + "@Bug\n" + + "@interface ATest {}\n" + ); + workingCopies[1] = getWorkingCopy("/JavaSearch15/src/type/def/Bug.java", + "package type.def;\n" + + "public @interface Bug {\n" + + " int num() default 0;\n" + + " String comment() default \"\";\n" + + "}\n" + ); + workingCopies[2] = getWorkingCopy("/JavaSearch15/src/all/types/ref/TestTypes.java", + "package all.types.ref;\n" + + "\n" + + "@type.def.Bug(num=155013)\n" + + "public class TestTypes extends type.def.Types {\n" + + " @type.def.Bug(comment=\"field\")\n" + + " type.def.Types field = new type.def.Types(), local, other = new type.def.Types();\n" + + " {\n" + + " Object o;\n" + + " type.def.Types t;\n" + + " if (this.field == null) {\n" + + " try {\n" + + " t = new TestTypes();\n" + + " } catch (RuntimeException e) {\n" + + " t = new type.def.Types();\n" + + " } \n" + + " } else {\n" + + " o = this.field;\n" + + " t = (type.def.Types) o;\n" + + " }\n" + + " local = t;\n" + + " };\n" + + " @type.def.Bug(comment=\"method\", num=155013)\n" + + " type.def.Types method(type.def.Types param) throws type.def.Types {\n" + + " Object obj = new type.def.Types();\n" + + " type.def.Types local = (type.def.Types) obj;\n" + + " return local;\n" + + " }\n" + + " type.def.Bug bar(type.def.Bug bug) {\n" + + " try {\n" + + " method(this);\n" + + " }\n" + + " catch (type.def.Types ex) {}\n" + + " catch (Exception ex) {}\n" + + " return bug; \n" + + " }\n" + + " // Other types references\n" + + " Object object;\n" + + " String str;\n" + + " TestTypes() throws type.def.Types, RuntimeException {\n" + + " if (this.object instanceof String) {\n" + + " this.str = (String) this.object;\n" + + " } else {\n" + + " this.str = new String();\n" + + " this.object = new Object();\n" + + " }\n" + + " }\n" + + "}\n" + ); + assertEquals("CU Should not have any problem!", + "----------\n" + + "----------\n", + problemRequestor.problems.toString() + ); + this.resultCollector.showSelection = true; + this.resultCollector.showOffset = true; +} +public void testTypeRefQualifiedAll_Allocation() throws CoreException { + setUpTypeRefQualifiedAll(); + search("*", TYPE, ALLOCATION_EXPRESSION_TYPE_REFERENCE, getJavaSearchWorkingCopiesScope()); + assertSearchResults( + "src/all/types/ref/TestTypes.java all.types.ref.TestTypes.field [ type.def.Types field = new §|type.def.Types|§(), local, other = new type.def.Types();@158] EXACT_MATCH\n" + + "src/all/types/ref/TestTypes.java all.types.ref.TestTypes.other [ type.def.Types field = new type.def.Types(), local, other = new §|type.def.Types|§();@195] EXACT_MATCH\n" + + "src/all/types/ref/TestTypes.java all.types.ref.TestTypes.{} [ t = new §|TestTypes|§();@297] EXACT_MATCH\n" + + "src/all/types/ref/TestTypes.java all.types.ref.TestTypes.{} [ t = new §|type.def.Types|§();@356] EXACT_MATCH\n" + + "src/all/types/ref/TestTypes.java type.def.Types all.types.ref.TestTypes.method(type.def.Types) [ Object obj = new §|type.def.Types|§();@591] EXACT_MATCH\n" + + "src/all/types/ref/TestTypes.java all.types.ref.TestTypes() [ this.str = new §|String|§();@1032] EXACT_MATCH\n" + + "src/all/types/ref/TestTypes.java all.types.ref.TestTypes() [ this.object = new §|Object|§();@1063] EXACT_MATCH" + ); +} +public void testTypeRefQualifiedAll_Annotation() throws CoreException { + setUpTypeRefQualifiedAll(); + search("*", TYPE, ANNOTATION_TYPE_REFERENCE, getJavaSearchWorkingCopiesScope()); + assertSearchResults( + "src/all/types/ref/TestTypes.java all.types.ref.TestTypes [@§|type.def.Bug|§(num=155013)@25] EXACT_MATCH\n" + + "src/all/types/ref/TestTypes.java all.types.ref.TestTypes.field [ @§|type.def.Bug|§(comment=\"field\")@100] EXACT_MATCH\n" + + "src/all/types/ref/TestTypes.java type.def.Types all.types.ref.TestTypes.method(type.def.Types) [ @§|type.def.Bug|§(comment=\"method\", num=155013)@460] EXACT_MATCH\n" + + "src/type/def/Types.java type.def.Types [@§|Bug|§@19] EXACT_MATCH\n" + + "src/type/def/Types.java type.def.Types [@§|ATest|§@24] EXACT_MATCH\n" + + "src/type/def/Types.java type.def.ITest1 [@§|Bug|§@128] EXACT_MATCH\n" + + "src/type/def/Types.java type.def.ITest2 [@§|ATest|§@153] EXACT_MATCH\n" + + "src/type/def/Types.java type.def.ETest [@§|Bug|§@195] EXACT_MATCH\n" + + "src/type/def/Types.java type.def.ETest [@§|ATest|§@200] EXACT_MATCH\n" + + "src/type/def/Types.java type.def.ATest [@§|Bug|§@221] EXACT_MATCH" + ); +} +public void testTypeRefQualifiedAll_Cast() throws CoreException { + setUpTypeRefQualifiedAll(); + search("*", TYPE, CAST_TYPE_REFERENCE, getJavaSearchWorkingCopiesScope()); + assertSearchResults( + "src/all/types/ref/TestTypes.java all.types.ref.TestTypes.{} [ t = (§|type.def.Types|§) o;@418] EXACT_MATCH\n" + + "src/all/types/ref/TestTypes.java type.def.Types all.types.ref.TestTypes.method(type.def.Types) [ type.def.Types local = (§|type.def.Types|§) obj;@635] EXACT_MATCH\n" + + "src/all/types/ref/TestTypes.java all.types.ref.TestTypes() [ this.str = (§|String|§) this.object;@982] EXACT_MATCH" + ); +} +public void testTypeRefQualifiedAll_Catch() throws CoreException { + setUpTypeRefQualifiedAll(); + search("*", TYPE, CATCH_TYPE_REFERENCE, getJavaSearchWorkingCopiesScope()); + assertSearchResults( + "src/all/types/ref/TestTypes.java all.types.ref.TestTypes.{} [ } catch (§|RuntimeException|§ e) {@322] EXACT_MATCH\n" + + "src/all/types/ref/TestTypes.java type.def.Bug all.types.ref.TestTypes.bar(type.def.Bug) [ catch (§|type.def.Types|§ ex) {}@751] EXACT_MATCH\n" + + "src/all/types/ref/TestTypes.java type.def.Bug all.types.ref.TestTypes.bar(type.def.Bug) [ catch (§|Exception|§ ex) {}@782] EXACT_MATCH" + ); +} +public void testTypeRefQualifiedAll_Field() throws CoreException { + setUpTypeRefQualifiedAll(); + search("*", TYPE, FIELD_TYPE_DECLARATION_TYPE_REFERENCE, getJavaSearchWorkingCopiesScope()); + assertSearchResults( + "src/all/types/ref/TestTypes.java all.types.ref.TestTypes.field [ §|type.def.Types|§ field = new type.def.Types(), local, other = new type.def.Types();@131] EXACT_MATCH\n" + + "src/all/types/ref/TestTypes.java all.types.ref.TestTypes.object [ §|Object|§ object;@845] EXACT_MATCH\n" + + "src/all/types/ref/TestTypes.java all.types.ref.TestTypes.str [ §|String|§ str;@861] EXACT_MATCH\n" + + "src/type/def/Types.java type.def.Types.test1 [ §|ITest1|§ test1;@96] EXACT_MATCH\n" + + "src/type/def/Types.java type.def.Types.test2 [ §|ITest2|§ test2;@111] EXACT_MATCH" + ); +} +public void testTypeRefQualifiedAll_Import() throws CoreException { + setUpTypeRefQualifiedAll(); + search("*", TYPE, IMPORT_DECLARATION_TYPE_REFERENCE, getJavaSearchWorkingCopiesScope()); + assertSearchResults(""); +} +public void testTypeRefQualifiedAll_MethodParameter() throws CoreException { + setUpTypeRefQualifiedAll(); + search("*", TYPE, PARAMETER_TYPE_DECLARATION_TYPE_REFERENCE, getJavaSearchWorkingCopiesScope()); + assertSearchResults( + "src/all/types/ref/TestTypes.java type.def.Types all.types.ref.TestTypes.method(type.def.Types) [ type.def.Types method(§|type.def.Types|§ param) throws type.def.Types {@526] EXACT_MATCH\n" + + "src/all/types/ref/TestTypes.java type.def.Bug all.types.ref.TestTypes.bar(type.def.Bug) [ type.def.Bug bar(§|type.def.Bug|§ bug) {@693] EXACT_MATCH" + ); +} +public void testTypeRefQualifiedAll_Return() throws CoreException { + setUpTypeRefQualifiedAll(); + search("*", TYPE, RETURN_TYPE_REFERENCE, getJavaSearchWorkingCopiesScope()); + assertSearchResults( + "src/all/types/ref/TestTypes.java type.def.Types all.types.ref.TestTypes.method(type.def.Types) [ §|type.def.Types|§ method(type.def.Types param) throws type.def.Types {@504] EXACT_MATCH\n" + + "src/all/types/ref/TestTypes.java type.def.Bug all.types.ref.TestTypes.bar(type.def.Bug) [ §|type.def.Bug|§ bar(type.def.Bug bug) {@676] EXACT_MATCH" + ); +} +public void testTypeRefQualifiedAll_Superinterface() throws CoreException { + setUpTypeRefQualifiedAll(); + search("*", TYPE, SUPERINTERFACE_TYPE_REFERENCE, getJavaSearchWorkingCopiesScope()); + assertSearchResults( + "src/type/def/Types.java type.def.Types [public class Types extends Exception implements §|ITest1|§, ITest2 {@78] EXACT_MATCH\n" + + "src/type/def/Types.java type.def.Types [public class Types extends Exception implements ITest1, §|ITest2|§ {@86] EXACT_MATCH\n" + + "src/type/def/Types.java type.def.ITest2 [interface ITest2 extends §|ITest1|§ {}@184] EXACT_MATCH" + ); +} +public void testTypeRefQualifiedAll_Supertype() throws CoreException { + setUpTypeRefQualifiedAll(); + search("*", TYPE, SUPERTYPE_TYPE_REFERENCE, getJavaSearchWorkingCopiesScope()); + assertSearchResults( + "src/all/types/ref/TestTypes.java all.types.ref.TestTypes [public class TestTypes extends §|type.def.Types|§ {@81] EXACT_MATCH\n" + + "src/type/def/Types.java type.def.Types [public class Types extends §|Exception|§ implements ITest1, ITest2 {@57] EXACT_MATCH" + ); +} +public void testTypeRefQualifiedAll_Throws() throws CoreException { + setUpTypeRefQualifiedAll(); + search("*", TYPE, THROWS_CLAUSE_TYPE_REFERENCE, getJavaSearchWorkingCopiesScope()); + assertSearchResults( + "src/all/types/ref/TestTypes.java type.def.Types all.types.ref.TestTypes.method(type.def.Types) [ type.def.Types method(type.def.Types param) throws §|type.def.Types|§ {@555] EXACT_MATCH\n" + + "src/all/types/ref/TestTypes.java all.types.ref.TestTypes() [ TestTypes() throws §|type.def.Types|§, RuntimeException {@893] EXACT_MATCH\n" + + "src/all/types/ref/TestTypes.java all.types.ref.TestTypes() [ TestTypes() throws type.def.Types, §|RuntimeException|§ {@909] EXACT_MATCH" + ); +} +public void testTypeRefQualifiedAll_Variable() throws CoreException { + setUpTypeRefQualifiedAll(); + search("*", TYPE, LOCAL_VARIABLE_DECLARATION_TYPE_REFERENCE, getJavaSearchWorkingCopiesScope()); + assertSearchResults( + "src/all/types/ref/TestTypes.java all.types.ref.TestTypes.{} [ §|Object|§ o;@218] EXACT_MATCH\n" + + "src/all/types/ref/TestTypes.java all.types.ref.TestTypes.{} [ §|type.def.Types|§ t;@230] EXACT_MATCH\n" + + "src/all/types/ref/TestTypes.java type.def.Types all.types.ref.TestTypes.method(type.def.Types) [ §|Object|§ obj = new type.def.Types();@574] EXACT_MATCH\n" + + "src/all/types/ref/TestTypes.java type.def.Types all.types.ref.TestTypes.method(type.def.Types) [ §|type.def.Types|§ local = (type.def.Types) obj;@611] EXACT_MATCH" + ); +} + +/* + * Tests using classes defined in JavaSearch15 project + */ +public void testTypeRefGenericAllG1_Parameterized() throws CoreException { + IType type = getCompilationUnit("JavaSearch15/src/g1/t/s/ref/R3.java").getType("R3"); + IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] { type }); + search("*", TYPE, PARAMETERIZED_TYPE_REFERENCE, scope); + assertSearchResults( + "src/g1/t/s/ref/R3.java g1.t.s.ref.R3.gen_obj [ public Generic<§|Object|§>.MemberGeneric gen_obj;@393] EXACT_MATCH\n" + + "src/g1/t/s/ref/R3.java g1.t.s.ref.R3.gen_obj [ public Generic.MemberGeneric<§|Object|§> gen_obj;@415] EXACT_MATCH\n" + + "src/g1/t/s/ref/R3.java g1.t.s.ref.R3.gen_exc [ public Generic<§|Exception|§>.MemberGeneric gen_exc;@448] EXACT_MATCH\n" + + "src/g1/t/s/ref/R3.java g1.t.s.ref.R3.gen_exc [ public Generic.MemberGeneric<§|Exception|§> gen_exc;@473] EXACT_MATCH\n" + + "src/g1/t/s/ref/R3.java g1.t.s.ref.R3.qgen_obj [ public g1.t.s.def.Generic<§|Object|§>.MemberGeneric qgen_obj;@803] EXACT_MATCH\n" + + "src/g1/t/s/ref/R3.java g1.t.s.ref.R3.qgen_obj [ public g1.t.s.def.Generic.MemberGeneric<§|Object|§> qgen_obj;@825] EXACT_MATCH\n" + + "src/g1/t/s/ref/R3.java g1.t.s.ref.R3.qgen_exc [ public g1.t.s.def.Generic<§|Exception|§>.MemberGeneric qgen_exc;@870] EXACT_MATCH\n" + + "src/g1/t/s/ref/R3.java g1.t.s.ref.R3.qgen_exc [ public g1.t.s.def.Generic.MemberGeneric<§|Exception|§> qgen_exc;@895] EXACT_MATCH" + ); +} +public void testTypeRefGenericAllG1_WildcardBounds() throws CoreException { + IType type = getCompilationUnit("JavaSearch15/src/g1/t/s/ref/R3.java").getType("R3"); + IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] { type }); + search("*", TYPE, WILDCARD_BOUND_TYPE_REFERENCE, scope); + assertSearchResults( + "src/g1/t/s/ref/R3.java g1.t.s.ref.R3.gen_thr [ public Generic.MemberGeneric gen_thr;@564] EXACT_MATCH\n" + + "src/g1/t/s/ref/R3.java g1.t.s.ref.R3.gen_thr [ public Generic.MemberGeneric gen_thr;@597] EXACT_MATCH\n" + + "src/g1/t/s/ref/R3.java g1.t.s.ref.R3.gen_run [ public Generic.MemberGeneric gen_run;@648] EXACT_MATCH\n" + + "src/g1/t/s/ref/R3.java g1.t.s.ref.R3.gen_run [ public Generic.MemberGeneric gen_run;@690] EXACT_MATCH\n" + + "src/g1/t/s/ref/R3.java g1.t.s.ref.R3.qgen_thr [ public g1.t.s.def.Generic.MemberGeneric qgen_thr;@1010] EXACT_MATCH\n" + + "src/g1/t/s/ref/R3.java g1.t.s.ref.R3.qgen_thr [ public g1.t.s.def.Generic.MemberGeneric qgen_thr;@1043] EXACT_MATCH\n" + + "src/g1/t/s/ref/R3.java g1.t.s.ref.R3.qgen_run [ public g1.t.s.def.Generic.MemberGeneric qgen_run;@1106] EXACT_MATCH\n" + + "src/g1/t/s/ref/R3.java g1.t.s.ref.R3.qgen_run [ public g1.t.s.def.Generic.MemberGeneric qgen_run;@1148] EXACT_MATCH" + ); +} +public void testTypeRefGenericAllG2_Parameterized() throws CoreException { + // TODO The JavaSearch15/src/g2/f/s/def/R3.java should be updated as it contains compilation errors! + IType type = getCompilationUnit("JavaSearch15/src/g2/f/s/def/R3.java").getType("R3"); + IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] { type }); + search("*", TYPE, PARAMETERIZED_TYPE_REFERENCE, scope); + assertSearchResults( + "src/g2/f/s/def/R3.java g2.f.s.def.R3.{} [ Generic<§|Object|§>.MemberGeneric member = new Generic().new MemberGeneric();@177] EXACT_MATCH\n" + + "src/g2/f/s/def/R3.java g2.f.s.def.R3.{} [ Generic.MemberGeneric<§|Object|§> member = new Generic().new MemberGeneric();@199] EXACT_MATCH\n" + + "src/g2/f/s/def/R3.java g2.f.s.def.R3.{} [ Generic.MemberGeneric member = new Generic<§|Object|§>().new MemberGeneric();@228] EXACT_MATCH\n" + + "src/g2/f/s/def/R3.java g2.f.s.def.R3.{} [ Generic.MemberGeneric member = new Generic().new MemberGeneric<§|Object|§>();@256] EXACT_MATCH\n" + + "src/g2/f/s/def/R3.java g2.f.s.def.R3.{} [ Generic<§|Exception|§>.MemberGeneric member = new Generic().new MemberGeneric();@306] EXACT_MATCH\n" + + "src/g2/f/s/def/R3.java g2.f.s.def.R3.{} [ Generic.MemberGeneric<§|Exception|§> member = new Generic().new MemberGeneric();@331] EXACT_MATCH\n" + + "src/g2/f/s/def/R3.java g2.f.s.def.R3.{} [ Generic.MemberGeneric member = new Generic<§|Exception|§>().new MemberGeneric();@363] EXACT_MATCH\n" + + "src/g2/f/s/def/R3.java g2.f.s.def.R3.{} [ Generic.MemberGeneric member = new Generic().new MemberGeneric<§|Exception|§>();@394] EXACT_MATCH\n" + + "src/g2/f/s/def/R3.java g2.f.s.def.R3.{} [ Generic.MemberGeneric member = new Generic<§|Exception|§>().new MemberGeneric();@633] EXACT_MATCH\n" + + "src/g2/f/s/def/R3.java g2.f.s.def.R3.{} [ Generic.MemberGeneric member = new Generic().new MemberGeneric<§|Exception|§>();@664] EXACT_MATCH\n" + + "src/g2/f/s/def/R3.java g2.f.s.def.R3.{} [ Generic.MemberGeneric member = new Generic<§|Exception|§>().new MemberGeneric();@794] EXACT_MATCH\n" + + "src/g2/f/s/def/R3.java g2.f.s.def.R3.{} [ Generic.MemberGeneric member = new Generic().new MemberGeneric<§|Exception|§>();@1006] EXACT_MATCH\n" + + "src/g2/f/s/def/R3.java g2.f.s.def.R3.{} [ Generic.MemberGeneric member = new Generic<§|Exception|§>().new MemberGeneric();@1327] EXACT_MATCH\n" + + "src/g2/f/s/def/R3.java g2.f.s.def.R3.{} [ Generic.MemberGeneric member = new Generic().new MemberGeneric<§|Exception|§>();@1358] EXACT_MATCH\n" + + "src/g2/f/s/def/R3.java g2.f.s.def.R3.{} [ Generic.MemberGeneric member = new Generic<§|Exception|§>().new MemberGeneric();@1498] EXACT_MATCH\n" + + "src/g2/f/s/def/R3.java g2.f.s.def.R3.{} [ Generic.MemberGeneric member = new Generic().new MemberGeneric<§|Exception|§>();@1730] EXACT_MATCH" + ); +} +public void testTypeRefGenericAllG2_WildcardBounds() throws CoreException { + // TODO The JavaSearch15/src/g2/f/s/def/R3.java should be updated as it contains compilation errors! + IType type = getCompilationUnit("JavaSearch15/src/g2/f/s/def/R3.java").getType("R3"); + IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] { type }); + search("*", TYPE, WILDCARD_BOUND_TYPE_REFERENCE, scope); + assertSearchResults( + "src/g2/f/s/def/R3.java g2.f.s.def.R3.{} [ Generic.MemberGeneric member = new Generic().new MemberGeneric();@566] EXACT_MATCH\n" + + "src/g2/f/s/def/R3.java g2.f.s.def.R3.{} [ Generic.MemberGeneric member = new Generic().new MemberGeneric();@601] EXACT_MATCH\n" + + "src/g2/f/s/def/R3.java g2.f.s.def.R3.{} [ Generic.MemberGeneric member = new Generic().new MemberGeneric();@727] EXACT_MATCH\n" + + "src/g2/f/s/def/R3.java g2.f.s.def.R3.{} [ Generic.MemberGeneric member = new Generic().new MemberGeneric();@762] EXACT_MATCH\n" + + "src/g2/f/s/def/R3.java g2.f.s.def.R3.{} [ Generic.MemberGeneric member = new Generic().new MemberGeneric();@835] EXACT_MATCH\n" + + "src/g2/f/s/def/R3.java g2.f.s.def.R3.{} [ Generic.MemberGeneric member = new Generic().new MemberGeneric();@898] EXACT_MATCH\n" + + "src/g2/f/s/def/R3.java g2.f.s.def.R3.{} [ Generic.MemberGeneric member = new Generic().new MemberGeneric();@933] EXACT_MATCH\n" + + "src/g2/f/s/def/R3.java g2.f.s.def.R3.{} [ Generic.MemberGeneric member = new Generic().new MemberGeneric();@975] EXACT_MATCH\n" + + "src/g2/f/s/def/R3.java g2.f.s.def.R3.{} [ Generic.MemberGeneric member = new Generic().new MemberGeneric();@1069] EXACT_MATCH\n" + + "src/g2/f/s/def/R3.java g2.f.s.def.R3.{} [ Generic.MemberGeneric member = new Generic().new MemberGeneric();@1104] EXACT_MATCH\n" + + "src/g2/f/s/def/R3.java g2.f.s.def.R3.{} [ Generic.MemberGeneric member = new Generic().new MemberGeneric();@1146] EXACT_MATCH\n" + + "src/g2/f/s/def/R3.java g2.f.s.def.R3.{} [ Generic.MemberGeneric member = new Generic().new MemberGeneric();@1187] EXACT_MATCH\n" + + "src/g2/f/s/def/R3.java g2.f.s.def.R3.{} [ Generic.MemberGeneric member = new Generic().new MemberGeneric();@1248] EXACT_MATCH\n" + + "src/g2/f/s/def/R3.java g2.f.s.def.R3.{} [ Generic.MemberGeneric member = new Generic().new MemberGeneric();@1288] EXACT_MATCH\n" + + "src/g2/f/s/def/R3.java g2.f.s.def.R3.{} [ Generic.MemberGeneric member = new Generic().new MemberGeneric();@1419] EXACT_MATCH\n" + + "src/g2/f/s/def/R3.java g2.f.s.def.R3.{} [ Generic.MemberGeneric member = new Generic().new MemberGeneric();@1459] EXACT_MATCH\n" + + "src/g2/f/s/def/R3.java g2.f.s.def.R3.{} [ Generic.MemberGeneric member = new Generic().new MemberGeneric();@1537] EXACT_MATCH\n" + + "src/g2/f/s/def/R3.java g2.f.s.def.R3.{} [ Generic.MemberGeneric member = new Generic().new MemberGeneric();@1605] EXACT_MATCH\n" + + "src/g2/f/s/def/R3.java g2.f.s.def.R3.{} [ Generic.MemberGeneric member = new Generic().new MemberGeneric();@1645] EXACT_MATCH\n" + + "src/g2/f/s/def/R3.java g2.f.s.def.R3.{} [ Generic.MemberGeneric member = new Generic().new MemberGeneric();@1692] EXACT_MATCH\n" + + "src/g2/f/s/def/R3.java g2.f.s.def.R3.{} [ Generic.MemberGeneric member = new Generic().new MemberGeneric();@1791] EXACT_MATCH\n" + + "src/g2/f/s/def/R3.java g2.f.s.def.R3.{} [ Generic.MemberGeneric member = new Generic().new MemberGeneric();@1831] EXACT_MATCH\n" + + "src/g2/f/s/def/R3.java g2.f.s.def.R3.{} [ Generic.MemberGeneric member = new Generic().new MemberGeneric();@1878] EXACT_MATCH\n" + + "src/g2/f/s/def/R3.java g2.f.s.def.R3.{} [ Generic.MemberGeneric member = new Generic().new MemberGeneric();@1924] EXACT_MATCH" + ); +} +public void testTypeRefGenericAllG3R1_Parameterized() throws CoreException { + IType type = getCompilationUnit("JavaSearch15/src/g3/t/ref/R1.java").getType("R1"); + IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] { type }); + search("*", TYPE, PARAMETERIZED_TYPE_REFERENCE, SearchPattern.R_ERASURE_MATCH, scope); + assertSearchResults( + "src/g3/t/ref/R1.java g3.t.ref.R1.sgsm_wld [ public GS<§|GM|§> sgsm_wld;@321] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.sgsm_www [ public GS<§|GM|§,GM,GM>> sgsm_www;@355] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.sgsm_www [ public GS,GM,GM>> sgsm_www;@358] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.sgsm_www [ public GS,§|GM|§,GM>> sgsm_www;@370] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.sgsm_www [ public GS,GM,§|GM|§>> sgsm_www;@382] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.sgsm_obj [ public GS<§|GM|§> sgsm_obj;@417] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.sgsm_obj [ public GS> sgsm_obj;@420] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.sgsm_obj [ public GS> sgsm_obj;@428] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.sgsm_obj [ public GS> sgsm_obj;@439] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.sgms_wld [ public GM<§|GS|§, GS, GS> sgms_wld;@479] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.sgms_wld [ public GM, §|GS|§, GS> sgms_wld;@486] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.sgms_wld [ public GM, GS, §|GS|§> sgms_wld;@493] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.sgms_www [ public GM<§|GS|§, GS>, GS>>> sgms_www;@521] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.sgms_www [ public GM, §|GS|§>, GS>>> sgms_www;@528] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.sgms_www [ public GM, GS<§|GS|§>, GS>>> sgms_www;@531] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.sgms_www [ public GM, GS>, §|GS|§>>> sgms_www;@539] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.sgms_www [ public GM, GS>, GS<§|GS|§>>> sgms_www;@542] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.sgms_www [ public GM, GS>, GS>>> sgms_www;@545] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.sgms_obj [ public GM<§|GS|§, GS, GS> sgms_obj;@575] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.sgms_obj [ public GM, GS, GS> sgms_obj;@578] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.sgms_obj [ public GM, §|GS|§, GS> sgms_obj;@587] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.sgms_obj [ public GM, GS, §|GS|§> sgms_obj;@612] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.qgsm_wld [ public g3.t.def.GS<§|g3.t.def.GM|§> qgsm_wld;@691] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.qgsm_www [ public g3.t.def.GS<§|g3.t.def.GM|§, g3.t.def.GM, g3.t.def.GM>> qgsm_www;@743] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.qgsm_www [ public g3.t.def.GS, g3.t.def.GM, g3.t.def.GM>> qgsm_www;@755] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.qgsm_www [ public g3.t.def.GS, §|g3.t.def.GM|§, g3.t.def.GM>> qgsm_www;@777] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.qgsm_www [ public g3.t.def.GS, g3.t.def.GM, §|g3.t.def.GM|§>> qgsm_www;@799] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.qgsm_obj [ public g3.t.def.GS<§|g3.t.def.GM|§> qgsm_obj;@852] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.qgsm_obj [ public g3.t.def.GS> qgsm_obj;@864] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.qgsm_obj [ public g3.t.def.GS> qgsm_obj;@882] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.qgsm_obj [ public g3.t.def.GS> qgsm_obj;@903] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.qgms_wld [ public g3.t.def.GM<§|g3.t.def.GS|§, g3.t.def.GS, g3.t.def.GS> qgms_wld;@962] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.qgms_wld [ public g3.t.def.GM, §|g3.t.def.GS|§, g3.t.def.GS> qgms_wld;@978] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.qgms_wld [ public g3.t.def.GM, g3.t.def.GS, §|g3.t.def.GS|§> qgms_wld;@994] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.qgms_www [ public g3.t.def.GM<§|g3.t.def.GS|§, g3.t.def.GS>, g3.t.def.GS>>> qgms_www;@1040] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.qgms_www [ public g3.t.def.GM, §|g3.t.def.GS|§>, g3.t.def.GS>>> qgms_www;@1056] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.qgms_www [ public g3.t.def.GM, g3.t.def.GS<§|g3.t.def.GS|§>, g3.t.def.GS>>> qgms_www;@1068] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.qgms_www [ public g3.t.def.GM, g3.t.def.GS>, §|g3.t.def.GS|§>>> qgms_www;@1085] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.qgms_www [ public g3.t.def.GM, g3.t.def.GS>, g3.t.def.GS<§|g3.t.def.GS|§>>> qgms_www;@1097] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.qgms_www [ public g3.t.def.GM, g3.t.def.GS>, g3.t.def.GS>>> qgms_www;@1109] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.qgms_obj [ public g3.t.def.GM<§|g3.t.def.GS|§, g3.t.def.GS, g3.t.def.GS> qgms_obj;@1157] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.qgms_obj [ public g3.t.def.GM, g3.t.def.GS, g3.t.def.GS> qgms_obj;@1169] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.qgms_obj [ public g3.t.def.GM, §|g3.t.def.GS|§, g3.t.def.GS> qgms_obj;@1188] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.qgms_obj [ public g3.t.def.GM, g3.t.def.GS, §|g3.t.def.GS|§> qgms_obj;@1232] EXACT_MATCH" + ); +} +public void testTypeRefGenericAllG3R1_WildcardBounds() throws CoreException { + IType type = getCompilationUnit("JavaSearch15/src/g3/t/ref/R1.java").getType("R1"); + IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] { type }); + search("*", TYPE, WILDCARD_BOUND_TYPE_REFERENCE, SearchPattern.R_ERASURE_MATCH, scope); + assertSearchResults( + "src/g3/t/ref/R1.java g3.t.ref.R1.sgms_obj [ public GM, GS, GS> sgms_obj;@600] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.sgms_obj [ public GM, GS, GS> sgms_obj;@623] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.qgms_obj [ public g3.t.def.GM, g3.t.def.GS, g3.t.def.GS> qgms_obj;@1210] EXACT_MATCH\n" + + "src/g3/t/ref/R1.java g3.t.ref.R1.qgms_obj [ public g3.t.def.GM, g3.t.def.GS, g3.t.def.GS> qgms_obj;@1252] EXACT_MATCH" + ); +} +public void testTypeRefGenericAllG3R1_TypeVariableBounds() throws CoreException { + IType type = getCompilationUnit("JavaSearch15/src/g3/t/ref/R1.java").getType("R1"); + IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] { type }); + search("*", TYPE, TYPE_VARIABLE_BOUND_TYPE_REFERENCE, SearchPattern.R_ERASURE_MATCH, scope); + assertSearchResults(""); +} +public void testTypeRefGenericAllG5_Parameterized() throws CoreException { + IType type = getCompilationUnit("JavaSearch15/src/g5/m/ref/RefMultiple.java").getType("RefMultiple"); + IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] { type }); + search("*", TYPE, PARAMETERIZED_TYPE_REFERENCE, SearchPattern.R_ERASURE_MATCH, scope); + assertSearchResults( + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.test() [ Multiple<§|Object|§, Exception, RuntimeException> gm = new Multiple();@115] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.test() [ Multiple gm = new Multiple();@123] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.test() [ Multiple gm = new Multiple();@134] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.test() [ Multiple gm = new Multiple<§|Object|§, Exception, RuntimeException>();@170] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.test() [ Multiple gm = new Multiple();@178] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.test() [ Multiple gm = new Multiple();@189] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.test() [ gm.<§|Object|§, Exception, RuntimeException>generic(new Object(), new Exception(), new RuntimeException());@367] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.test() [ gm.generic(new Object(), new Exception(), new RuntimeException());@375] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.test() [ gm.generic(new Object(), new Exception(), new RuntimeException());@386] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.test() [ gm.paramTypesArgs(new Single<§|Object|§>(), new Single(), new Single(), gm);@656] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.test() [ gm.paramTypesArgs(new Single(), new Single<§|Exception|§>(), new Single(), gm);@678] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.test() [ gm.paramTypesArgs(new Single(), new Single(), new Single<§|RuntimeException|§>(), gm);@703] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.test() [ gm = gm.<§|Object|§, Exception, RuntimeException>complete(new Object(), new Exception(), new RuntimeException(), gm);@838] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.test() [ gm = gm.complete(new Object(), new Exception(), new RuntimeException(), gm);@846] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.test() [ gm = gm.complete(new Object(), new Exception(), new RuntimeException(), gm);@857] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.testUnbound() [ gm.paramTypesArgs(new Single<§|Object|§>(), new Single(), new Single(), gm);@1095] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.testUnbound() [ gm.paramTypesArgs(new Single(), new Single<§|Object|§>(), new Single(), gm);@1117] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.testUnbound() [ gm.paramTypesArgs(new Single(), new Single(), new Single<§|Object|§>(), gm);@1139] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.testExtends() [ Multiple<§|Object|§, ? extends Throwable, ? extends Exception> gm = new Multiple();@1295] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.testExtends() [ Multiple gm = new Multiple<§|Object|§, Exception, RuntimeException>();@1363] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.testExtends() [ Multiple gm = new Multiple();@1371] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.testExtends() [ Multiple gm = new Multiple();@1382] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.testExtends() [ gm.<§|Object|§, RuntimeException, RuntimeException>generic(new Object(), new RuntimeException(), new RuntimeException());@1409] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.testExtends() [ gm.generic(new Object(), new RuntimeException(), new RuntimeException());@1417] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.testExtends() [ gm.generic(new Object(), new RuntimeException(), new RuntimeException());@1435] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.testExtends() [ gm.paramTypesArgs(new Single<§|Object|§>(), new Single(), new Single(), gm);@1554] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.testExtends() [ gm.paramTypesArgs(new Single(), new Single<§|Throwable|§>(), new Single(), gm);@1576] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.testExtends() [ gm.paramTypesArgs(new Single(), new Single(), new Single<§|Exception|§>(), gm);@1601] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.testExtends() [ gm = gm.<§|Object|§, RuntimeException, RuntimeException>complete(new Object(), new RuntimeException(), new RuntimeException(), gm);@1660] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.testExtends() [ gm = gm.complete(new Object(), new RuntimeException(), new RuntimeException(), gm);@1668] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.testExtends() [ gm = gm.complete(new Object(), new RuntimeException(), new RuntimeException(), gm);@1686] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.testSuper() [ Multiple<§|Object|§, ? super RuntimeException, ? super IllegalMonitorStateException> gm = new Multiple();@1893] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.testSuper() [ Multiple gm = new Multiple<§|Object|§, Exception, RuntimeException>();@1983] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.testSuper() [ Multiple gm = new Multiple();@1991] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.testSuper() [ Multiple gm = new Multiple();@2002] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.testSuper() [ gm.<§|Object|§, RuntimeException, IllegalMonitorStateException>generic(new Object(), new RuntimeException(), new IllegalMonitorStateException());@2029] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.testSuper() [ gm.generic(new Object(), new RuntimeException(), new IllegalMonitorStateException());@2037] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.testSuper() [ gm.generic(new Object(), new RuntimeException(), new IllegalMonitorStateException());@2055] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.testSuper() [ gm.paramTypesArgs(new Single<§|Object|§>(), new Single(), new Single(), gm);@2198] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.testSuper() [ gm.paramTypesArgs(new Single(), new Single<§|RuntimeException|§>(), new Single(), gm);@2220] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.testSuper() [ gm.paramTypesArgs(new Single(), new Single(), new Single<§|RuntimeException|§>(), gm);@2252] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.testSuper() [ gm = gm.<§|Object|§, RuntimeException, IllegalMonitorStateException>complete(new Object(), new RuntimeException(), new IllegalMonitorStateException(), gm);@2318] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.testSuper() [ gm = gm.complete(new Object(), new RuntimeException(), new IllegalMonitorStateException(), gm);@2326] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.testSuper() [ gm = gm.complete(new Object(), new RuntimeException(), new IllegalMonitorStateException(), gm);@2344] EXACT_MATCH" + ); +} +public void testTypeRefGenericAllG5_WildcardBounds() throws CoreException { + IType type = getCompilationUnit("JavaSearch15/src/g5/m/ref/RefMultiple.java").getType("RefMultiple"); + IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] { type }); + search("*", TYPE, WILDCARD_BOUND_TYPE_REFERENCE, SearchPattern.R_ERASURE_MATCH, scope); + assertSearchResults( + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.testExtends() [ Multiple gm = new Multiple();@1313] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.testExtends() [ Multiple gm = new Multiple();@1334] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.testSuper() [ Multiple gm = new Multiple();@1909] EXACT_MATCH\n" + + "src/g5/m/ref/RefMultiple.java void g5.m.ref.RefMultiple.testSuper() [ Multiple gm = new Multiple();@1935] EXACT_MATCH" + ); +} +public void testTypeRefGenericAllG5_TypeVariableBounds() throws CoreException { + IType type = getCompilationUnit("JavaSearch15/src/g5/m/ref/RefMultiple.java").getType("RefMultiple"); + IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] { type }); + search("*", TYPE, TYPE_VARIABLE_BOUND_TYPE_REFERENCE, SearchPattern.R_ERASURE_MATCH, scope); + assertSearchResults(""); +} +public void testTypeRefGenericAllG6_Parameterized() throws CoreException { + IType type = getCompilationUnit("JavaSearch15/src/g6/t/ref/QualifMultiple.java").getType("QualifMultiple"); + IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] { type }); + search("*", TYPE, PARAMETERIZED_TYPE_REFERENCE, SearchPattern.R_ERASURE_MATCH, scope); + assertSearchResults( + "src/g6/t/ref/QualifMultiple.java g6.t.ref.QualifMultiple.entryException [ g6.t.def.Table<§|String|§, Exception>.Entry entryException;@64] EXACT_MATCH\n" + + "src/g6/t/ref/QualifMultiple.java g6.t.ref.QualifMultiple.entryException [ g6.t.def.Table.Entry entryException;@72] EXACT_MATCH\n" + + "src/g6/t/ref/QualifMultiple.java g6.t.ref.QualifMultiple.entryException [ g6.t.def.Table.Entry<§|String|§, Exception> entryException;@89] EXACT_MATCH\n" + + "src/g6/t/ref/QualifMultiple.java g6.t.ref.QualifMultiple.entryException [ g6.t.def.Table.Entry entryException;@97] EXACT_MATCH\n" + + "src/g6/t/ref/QualifMultiple.java g6.t.ref.QualifMultiple.entryExceptionArray [ g6.t.def.Table<§|String|§, Exception>.Entry[] entryExceptionArray;@140] EXACT_MATCH\n" + + "src/g6/t/ref/QualifMultiple.java g6.t.ref.QualifMultiple.entryExceptionArray [ g6.t.def.Table.Entry[] entryExceptionArray;@148] EXACT_MATCH\n" + + "src/g6/t/ref/QualifMultiple.java g6.t.ref.QualifMultiple.entryExceptionArray [ g6.t.def.Table.Entry<§|String|§, Exception>[] entryExceptionArray;@165] EXACT_MATCH\n" + + "src/g6/t/ref/QualifMultiple.java g6.t.ref.QualifMultiple.entryExceptionArray [ g6.t.def.Table.Entry[] entryExceptionArray;@173] EXACT_MATCH\n" + + "src/g6/t/ref/QualifMultiple.java g6.t.ref.QualifMultiple.tableOfEntryExceptionArray [ g6.t.def.Table<§|String|§, g6.t.def.Table.Entry[]>.Entry.Entry[]> tableOfEntryExceptionArray;@223] EXACT_MATCH\n" + + "src/g6/t/ref/QualifMultiple.java g6.t.ref.QualifMultiple.tableOfEntryExceptionArray [ g6.t.def.Table.Entry[]|§>.Entry.Entry[]> tableOfEntryExceptionArray;@231] EXACT_MATCH\n" + + "src/g6/t/ref/QualifMultiple.java g6.t.ref.QualifMultiple.tableOfEntryExceptionArray [ g6.t.def.Table.Entry[]>.Entry.Entry[]> tableOfEntryExceptionArray;@246] EXACT_MATCH\n" + + "src/g6/t/ref/QualifMultiple.java g6.t.ref.QualifMultiple.tableOfEntryExceptionArray [ g6.t.def.Table.Entry[]>.Entry.Entry[]> tableOfEntryExceptionArray;@254] EXACT_MATCH\n" + + "src/g6/t/ref/QualifMultiple.java g6.t.ref.QualifMultiple.tableOfEntryExceptionArray [ g6.t.def.Table.Entry<§|String|§, Exception>[]>.Entry.Entry[]> tableOfEntryExceptionArray;@271] EXACT_MATCH\n" + + "src/g6/t/ref/QualifMultiple.java g6.t.ref.QualifMultiple.tableOfEntryExceptionArray [ g6.t.def.Table.Entry[]>.Entry.Entry[]> tableOfEntryExceptionArray;@279] EXACT_MATCH\n" + + "src/g6/t/ref/QualifMultiple.java g6.t.ref.QualifMultiple.tableOfEntryExceptionArray [ g6.t.def.Table.Entry[]>.Entry<§|String|§, g6.t.def.Table.Entry[]> tableOfEntryExceptionArray;@299] EXACT_MATCH\n" + + "src/g6/t/ref/QualifMultiple.java g6.t.ref.QualifMultiple.tableOfEntryExceptionArray [ g6.t.def.Table.Entry[]>.Entry.Entry[]|§> tableOfEntryExceptionArray;@307] EXACT_MATCH\n" + + "src/g6/t/ref/QualifMultiple.java g6.t.ref.QualifMultiple.tableOfEntryExceptionArray [ g6.t.def.Table.Entry[]>.Entry.Entry[]> tableOfEntryExceptionArray;@322] EXACT_MATCH\n" + + "src/g6/t/ref/QualifMultiple.java g6.t.ref.QualifMultiple.tableOfEntryExceptionArray [ g6.t.def.Table.Entry[]>.Entry.Entry[]> tableOfEntryExceptionArray;@330] EXACT_MATCH\n" + + "src/g6/t/ref/QualifMultiple.java g6.t.ref.QualifMultiple.tableOfEntryExceptionArray [ g6.t.def.Table.Entry[]>.Entry.Entry<§|String|§, Exception>[]> tableOfEntryExceptionArray;@347] EXACT_MATCH\n" + + "src/g6/t/ref/QualifMultiple.java g6.t.ref.QualifMultiple.tableOfEntryExceptionArray [ g6.t.def.Table.Entry[]>.Entry.Entry[]> tableOfEntryExceptionArray;@355] EXACT_MATCH" + ); +} +public void testTypeRefGenericAllG6_WildcardBounds() throws CoreException { + IType type = getCompilationUnit("JavaSearch15/src/g6/t/ref/QualifMultiple.java").getType("QualifMultiple"); + IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] { type }); + search("*", TYPE, FIELD_TYPE_DECLARATION_TYPE_REFERENCE, SearchPattern.R_ERASURE_MATCH, scope); + assertSearchResults( + "src/g6/t/ref/QualifMultiple.java g6.t.ref.QualifMultiple.entryException [ §|g6.t.def.Table.Entry|§ entryException;@49] EXACT_MATCH\n" + + "src/g6/t/ref/QualifMultiple.java g6.t.ref.QualifMultiple.entryExceptionArray [ §|g6.t.def.Table.Entry[]|§ entryExceptionArray;@125] EXACT_MATCH\n" + + "src/g6/t/ref/QualifMultiple.java g6.t.ref.QualifMultiple.tableOfEntryExceptionArray [ §|g6.t.def.Table.Entry[]>.Entry|§.Entry[]> tableOfEntryExceptionArray;@208] EXACT_MATCH" + ); +} +public void testTypeRefGenericAllG6_TypeVariableBounds() throws CoreException { + IType type = getCompilationUnit("JavaSearch15/src/g6/t/ref/QualifMultiple.java").getType("QualifMultiple"); + IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] { type }); + search("*", TYPE, TYPE_VARIABLE_BOUND_TYPE_REFERENCE | WILDCARD_BOUND_TYPE_REFERENCE, SearchPattern.R_ERASURE_MATCH, scope); + assertSearchResults(""); +} +} #P org.eclipse.jdt.core Index: search/org/eclipse/jdt/internal/core/search/matching/TypeReferencePattern.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeReferencePattern.java,v retrieving revision 1.79 diff -u -r1.79 TypeReferencePattern.java --- search/org/eclipse/jdt/internal/core/search/matching/TypeReferencePattern.java 2 Oct 2007 17:12:01 -0000 1.79 +++ search/org/eclipse/jdt/internal/core/search/matching/TypeReferencePattern.java 27 Nov 2007 15:09:21 -0000 @@ -12,10 +12,11 @@ import org.eclipse.jdt.core.IType; import org.eclipse.jdt.core.compiler.CharOperation; +import org.eclipse.jdt.core.search.IJavaSearchConstants; import org.eclipse.jdt.core.search.SearchPattern; import org.eclipse.jdt.internal.core.util.Util; - public class TypeReferencePattern extends IntersectingPattern { +public class TypeReferencePattern extends IntersectingPattern { protected char[] qualification; protected char[] simpleName; @@ -26,8 +27,11 @@ public int segmentsSize; protected char[][] segments; protected int currentSegment; - - protected static char[][] CATEGORIES = { REF }; + + private final static char[][] + CATEGORIES = { REF, ANNOTATION_REF }, + CATEGORIES_ANNOT_REF = { ANNOTATION_REF }; + private char[][] categories; public TypeReferencePattern(char[] qualification, char[] simpleName, int matchRule) { this(matchRule); @@ -54,6 +58,13 @@ * Instantiate a type reference pattern with additional information for generics search */ public TypeReferencePattern(char[] qualification, char[] simpleName, String typeSignature, int matchRule) { + this(qualification, simpleName, typeSignature, 0, matchRule); + } + + /* + * Instanciate a type reference pattern with additional information for generics search and fine grain information + */ + public TypeReferencePattern(char[] qualification, char[] simpleName, String typeSignature, int limitTo, int matchRule) { this(qualification, simpleName,matchRule); if (typeSignature != null) { // store type signatures and arguments @@ -63,16 +74,31 @@ this.segmentsSize = getTypeArguments().length + CharOperation.occurencesOf('/', this.typeSignatures[0]) - 1; } } + this.fineGrain = limitTo & 0xFFFFFFF0; + if (this.fineGrain == IJavaSearchConstants.ANNOTATION_TYPE_REFERENCE) { + categories =CATEGORIES_ANNOT_REF; + } } + /* * Instantiate a type reference pattern with additional information for generics search */ public TypeReferencePattern(char[] qualification, char[] simpleName, IType type, int matchRule) { + this(qualification, simpleName, type, 0, matchRule); + } + + /* + * Instanciate a type reference pattern with additional information for generics search + */ + public TypeReferencePattern(char[] qualification, char[] simpleName, IType type, int limitTo, int matchRule) { this(qualification, simpleName,matchRule); storeTypeSignaturesAndArguments(type); + this.fineGrain = limitTo & 0xFFFFFFF0; } + TypeReferencePattern(int matchRule) { super(TYPE_REF_PATTERN, matchRule); + this.categories = CATEGORIES; } public void decodeIndexKey(char[] key) { this.simpleName = key; @@ -90,7 +116,7 @@ return null; } public char[][] getIndexCategories() { - return CATEGORIES; + return this.categories; } protected boolean hasNextQuery() { if (this.segments == null) return false; @@ -105,13 +131,22 @@ return true; // index key is not encoded so query results all match } + protected void setFineGrain(int limitTo) { + this.fineGrain = limitTo & 0xFFFFFFF0; +// if (this.fineGrain == IJavaSearchConstants.ONLY_ANNOTATION_TYPE_REFERENCE) { +// this.categories = new char[][] { ANNOTATION_REF }; +// } + } + protected void resetQuery() { /* walk the segments from end to start as it will find less potential references using 'lang' than 'java' */ if (this.segments != null) this.currentSegment = this.segments.length - 1; } protected StringBuffer print(StringBuffer output) { - output.append("TypeReferencePattern: qualification<"); //$NON-NLS-1$ + String patternClassName = getClass().getName(); + output.append(patternClassName.substring(patternClassName.lastIndexOf('.')+1)); + output.append(": qualification<"); //$NON-NLS-1$ if (qualification != null) output.append(qualification); else Index: search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java,v retrieving revision 1.79 diff -u -r1.79 MethodLocator.java --- search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java 14 Nov 2007 10:03:40 -0000 1.79 +++ search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java 27 Nov 2007 15:09:20 -0000 @@ -47,6 +47,9 @@ protected void clear() { this.methodDeclarationsWithInvalidParam = new HashMap(); } +protected int fineGrain() { + return this.pattern.fineGrain; +} public void initializePolymorphicSearch(MatchLocator locator) { long start = 0; if (BasicSearchEngine.VERBOSE) { Index: search/org/eclipse/jdt/internal/core/search/matching/DeclarationOfAccessedFieldsPattern.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/DeclarationOfAccessedFieldsPattern.java,v retrieving revision 1.23 diff -u -r1.23 DeclarationOfAccessedFieldsPattern.java --- search/org/eclipse/jdt/internal/core/search/matching/DeclarationOfAccessedFieldsPattern.java 10 May 2006 18:03:42 -0000 1.23 +++ search/org/eclipse/jdt/internal/core/search/matching/DeclarationOfAccessedFieldsPattern.java 27 Nov 2007 15:09:19 -0000 @@ -11,6 +11,7 @@ package org.eclipse.jdt.internal.core.search.matching; import org.eclipse.jdt.core.IJavaElement; +import org.eclipse.jdt.core.search.IJavaSearchConstants; import org.eclipse.jdt.internal.compiler.util.SimpleSet; public class DeclarationOfAccessedFieldsPattern extends FieldPattern { @@ -19,7 +20,7 @@ protected SimpleSet knownFields; public DeclarationOfAccessedFieldsPattern(IJavaElement enclosingElement) { - super(false, true, true, null, null, null, null, null, R_PATTERN_MATCH); + super(null, null, null, null, null, IJavaSearchConstants.REFERENCES, R_PATTERN_MATCH); this.enclosingElement = enclosingElement; this.knownFields = new SimpleSet(); Index: search/org/eclipse/jdt/internal/core/search/matching/VariablePattern.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/VariablePattern.java,v retrieving revision 1.12 diff -u -r1.12 VariablePattern.java --- search/org/eclipse/jdt/internal/core/search/matching/VariablePattern.java 24 Aug 2007 05:59:05 -0000 1.12 +++ search/org/eclipse/jdt/internal/core/search/matching/VariablePattern.java 27 Nov 2007 15:09:21 -0000 @@ -11,23 +11,50 @@ package org.eclipse.jdt.internal.core.search.matching; import org.eclipse.jdt.core.compiler.CharOperation; +import org.eclipse.jdt.core.search.IJavaSearchConstants; public abstract class VariablePattern extends JavaSearchPattern { -protected boolean findDeclarations; -protected boolean findReferences; -protected boolean readAccess; -protected boolean writeAccess; +protected boolean findDeclarations = false; +protected boolean findReferences = false; +protected boolean readAccess = false; +protected boolean writeAccess = false; protected char[] name; -public VariablePattern(int patternKind, boolean findDeclarations, boolean readAccess, boolean writeAccess, char[] name, int matchRule) { +public final static int FINE_GRAIN_FIELD_MASK = + IJavaSearchConstants.SUPER_REFERENCE | + IJavaSearchConstants.QUALIFIED_REFERENCE | + IJavaSearchConstants.THIS_REFERENCE | + IJavaSearchConstants.IMPLICIT_THIS_REFERENCE; + +public VariablePattern(int patternKind, char[] name, int limitTo, int matchRule) { super(patternKind, matchRule); - this.findDeclarations = findDeclarations; // set to find declarations & all occurrences - this.readAccess = readAccess; // set to find any reference, read only references & all occurrences - this.writeAccess = writeAccess; // set to find any reference, write only references & all occurrences - this.findReferences = readAccess || writeAccess; + this.fineGrain = limitTo & FINE_GRAIN_FIELD_MASK; + if (this.fineGrain == 0) { + switch (limitTo & 0xF) { + case IJavaSearchConstants.DECLARATIONS : + this.findDeclarations = true; + break; + case IJavaSearchConstants.REFERENCES : + this.readAccess = true; + this.writeAccess = true; + break; + case IJavaSearchConstants.READ_ACCESSES : + this.readAccess = true; + break; + case IJavaSearchConstants.WRITE_ACCESSES : + this.writeAccess = true; + break; + case IJavaSearchConstants.ALL_OCCURRENCES : + this.findDeclarations = true; + this.readAccess = true; + this.writeAccess = true; + break; + } + this.findReferences = this.readAccess || this.writeAccess; + } this.name = (this.isCaseSensitive || this.isCamelCase) ? name : CharOperation.toLowerCase(name); } @@ -37,6 +64,6 @@ */ protected boolean mustResolve() { // would like to change this so that we only do it if generic references are found - return this.findReferences; // always resolve (in case of a simple name reference being a potential match) + return this.findReferences || this.fineGrain != 0; // always resolve (in case of a simple name reference being a potential match) } } Index: search/org/eclipse/jdt/internal/core/search/matching/TypeReferenceLocator.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeReferenceLocator.java,v retrieving revision 1.59 diff -u -r1.59 TypeReferenceLocator.java --- search/org/eclipse/jdt/internal/core/search/matching/TypeReferenceLocator.java 23 Nov 2007 08:48:54 -0000 1.59 +++ search/org/eclipse/jdt/internal/core/search/matching/TypeReferenceLocator.java 27 Nov 2007 15:09:21 -0000 @@ -26,11 +26,14 @@ protected TypeReferencePattern pattern; protected boolean isDeclarationOfReferencedTypesPattern; +private final int fineGrain; + public TypeReferenceLocator(TypeReferencePattern pattern) { super(pattern); this.pattern = pattern; + this.fineGrain = pattern == null ? 0 : pattern.fineGrain; this.isDeclarationOfReferencedTypesPattern = this.pattern instanceof DeclarationOfReferencedTypesPattern; } protected IJavaElement findElement(IJavaElement element, int accuracy) { @@ -43,6 +46,9 @@ element = element.getParent(); return element; } +protected int fineGrain() { + return this.fineGrain; +} public int match(Annotation node, MatchingNodeSet nodeSet) { return match(node.type, nodeSet); } @@ -201,6 +207,11 @@ return; } + // Return if fine grain is on and does not concern import reference + if ((this.pattern.fineGrain != 0 && (this.pattern.fineGrain & IJavaSearchConstants.IMPORT_DECLARATION_TYPE_REFERENCE) == 0)) { + return; + } + // Create search match match = locator.newTypeReferenceMatch(element, binding, accuracy, importRef); @@ -539,6 +550,10 @@ } } } + if (this.pattern.simpleName == null) { + match.setOffset(expr.sourceStart); + match.setLength(expr.sourceEnd-expr.sourceStart+1); + } locator.report(match); } protected int referenceType() { Index: search/org/eclipse/jdt/internal/core/search/matching/VariableLocator.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/VariableLocator.java,v retrieving revision 1.7 diff -u -r1.7 VariableLocator.java --- search/org/eclipse/jdt/internal/core/search/matching/VariableLocator.java 10 May 2006 18:03:43 -0000 1.7 +++ search/org/eclipse/jdt/internal/core/search/matching/VariableLocator.java 27 Nov 2007 15:09:21 -0000 @@ -30,7 +30,7 @@ if (lhs instanceof Reference) return matchReference((Reference) lhs, nodeSet, true); } - } else if (this.pattern.readAccess) { + } else if (this.pattern.readAccess || this.pattern.fineGrain != 0) { if (node instanceof Assignment && !(node instanceof CompoundAssignment)) { // the lhs of a simple assignment may be added in match(Reference...) before we reach here // for example, the fieldRef to 'this.x' in the statement this.x = x; is not considered a readAccess @@ -42,7 +42,7 @@ return IMPOSSIBLE_MATCH; } public int match(Reference node, MatchingNodeSet nodeSet) { // interested in NameReference & its subtypes - return this.pattern.readAccess + return (this.pattern.readAccess || this.pattern.fineGrain != 0) ? matchReference(node, nodeSet, false) : IMPOSSIBLE_MATCH; } Index: search/org/eclipse/jdt/internal/core/search/matching/JavaSearchPattern.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/JavaSearchPattern.java,v retrieving revision 1.26 diff -u -r1.26 JavaSearchPattern.java --- search/org/eclipse/jdt/internal/core/search/matching/JavaSearchPattern.java 15 Nov 2007 16:58:53 -0000 1.26 +++ search/org/eclipse/jdt/internal/core/search/matching/JavaSearchPattern.java 27 Nov 2007 15:09:19 -0000 @@ -53,6 +53,11 @@ int matchCompatibility; /** + * Fine grain limitation + */ + public int fineGrain = 0; + + /** * Mask used on match rule for match mode. */ public static final int MATCH_MODE_MASK = R_EXACT_MATCH @@ -289,6 +294,7 @@ } return output; } + /** * @param typeArguments The typeArguments to set. */ Index: search/org/eclipse/jdt/internal/core/search/matching/PatternLocator.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PatternLocator.java,v retrieving revision 1.68 diff -u -r1.68 PatternLocator.java --- search/org/eclipse/jdt/internal/core/search/matching/PatternLocator.java 2 Oct 2007 17:12:01 -0000 1.68 +++ search/org/eclipse/jdt/internal/core/search/matching/PatternLocator.java 27 Nov 2007 15:09:21 -0000 @@ -238,6 +238,9 @@ // override if the pattern can be more specific return ALL_CONTAINER; } +protected int fineGrain() { + return 0; +} /** * Returns whether the given name matches the given pattern. */ @@ -814,136 +817,141 @@ } // TODO (frederic) do we need to verify each parameter? return level; // we can't do better - } else if (type.isRawType()) { - return level; // raw type always match - } else { - TypeBinding leafType = type.leafComponentType(); - if (!leafType.isParameterizedType()) { - // Standard types (ie. neither generic nor parameterized nor raw types) - // cannot match pattern with type parameters or arguments - return (patternTypeArguments[depth]==null || patternTypeArguments[depth].length==0) ? level : IMPOSSIBLE_MATCH; - } - ParameterizedTypeBinding paramTypeBinding = (ParameterizedTypeBinding) leafType; + } - // Compare arguments only if there ones on both sides - if (patternTypeArguments[depth] != null && patternTypeArguments[depth].length > 0 && - paramTypeBinding.arguments != null && paramTypeBinding.arguments.length > 0) { + // raw type always match + if (type.isRawType()) { + return level; + } - // type parameters length must match at least specified type names length - int length = patternTypeArguments[depth].length; - if (paramTypeBinding.arguments.length != length) return IMPOSSIBLE_MATCH; - - // verify each pattern type parameter - nextTypeArgument: for (int i= 0; i valid - continue nextTypeArgument; - } - // Look if bound name match pattern type argument - ReferenceBinding boundBinding = (ReferenceBinding) wildcardBinding.bound; - if (CharOperation.match(patternTypeArgument, boundBinding.shortReadableName(), this.isCaseSensitive) || - CharOperation.match(patternTypeArgument, boundBinding.readableName(), this.isCaseSensitive)) { - // found name in hierarchy => match + // Standard types (ie. neither generic nor parameterized nor raw types) + // cannot match pattern with type parameters or arguments + TypeBinding leafType = type.leafComponentType(); + if (!leafType.isParameterizedType()) { + return (patternTypeArguments[depth]==null || patternTypeArguments[depth].length==0) ? level : IMPOSSIBLE_MATCH; + } + + // Parameterized type + ParameterizedTypeBinding paramTypeBinding = (ParameterizedTypeBinding) leafType; + + // Compare arguments only if there ones on both sides + if (patternTypeArguments[depth] != null && patternTypeArguments[depth].length > 0 && + paramTypeBinding.arguments != null && paramTypeBinding.arguments.length > 0) { + + // type parameters length must match at least specified type names length + int length = patternTypeArguments[depth].length; + if (paramTypeBinding.arguments.length != length) return IMPOSSIBLE_MATCH; + + // verify each pattern type parameter + nextTypeArgument: for (int i= 0; i valid continue nextTypeArgument; - } - - // If pattern is not exact then match fails - if (patternTypeArgHasAnyChars) return impossible; - - // Look for bound name in type argument superclasses - boundBinding = boundBinding.superclass(); - while (boundBinding != null) { - if (CharOperation.equals(patternTypeArgument, boundBinding.shortReadableName(), this.isCaseSensitive) || - CharOperation.equals(patternTypeArgument, boundBinding.readableName(), this.isCaseSensitive)) { - // found name in hierarchy => match - continue nextTypeArgument; - } else if (boundBinding.isLocalType() || boundBinding.isMemberType()) { - // for local or member type, verify also source name (bug 81084) - if (CharOperation.match(patternTypeArgument, boundBinding.sourceName(), this.isCaseSensitive)) - continue nextTypeArgument; - } - boundBinding = boundBinding.superclass(); - } - return impossible; } - - // See if names match - if (CharOperation.match(patternTypeArgument, argTypeBinding.shortReadableName(), this.isCaseSensitive) || - CharOperation.match(patternTypeArgument, argTypeBinding.readableName(), this.isCaseSensitive)) { + // Look if bound name match pattern type argument + ReferenceBinding boundBinding = (ReferenceBinding) wildcardBinding.bound; + if (CharOperation.match(patternTypeArgument, boundBinding.shortReadableName(), this.isCaseSensitive) || + CharOperation.match(patternTypeArgument, boundBinding.readableName(), this.isCaseSensitive)) { + // found name in hierarchy => match continue nextTypeArgument; - } else if (argTypeBinding.isLocalType() || argTypeBinding.isMemberType()) { - // for local or member type, verify also source name (bug 81084) - if (CharOperation.match(patternTypeArgument, argTypeBinding.sourceName(), this.isCaseSensitive)) - continue nextTypeArgument; } // If pattern is not exact then match fails if (patternTypeArgHasAnyChars) return impossible; - - // Scan hierarchy - TypeBinding leafTypeBinding = argTypeBinding.leafComponentType(); - if (leafTypeBinding.isBaseType()) return impossible; - ReferenceBinding refBinding = ((ReferenceBinding) leafTypeBinding).superclass(); - while (refBinding != null) { - if (CharOperation.equals(patternTypeArgument, refBinding.shortReadableName(), this.isCaseSensitive) || - CharOperation.equals(patternTypeArgument, refBinding.readableName(), this.isCaseSensitive)) { + + // Look for bound name in type argument superclasses + boundBinding = boundBinding.superclass(); + while (boundBinding != null) { + if (CharOperation.equals(patternTypeArgument, boundBinding.shortReadableName(), this.isCaseSensitive) || + CharOperation.equals(patternTypeArgument, boundBinding.readableName(), this.isCaseSensitive)) { // found name in hierarchy => match continue nextTypeArgument; - } else if (refBinding.isLocalType() || refBinding.isMemberType()) { + } else if (boundBinding.isLocalType() || boundBinding.isMemberType()) { // for local or member type, verify also source name (bug 81084) - if (CharOperation.match(patternTypeArgument, refBinding.sourceName(), this.isCaseSensitive)) + if (CharOperation.match(patternTypeArgument, boundBinding.sourceName(), this.isCaseSensitive)) continue nextTypeArgument; } - refBinding = refBinding.superclass(); + boundBinding = boundBinding.superclass(); } return impossible; } + + // See if names match + if (CharOperation.match(patternTypeArgument, argTypeBinding.shortReadableName(), this.isCaseSensitive) || + CharOperation.match(patternTypeArgument, argTypeBinding.readableName(), this.isCaseSensitive)) { + continue nextTypeArgument; + } else if (argTypeBinding.isLocalType() || argTypeBinding.isMemberType()) { + // for local or member type, verify also source name (bug 81084) + if (CharOperation.match(patternTypeArgument, argTypeBinding.sourceName(), this.isCaseSensitive)) + continue nextTypeArgument; + } + + // If pattern is not exact then match fails + if (patternTypeArgHasAnyChars) return impossible; + + // Scan hierarchy + TypeBinding leafTypeBinding = argTypeBinding.leafComponentType(); + if (leafTypeBinding.isBaseType()) return impossible; + ReferenceBinding refBinding = ((ReferenceBinding) leafTypeBinding).superclass(); + while (refBinding != null) { + if (CharOperation.equals(patternTypeArgument, refBinding.shortReadableName(), this.isCaseSensitive) || + CharOperation.equals(patternTypeArgument, refBinding.readableName(), this.isCaseSensitive)) { + // found name in hierarchy => match + continue nextTypeArgument; + } else if (refBinding.isLocalType() || refBinding.isMemberType()) { + // for local or member type, verify also source name (bug 81084) + if (CharOperation.match(patternTypeArgument, refBinding.sourceName(), this.isCaseSensitive)) + continue nextTypeArgument; + } + refBinding = refBinding.superclass(); + } + return impossible; } - - // Recurse on enclosing type - TypeBinding enclosingType = paramTypeBinding.enclosingType(); - if (enclosingType != null && enclosingType.isParameterizedType() && depth < patternTypeArguments.length && qualificationPattern != null) { - int lastDot = CharOperation.lastIndexOf('.', qualificationPattern); - char[] enclosingQualificationPattern = lastDot==-1 ? null : CharOperation.subarray(qualificationPattern, 0, lastDot); - char[] enclosingSimpleNamePattern = lastDot==-1 ? qualificationPattern : CharOperation.subarray(qualificationPattern, lastDot+1, qualificationPattern.length); - int enclosingLevel = resolveLevelForType(enclosingSimpleNamePattern, enclosingQualificationPattern, patternTypeArguments, depth+1, enclosingType); - if (enclosingLevel == impossible) return impossible; - if (enclosingLevel == IMPOSSIBLE_MATCH) return IMPOSSIBLE_MATCH; - } - return level; } + + // Recurse on enclosing type + TypeBinding enclosingType = paramTypeBinding.enclosingType(); + if (enclosingType != null && enclosingType.isParameterizedType() && depth < patternTypeArguments.length && qualificationPattern != null) { + int lastDot = CharOperation.lastIndexOf('.', qualificationPattern); + char[] enclosingQualificationPattern = lastDot==-1 ? null : CharOperation.subarray(qualificationPattern, 0, lastDot); + char[] enclosingSimpleNamePattern = lastDot==-1 ? qualificationPattern : CharOperation.subarray(qualificationPattern, lastDot+1, qualificationPattern.length); + int enclosingLevel = resolveLevelForType(enclosingSimpleNamePattern, enclosingQualificationPattern, patternTypeArguments, depth+1, enclosingType); + if (enclosingLevel == impossible) return impossible; + if (enclosingLevel == IMPOSSIBLE_MATCH) return IMPOSSIBLE_MATCH; + } + return level; } public String toString(){ return "SearchPattern"; //$NON-NLS-1$ Index: search/org/eclipse/jdt/internal/core/search/matching/FieldLocator.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/FieldLocator.java,v retrieving revision 1.47 diff -u -r1.47 FieldLocator.java --- search/org/eclipse/jdt/internal/core/search/matching/FieldLocator.java 25 Apr 2007 16:59:23 -0000 1.47 +++ search/org/eclipse/jdt/internal/core/search/matching/FieldLocator.java 27 Nov 2007 15:09:19 -0000 @@ -30,6 +30,9 @@ this.isDeclarationOfAccessedFieldsPattern = this.pattern instanceof DeclarationOfAccessedFieldsPattern; } +protected int fineGrain() { + return this.pattern.fineGrain; +} public int match(ASTNode node, MatchingNodeSet nodeSet) { int declarationsLevel = IMPOSSIBLE_MATCH; if (this.pattern.findReferences) { @@ -78,7 +81,7 @@ //public int match(TypeReference node, MatchingNodeSet nodeSet) - SKIP IT protected int matchContainer() { - if (this.pattern.findReferences) { + if (this.pattern.findReferences || this.pattern.fineGrain != 0) { // need to look everywhere to find in javadocs and static import return ALL_CONTAINER; } @@ -290,7 +293,7 @@ return IJavaElement.FIELD; } public int resolveLevel(ASTNode possiblelMatchingNode) { - if (this.pattern.findReferences) { + if (this.pattern.findReferences || this.pattern.fineGrain != 0) { if (possiblelMatchingNode instanceof FieldReference) return matchField(((FieldReference) possiblelMatchingNode).binding, true); else if (possiblelMatchingNode instanceof NameReference) Index: search/org/eclipse/jdt/internal/core/search/matching/LocalVariableLocator.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/LocalVariableLocator.java,v retrieving revision 1.19 diff -u -r1.19 LocalVariableLocator.java --- search/org/eclipse/jdt/internal/core/search/matching/LocalVariableLocator.java 25 Oct 2007 17:22:54 -0000 1.19 +++ search/org/eclipse/jdt/internal/core/search/matching/LocalVariableLocator.java 27 Nov 2007 15:09:19 -0000 @@ -82,7 +82,7 @@ return IJavaElement.LOCAL_VARIABLE; } public int resolveLevel(ASTNode possiblelMatchingNode) { - if (this.pattern.findReferences) + if (this.pattern.findReferences || this.pattern.fineGrain != 0) if (possiblelMatchingNode instanceof NameReference) return resolveLevel((NameReference) possiblelMatchingNode); if (possiblelMatchingNode instanceof LocalDeclaration) Index: search/org/eclipse/jdt/internal/core/search/matching/OrPattern.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/OrPattern.java,v retrieving revision 1.42 diff -u -r1.42 OrPattern.java --- search/org/eclipse/jdt/internal/core/search/matching/OrPattern.java 27 Feb 2005 23:00:11 -0000 1.42 +++ search/org/eclipse/jdt/internal/core/search/matching/OrPattern.java 27 Nov 2007 15:09:20 -0000 @@ -22,11 +22,6 @@ protected SearchPattern[] patterns; - /* - * Whether this pattern is erasure match. - */ -// boolean isErasureMatch; - /** * One of {@link #R_ERASURE_MATCH}, {@link #R_EQUIVALENT_MATCH}, {@link #R_FULL_MATCH}. */ Index: search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java,v retrieving revision 1.300 diff -u -r1.300 MatchLocator.java --- search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java 27 Nov 2007 08:42:08 -0000 1.300 +++ search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java 27 Nov 2007 15:09:20 -0000 @@ -144,6 +144,8 @@ // Cache for method handles HashSet methodHandles; +private final int patternFineGrain; + /** * An ast visitor that visits local type declarations. */ @@ -184,7 +186,6 @@ } } } - public static class WorkingCopyDocument extends JavaSearchDocument { public org.eclipse.jdt.core.ICompilationUnit workingCopy; WorkingCopyDocument(org.eclipse.jdt.core.ICompilationUnit workingCopy, SearchParticipant participant) { @@ -328,6 +329,7 @@ this.pattern = pattern; this.patternLocator = PatternLocator.patternLocator(this.pattern); this.matchContainer = this.patternLocator == null ? 0 : this.patternLocator.matchContainer(); + this.patternFineGrain = this.patternLocator == null ? 0 : this.patternLocator.fineGrain(); this.requestor = requestor; this.scope = scope; this.progressMonitor = progressMonitor; @@ -1980,8 +1982,10 @@ * search pattern (ie. the ones in the matching nodes set) * Note that the method declaration has already been checked. */ -protected void reportMatching(TypeDeclaration type, AbstractMethodDeclaration method, IJavaElement parent, int accuracy, boolean typeInHierarchy, MatchingNodeSet nodeSet) throws CoreException { +protected void reportMatching(AbstractMethodDeclaration method, TypeDeclaration type, IJavaElement parent, int accuracy, boolean typeInHierarchy, MatchingNodeSet nodeSet) throws CoreException { IJavaElement enclosingElement = null; + + // report method declaration itself if (accuracy > -1) { enclosingElement = createHandle(method, parent); if (enclosingElement != null) { // skip if unable to find method @@ -2049,16 +2053,29 @@ if (enclosingElement == null) enclosingElement = createHandle(method, parent); if (encloses(enclosingElement)) { - for (int i = 0, l = nodes.length; i < l; i++) { - ASTNode node = nodes[i]; - Integer level = (Integer) nodeSet.matchingNodes.removeKey(node); - this.patternLocator.matchReportReference(node, enclosingElement, method.binding, method.scope, level.intValue(), this); + // standard reporting + if (this.patternFineGrain == 0) { + for (int i = 0, l = nodes.length; i < l; i++) { + ASTNode node = nodes[i]; + Integer level = (Integer) nodeSet.matchingNodes.removeKey(node); + this.patternLocator.matchReportReference(node, enclosingElement, method.binding, method.scope, level.intValue(), this); + } + return; + } + // finegrain reporting + FineGrainVisitor visitor = new FineGrainVisitor(enclosingElement, method.binding, nodeSet, nodes, this.patternLocator, this); + try { + ClassScope classScope = method.scope == null ? null : method.scope.classScope(); + method.traverse(visitor, classScope); + } catch (WrappedCoreException e) { + throw e.coreException; } - return; } } - for (int i = 0, l = nodes.length; i < l; i++) + // Remove all remaining nodes + for (int i = 0, l = nodes.length; i < l; i++) { nodeSet.matchingNodes.removeKey(nodes[i]); + } } } } @@ -2072,7 +2089,7 @@ // Look for annotation type ref TypeReference typeRef = annotationType.type; Integer level = (Integer) nodeSet.matchingNodes.removeKey(typeRef); - if (level != null && matchedContainer) { + if (level != null && matchedContainer && (this.patternFineGrain == 0 || (this.patternFineGrain & IJavaSearchConstants.ANNOTATION_TYPE_REFERENCE) != 0)) { this.patternLocator.matchReportReference(typeRef, enclosingElement, elementBinding, level.intValue(), this); } @@ -2081,7 +2098,7 @@ for (int j = 0, pl = pairs.length; j < pl; j++) { MemberValuePair pair = pairs[j]; level = (Integer) nodeSet.matchingNodes.removeKey(pair); - if (level != null && enclosesElement) { + if (level != null && enclosesElement && this.patternFineGrain == 0) { ASTNode reference = (annotationType instanceof SingleMemberAnnotation) ? (ASTNode) annotationType: pair; this.patternLocator.matchReportReference(reference, enclosingElement, pair.binding, level.intValue(), this); } @@ -2094,7 +2111,7 @@ for (int j = 0, nl = nodes.length; j < nl; j++) { nodeSet.matchingNodes.removeKey(nodes[j]); } - } else { + } else if (this.patternFineGrain == 0) { for (int j = 0, nl = nodes.length; j < nl; j++) { ASTNode node = nodes[j]; level = (Integer) nodeSet.matchingNodes.removeKey(node); @@ -2135,11 +2152,13 @@ // import ref cannot be in the hierarchy of a type if (this.hierarchyResolver != null) continue; - ImportReference importRef = (ImportReference) node; - Binding binding = (importRef.bits & ASTNode.OnDemand) != 0 - ? unitScope.getImport(CharOperation.subarray(importRef.tokens, 0, importRef.tokens.length), true, importRef.isStatic()) - : unitScope.getImport(importRef.tokens, false, importRef.isStatic()); - this.patternLocator.matchLevelAndReportImportRef(importRef, binding, this); + if (this.patternFineGrain == 0 || (this.patternFineGrain & IJavaSearchConstants.IMPORT_DECLARATION_TYPE_REFERENCE) != 0) { + ImportReference importRef = (ImportReference) node; + Binding binding = (importRef.bits & ASTNode.OnDemand) != 0 + ? unitScope.getImport(CharOperation.subarray(importRef.tokens, 0, importRef.tokens.length), true, importRef.isStatic()) + : unitScope.getImport(importRef.tokens, false, importRef.isStatic()); + this.patternLocator.matchLevelAndReportImportRef(importRef, binding, this); + } } else { nodeSet.addMatch(node, this.patternLocator.resolveLevel(node)); } @@ -2161,7 +2180,7 @@ boolean matchedUnitContainer = (this.matchContainer & PatternLocator.COMPILATION_UNIT_CONTAINER) != 0; // report references in javadoc - if (unit.javadoc != null) { + if (unit.javadoc != null && this.patternFineGrain == 0) { ASTNode[] nodes = nodeSet.matchingNodes(unit.javadoc.sourceStart, unit.javadoc.sourceEnd); if (nodes != null) { if (!matchedUnitContainer) { @@ -2172,8 +2191,9 @@ for (int i = 0, l = nodes.length; i < l; i++) { ASTNode node = nodes[i]; Integer level = (Integer) nodeSet.matchingNodes.removeKey(node); - if (encloses(element)) + if (encloses(element) && this.patternFineGrain == 0) { this.patternLocator.matchReportReference(node, element, null/*no binding*/, level.intValue(), this); + } } } } @@ -2193,11 +2213,8 @@ for (int i = 0, l = imports.length; i < l; i++) { ImportReference importRef = imports[i]; Integer level = (Integer) nodeSet.matchingNodes.removeKey(importRef); - if (level != null) { - Binding binding = (importRef.bits & ASTNode.OnDemand) != 0 - ? unitScope.getImport(CharOperation.subarray(importRef.tokens, 0, importRef.tokens.length), true, importRef.isStatic()) - : unitScope.getImport(importRef.tokens, false, importRef.isStatic()); - this.patternLocator.matchReportImportRef(importRef, binding, createImportHandle(importRef), level.intValue(), this); + if (level != null && (this.patternFineGrain == 0 || (this.patternFineGrain & IJavaSearchConstants.IMPORT_DECLARATION_TYPE_REFERENCE) != 0)) { + this.patternLocator.matchReportImportRef(importRef, null /*no binding*/, createImportHandle(importRef), level.intValue(), this); } } } @@ -2270,22 +2287,37 @@ if (enclosingElement == null) enclosingElement = createHandle(field, type, parent); if (encloses(enclosingElement)) { - for (int i = 0, l = nodes.length; i < l; i++) { - ASTNode node = nodes[i]; - Integer level = (Integer) nodeSet.matchingNodes.removeKey(node); - IJavaElement[] otherElements = null; - if (otherFields != null) { - int length = otherFields.length; - int size = 0; - while (size -1 && encloses(enclosingElement)) { int offset = typeParameter.sourceStart; SearchMatch match = this.patternLocator.newDeclarationMatch(typeParameter, enclosingElement, binding, level.intValue(), typeParameter.sourceEnd-offset+1, this); @@ -2497,7 +2555,7 @@ } if (typeParameter.type != null) { level = (Integer) nodeSet.matchingNodes.removeKey(typeParameter.type); - if (level != null) { + if (level != null && typeParameterBoundShouldBeReported) { IJavaElement localElement = createHandle(typeParameter, enclosingElement); this.patternLocator.matchReportReference(typeParameter.type, enclosingElement, localElement, null, binding, level.intValue(), this); } @@ -2508,11 +2566,11 @@ for (int k=0; k *
  • for fields search, pattern will ignore field type
  • *
  • this flag will have no effect for types search
  • * + * * @since 3.1 + * @category limitTo */ int IGNORE_RETURN_TYPE = 0x20; + /** + * Return only references to type used in field type declaration. + *

    + * When this flag is used, only {@link TypeReferenceMatch} matches will be + * returned. + *

    + * @since 3.4 + * @category limitTo + */ + int FIELD_TYPE_DECLARATION_TYPE_REFERENCE = 0x40; + + /** + * Return only references to type used in local variable declaration. + *

    + * When this flag is used, only {@link TypeReferenceMatch} matches will be + * returned. + *

    + * @since 3.4 + * @category limitTo + */ + int LOCAL_VARIABLE_DECLARATION_TYPE_REFERENCE = 0x80; + + /** + * Return only references to type used in method parameter declaration. + *

    + * When this flag is used, only {@link TypeReferenceMatch} matches will be + * returned. + *

    + * @since 3.4 + * @category limitTo + */ + int PARAMETER_TYPE_DECLARATION_TYPE_REFERENCE = 0x100; + + /** + * Return only references to type used as super type. + *

    + * When this flag is used, only {@link TypeReferenceMatch} matches will be + * returned. + *

    + * @since 3.4 + * @category limitTo + */ + int SUPERTYPE_TYPE_REFERENCE = 0x200; + + /** + * Return only references to type used as super interface. + *

    + * When this flag is used, only {@link TypeReferenceMatch} matches will be + * returned. + *

    + * @since 3.4 + * @category limitTo + */ + int SUPERINTERFACE_TYPE_REFERENCE = 0x400; + + /** + * Return only references to types used in throws clause. + *

    + * When this flag is used, only {@link TypeReferenceMatch} matches will be + * returned. + *

    + * @since 3.4 + * @category limitTo + */ + int THROWS_CLAUSE_TYPE_REFERENCE = 0x800; + + /** + * Return only reference to types used in a cast expression. + *

    + * When this flag is used, only {@link TypeReferenceMatch} matches will be + * returned. + *

    + * @since 3.4 + * @category limitTo + */ + int CAST_TYPE_REFERENCE = 0x1000; + + /** + * Return only reference to types used in a catch header. + *

    + * When this flag is used, only {@link TypeReferenceMatch} matches will be + * returned. + *

    + * @since 3.4 + * @category limitTo + */ + int CATCH_TYPE_REFERENCE = 0x2000; + + /** + * Return only reference to types used in an allocation expression. + *

    + * When this flag is used, only {@link TypeReferenceMatch} matches will be + * returned. + *

    + * @since 3.4 + * @category limitTo + */ + int ALLOCATION_EXPRESSION_TYPE_REFERENCE = 0x4000; + + /** + * Return only reference to types used as method return type. + *

    + * When this flag is used, only {@link TypeReferenceMatch} matches will be + * returned. + *

    + * @since 3.4 + * @category limitTo + */ + int RETURN_TYPE_REFERENCE = 0x8000; + + /** + * Return only reference to types used in import declaration. + *

    + * When this flag is used, only {@link TypeReferenceMatch} matches will be + * returned. + *

    + * @since 3.4 + * @category limitTo + */ + int IMPORT_DECLARATION_TYPE_REFERENCE = 0x10000; + + /** + * Return only reference to types used as annotation. + *

    + * When this flag is used, only {@link TypeReferenceMatch} matches will be + * returned. + *

    + * @since 3.4 + * @category limitTo + */ + int ANNOTATION_TYPE_REFERENCE = 0x20000; + + /** + * Return only reference to types used as type variable bound. + *

    + * When this flag is used, only {@link TypeReferenceMatch} matches will be + * returned. + *

    + * @since 3.4 + * @category limitTo + */ + int TYPE_VARIABLE_BOUND_TYPE_REFERENCE = 0x40000; + + /** + * Return only reference to types used as parameterized type. + *

    + * When this flag is used, only {@link TypeReferenceMatch} matches will be + * returned. + *

    + * @since 3.4 + * @category limitTo + */ + int PARAMETERIZED_TYPE_REFERENCE = 0x80000; + + /** + * Return only reference to types used as wildcard bound. + *

    + * When this flag is used, only {@link TypeReferenceMatch} matches will be + * returned. + *

    + * @since 3.4 + * @category limitTo + */ + int WILDCARD_BOUND_TYPE_REFERENCE = 0x100000; + + /** + * Return only super field accesses or method invocations (e.g. using + * super qualifier). + *

    + * When this flag is used, the kind of returned matches will depend on the + * specified nature of searched element: + *

      + *
    • for {@link #FIELD} nature, only {@link FieldReferenceMatch} matches + * will be accepted,
    • + *
    • for {@link #METHOD} nature, only {@link MethodReferenceMatch} + * matches will be returned
    • + *
    + *

    + * @since 3.4 + * @category limitTo + */ + int SUPER_REFERENCE = 0x1000000; + + /** + * Return only qualified field accesses or method invocations. + *

    + * When this flag is used, the kind of returned matches will depend on the + * specified nature of searched element: + *

      + *
    • for {@link #FIELD} nature, only {@link FieldReferenceMatch} matches + * will be accepted,
    • + *
    • for {@link #METHOD} nature, only {@link MethodReferenceMatch} + * matches will be returned
    • + *
    + *

    + * @since 3.4 + * @category limitTo + */ + int QUALIFIED_REFERENCE = 0x2000000; + + /** + * Return only primary field accesses or method invocations (e.g. using + * this qualifier). + *

    + * When this flag is used, the kind of returned matches will depend on the + * specified nature of searched element: + *

      + *
    • for {@link #FIELD} nature, only {@link FieldReferenceMatch} matches + * will be accepted,
    • + *
    • for {@link #METHOD} nature, only {@link MethodReferenceMatch} + * matches will be returned
    • + *
    + *

    + * @since 3.4 + * @category limitTo + */ + int THIS_REFERENCE = 0x4000000; + + /** + * Return only field accesses or method invocations without any qualification. + *

    + * When this flag is used, the kind of returned matches will depend on the + * specified nature of searched element: + *

      + *
    • for {@link #FIELD} nature, only {@link FieldReferenceMatch} matches + * will be accepted,
    • + *
    • for {@link #METHOD} nature, only {@link MethodReferenceMatch} + * matches will be returned
    • + *
    + *

    + * @since 3.4 + * @category limitTo + */ + int IMPLICIT_THIS_REFERENCE = 0x8000000; +// +// /** +// * Return only super field accesses (e.g. using super +// * qualifier). +// *

    +// * When this flag is used, only {@link FieldReferenceMatch type reference +// * matches} will be returned. +// *

    +// * @since 3.4 +// * @category limitTo +// */ +// int SUPER_FIELD_REFERENCE = 0x1000000; +// +// /** +// * Return only qualified field accesses. +// *

    +// * When this flag is used, only {@link FieldReferenceMatch type reference +// * matches} will be returned. +// *

    +// * @since 3.4 +// * @category limitTo +// */ +// int QUALIFIED_FIELD_REFERENCE = 0x2000000; +// +// /** +// * Return only primary field accesses (e.g. using this +// * qualifier). +// *

    +// * When this flag is used, only {@link FieldReferenceMatch type reference +// * matches} will be returned. +// *

    +// * @since 3.4 +// * @category limitTo +// */ +// int THIS_FIELD_REFERENCE = 0x4000000; +// +// /** +// * Return only field accesses without any qualification. +// *

    +// * When this flag is used, only {@link FieldReferenceMatch type reference +// * matches} will be returned. +// *

    +// * @since 3.4 +// * @category limitTo +// */ +// int SIMPLE_FIELD_REFERENCE = 0x8000000; +// +// /** +// * Return only super method invocations (e.g. using super +// * qualifier). +// *

    +// * When this flag is used, only {@link MethodReferenceMatch type reference +// * matches} will be returned. +// *

    +// * @since 3.4 +// * @category limitTo +// */ +// int SUPER_METHOD_REFERENCE = 0x10000000; +// +// /** +// * Return only qualified method invocations. +// *

    +// * When this flag is used, only {@link MethodReferenceMatch type reference +// * matches} will be returned. +// *

    +// * @since 3.4 +// * @category limitTo +// */ +// int QUALIFIED_METHOD_REFERENCE = 0x20000000; +// +// /** +// * Return only primary method invocations (e.g. using this +// * qualifier). +// *

    +// * When this flag is used, only {@link MethodReferenceMatch type reference +// * matches} will be returned. +// *

    +// * @since 3.4 +// * @category limitTo +// */ +// int THIS_METHOD_REFERENCE = 0x40000000; +// +// /** +// * Return only method invocations without any qualification. +// *

    +// * When this flag is used, only {@link MethodReferenceMatch type reference +// * matches} will be returned. +// *

    +// * @since 3.4 +// * @category limitTo +// */ +// int SIMPLE_METHOD_REFERENCE = 0x80000000; + /* Syntactic match modes */ /** * The search pattern matches exactly the search result, * that is, the source of the search result equals the search pattern. + * * @deprecated Use {@link SearchPattern#R_EXACT_MATCH} instead. + * @category matchRule */ int EXACT_MATCH = 0; /** * The search pattern is a prefix of the search result. + * * @deprecated Use {@link SearchPattern#R_PREFIX_MATCH} instead. + * @category matchRule */ int PREFIX_MATCH = 1; /** * The search pattern contains one or more wild cards ('*') where a * wild-card can replace 0 or more characters in the search result. + * * @deprecated Use {@link SearchPattern#R_PATTERN_MATCH} instead. + * @category matchRule */ int PATTERN_MATCH = 2; @@ -202,14 +572,18 @@ /** * The search pattern matches the search result only * if cases are the same. + * * @deprecated Use the methods that take the matchMode * with {@link SearchPattern#R_CASE_SENSITIVE} as a matchRule instead. + * @category matchRule */ boolean CASE_SENSITIVE = true; /** * The search pattern ignores cases in the search result. + * * @deprecated Use the methods that take the matchMode * without {@link SearchPattern#R_CASE_SENSITIVE} as a matchRule instead. + * @category matchRule */ boolean CASE_INSENSITIVE = false; Index: search/org/eclipse/jdt/internal/core/index/DiskIndex.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/index/DiskIndex.java,v retrieving revision 1.65 diff -u -r1.65 DiskIndex.java --- search/org/eclipse/jdt/internal/core/index/DiskIndex.java 16 Aug 2007 10:42:20 -0000 1.65 +++ search/org/eclipse/jdt/internal/core/index/DiskIndex.java 27 Nov 2007 15:09:18 -0000 @@ -46,7 +46,7 @@ private int streamEnd; // used when writing data from the streamBuffer to the file char separator = Index.DEFAULT_SEPARATOR; -public static final String SIGNATURE= "INDEX VERSION 1.124"; //$NON-NLS-1$ +public static final String SIGNATURE= "INDEX VERSION 1.125.3"; //$NON-NLS-1$ private static final char[] SIGNATURE_CHARS = SIGNATURE.toCharArray(); public static boolean DEBUG = false; Index: search/org/eclipse/jdt/internal/core/search/indexing/AbstractIndexer.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/AbstractIndexer.java,v retrieving revision 1.38 diff -u -r1.38 AbstractIndexer.java --- search/org/eclipse/jdt/internal/core/search/indexing/AbstractIndexer.java 6 Mar 2007 02:38:49 -0000 1.38 +++ search/org/eclipse/jdt/internal/core/search/indexing/AbstractIndexer.java 27 Nov 2007 15:09:18 -0000 @@ -31,7 +31,10 @@ SUPER_REF, SuperTypeReferencePattern.createIndexKey( modifiers, packageName, name, enclosingTypeNames, null, ANNOTATION_TYPE_SUFFIX, CharOperation.concatWith(TypeConstants.JAVA_LANG_ANNOTATION_ANNOTATION, '.'), ANNOTATION_TYPE_SUFFIX)); - } + } + public void addAnnotationTypeReference(char[] typeName) { + addIndexEntry(ANNOTATION_REF, CharOperation.lastSegment(typeName, '.')); + } public void addClassDeclaration( int modifiers, char[] packageName, Index: search/org/eclipse/jdt/internal/core/search/indexing/BinaryIndexer.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/BinaryIndexer.java,v retrieving revision 1.65 diff -u -r1.65 BinaryIndexer.java --- search/org/eclipse/jdt/internal/core/search/indexing/BinaryIndexer.java 15 Oct 2007 17:20:14 -0000 1.65 +++ search/org/eclipse/jdt/internal/core/search/indexing/BinaryIndexer.java 27 Nov 2007 15:09:18 -0000 @@ -47,33 +47,33 @@ private void addBinaryStandardAnnotations(long annotationTagBits) { if ((annotationTagBits & TagBits.AnnotationTargetMASK) != 0) { char[][] compoundName = TypeConstants.JAVA_LANG_ANNOTATION_TARGET; - addTypeReference(compoundName[compoundName.length-1]); + addAnnotationTypeReference(compoundName[compoundName.length-1]); addBinaryTargetAnnotation(annotationTagBits); } if ((annotationTagBits & TagBits.AnnotationRetentionMASK) != 0) { char[][] compoundName = TypeConstants.JAVA_LANG_ANNOTATION_RETENTION; - addTypeReference(compoundName[compoundName.length-1]); + addAnnotationTypeReference(compoundName[compoundName.length-1]); addBinaryRetentionAnnotation(annotationTagBits); } if ((annotationTagBits & TagBits.AnnotationDeprecated) != 0) { char[][] compoundName = TypeConstants.JAVA_LANG_DEPRECATED; - addTypeReference(compoundName[compoundName.length-1]); + addAnnotationTypeReference(compoundName[compoundName.length-1]); } if ((annotationTagBits & TagBits.AnnotationDocumented) != 0) { char[][] compoundName = TypeConstants.JAVA_LANG_ANNOTATION_DOCUMENTED; - addTypeReference(compoundName[compoundName.length-1]); + addAnnotationTypeReference(compoundName[compoundName.length-1]); } if ((annotationTagBits & TagBits.AnnotationInherited) != 0) { char[][] compoundName = TypeConstants.JAVA_LANG_ANNOTATION_INHERITED; - addTypeReference(compoundName[compoundName.length-1]); + addAnnotationTypeReference(compoundName[compoundName.length-1]); } if ((annotationTagBits & TagBits.AnnotationOverride) != 0) { char[][] compoundName = TypeConstants.JAVA_LANG_OVERRIDE; - addTypeReference(compoundName[compoundName.length-1]); + addAnnotationTypeReference(compoundName[compoundName.length-1]); } if ((annotationTagBits & TagBits.AnnotationSuppressWarnings) != 0) { char[][] compoundName = TypeConstants.JAVA_LANG_SUPPRESSWARNINGS; - addTypeReference(compoundName[compoundName.length-1]); + addAnnotationTypeReference(compoundName[compoundName.length-1]); } } private void addBinaryTargetAnnotation(long bits) { @@ -147,7 +147,7 @@ } } private void addBinaryAnnotation(IBinaryAnnotation annotation) { - addTypeReference(replace('/', '.', Signature.toCharArray(annotation.getTypeName()))); + addAnnotationTypeReference(replace('/', '.', Signature.toCharArray(annotation.getTypeName()))); IBinaryElementValuePair[] valuePairs = annotation.getElementValuePairs(); if (valuePairs != null) { for (int j=0, vpLength=valuePairs.length; j 0) { + this.parameterizedTypeRef++; + } + return !this.completed; +} + +public void endVisit(MessageSend messageSend, BlockScope scope) { + if (messageSend.typeArguments != null && messageSend.typeArguments.length > 0) { + this.parameterizedTypeRef--; + } + super.endVisit(messageSend, scope); +} + +public boolean visit(TryStatement tryStatement, BlockScope scope) { + if (this.completed) return false; + if ((this.fineGrain & CATCH_TYPE_REFERENCE) != 0) { + Argument[] catchArguments = tryStatement.catchArguments; + if (catchArguments != null) { + int argLength = catchArguments.length; + for (int i=0; i 0 && this.wildcardTypeRef == 0) || + ((this.fineGrain & WILDCARD_BOUND_TYPE_REFERENCE) != 0 && this.wildcardTypeRef > 0)) { + report(singleTypeReference, scope); + } + return !this.completed; +} + +public boolean visit(Wildcard wildcard, BlockScope scope) { + this.wildcardTypeRef++; + return !this.completed; +} + +public boolean visit(Wildcard wildcard, ClassScope scope) { + this.wildcardTypeRef++; + return !this.completed; +} + +public void endVisit(Wildcard wildcard, BlockScope scope) { + this.wildcardTypeRef--; +} + +public void endVisit(Wildcard wildcard, ClassScope scope) { + this.wildcardTypeRef--; +} + +public boolean visit(FieldDeclaration fieldDeclaration, MethodScope scope) { + if (this.completed) return false; + if ((this.fineGrain & FIELD_TYPE_DECLARATION_TYPE_REFERENCE) != 0) { + report(fieldDeclaration.type, scope); + } + return !this.completed; +} + +public boolean visit(FieldReference fieldReference, BlockScope scope) { + if (fieldReference.isSuperAccess() && (this.fineGrain & SUPER_REFERENCE) != 0) { + report(fieldReference, scope); + } + else if (fieldReference.receiver.isThis() && (this.fineGrain & THIS_REFERENCE) != 0) { + report(fieldReference, scope); + } + // Qualified and Implicit This reference are not field reference AST node + // They are respectively caught in visit(QualifiedNameReference) and visit(SingleNameReference) methods + return !this.completed; +} + +public boolean visit(QualifiedTypeReference qualifiedTypeReference, BlockScope scope) { + if (((this.fineGrain & PARAMETERIZED_TYPE_REFERENCE) != 0 && this.parameterizedTypeRef > 0 && this.wildcardTypeRef == 0) || + ((this.fineGrain & WILDCARD_BOUND_TYPE_REFERENCE) != 0 && this.wildcardTypeRef > 0)) { + report(qualifiedTypeReference, scope); + } + return !this.completed; +} + +public boolean visit(AND_AND_Expression and_and_Expression, BlockScope scope) { + return !this.completed; +} + +public boolean visit(AnnotationMethodDeclaration annotationTypeDeclaration, ClassScope scope) { + return !this.completed; +} + +public boolean visit(Argument argument, BlockScope scope) { + return !this.completed; +} + +public boolean visit(Argument argument, ClassScope scope) { + return !this.completed; +} + +public boolean visit(ArrayAllocationExpression arrayAllocationExpression, BlockScope scope) { + return !this.completed; +} + +public boolean visit(ArrayInitializer arrayInitializer, BlockScope scope) { + return !this.completed; +} + +public boolean visit(ArrayQualifiedTypeReference arrayQualifiedTypeReference, BlockScope scope) { + return !this.completed; +} + +public boolean visit(ArrayQualifiedTypeReference arrayQualifiedTypeReference, ClassScope scope) { + return !this.completed; +} + +public boolean visit(ArrayReference arrayReference, BlockScope scope) { + return !this.completed; +} + +public boolean visit(ArrayTypeReference arrayTypeReference, BlockScope scope) { + return !this.completed; +} + +public boolean visit(ArrayTypeReference arrayTypeReference, ClassScope scope) { + return !this.completed; +} + +public boolean visit(AssertStatement assertStatement, BlockScope scope) { + return !this.completed; +} + +public boolean visit(Assignment assignment, BlockScope scope) { + return !this.completed; +} + +public boolean visit(BinaryExpression binaryExpression, BlockScope scope) { + return !this.completed; +} + +public boolean visit(Block block, BlockScope scope) { + return !this.completed; +} + +public boolean visit(BreakStatement breakStatement, BlockScope scope) { + return !this.completed; +} + +public boolean visit(CaseStatement caseStatement, BlockScope scope) { + return !this.completed; +} + +public boolean visit(CharLiteral charLiteral, BlockScope scope) { + return !this.completed; +} + +public boolean visit(ClassLiteralAccess classLiteral, BlockScope scope) { + return !this.completed; +} + +public boolean visit(Clinit clinit, ClassScope scope) { + return !this.completed; +} + +public boolean visit(CompilationUnitDeclaration compilationUnitDeclaration, CompilationUnitScope scope) { + return !this.completed; +} + +public boolean visit(CompoundAssignment compoundAssignment, BlockScope scope) { + return !this.completed; +} + +public boolean visit(ConditionalExpression conditionalExpression, BlockScope scope) { + return !this.completed; +} + +public boolean visit(ContinueStatement continueStatement, BlockScope scope) { + return !this.completed; +} + +public boolean visit(DoStatement doStatement, BlockScope scope) { + return !this.completed; +} + +public boolean visit(DoubleLiteral doubleLiteral, BlockScope scope) { + return !this.completed; +} + +public boolean visit(EmptyStatement emptyStatement, BlockScope scope) { + return !this.completed; +} + +public boolean visit(EqualExpression equalExpression, BlockScope scope) { + return !this.completed; +} + +public boolean visit(ExplicitConstructorCall explicitConstructor, BlockScope scope) { + return !this.completed; +} + +public boolean visit(ExtendedStringLiteral extendedStringLiteral, BlockScope scope) { + return !this.completed; +} + +public boolean visit(FalseLiteral falseLiteral, BlockScope scope) { + return !this.completed; +} + +public boolean visit(FieldReference fieldReference, ClassScope scope) { + return !this.completed; +} + +public boolean visit(FloatLiteral floatLiteral, BlockScope scope) { + return !this.completed; +} + +public boolean visit(ForeachStatement forStatement, BlockScope scope) { + return !this.completed; +} + +public boolean visit(ForStatement forStatement, BlockScope scope) { + return !this.completed; +} + +public boolean visit(IfStatement ifStatement, BlockScope scope) { + return !this.completed; +} + +public boolean visit(Initializer initializer, MethodScope methodScope) { + return !this.completed; +} + +public boolean visit(InstanceOfExpression instanceOfExpression, BlockScope scope) { + return !this.completed; +} + +public boolean visit(IntLiteral intLiteral, BlockScope scope) { + return !this.completed; +} + +public boolean visit(Javadoc javadoc, BlockScope scope) { + return !this.completed; +} + +public boolean visit(Javadoc javadoc, ClassScope scope) { + return !this.completed; +} + +public boolean visit(JavadocAllocationExpression expression, BlockScope scope) { + return !this.completed; +} + +public boolean visit(JavadocAllocationExpression expression, ClassScope scope) { + return !this.completed; +} + +public boolean visit(JavadocArgumentExpression expression, BlockScope scope) { + return !this.completed; +} + +public boolean visit(JavadocArgumentExpression expression, ClassScope scope) { + return !this.completed; +} + +public boolean visit(JavadocArrayQualifiedTypeReference typeRef, BlockScope scope) { + return !this.completed; +} + +public boolean visit(JavadocArrayQualifiedTypeReference typeRef, ClassScope scope) { + return !this.completed; +} + +public boolean visit(JavadocArraySingleTypeReference typeRef, BlockScope scope) { + return !this.completed; +} + +public boolean visit(JavadocArraySingleTypeReference typeRef, ClassScope scope) { + return !this.completed; +} + +public boolean visit(JavadocFieldReference fieldRef, BlockScope scope) { + return !this.completed; +} + +public boolean visit(JavadocFieldReference fieldRef, ClassScope scope) { + return !this.completed; +} + +public boolean visit(JavadocImplicitTypeReference implicitTypeReference, BlockScope scope) { + return !this.completed; +} + +public boolean visit(JavadocImplicitTypeReference implicitTypeReference, ClassScope scope) { + return !this.completed; +} + +public boolean visit(JavadocMessageSend messageSend, BlockScope scope) { + return !this.completed; +} + +public boolean visit(JavadocMessageSend messageSend, ClassScope scope) { + return !this.completed; +} + +public boolean visit(JavadocQualifiedTypeReference typeRef, BlockScope scope) { + return !this.completed; +} + +public boolean visit(JavadocQualifiedTypeReference typeRef, ClassScope scope) { + return !this.completed; +} + +public boolean visit(JavadocReturnStatement statement, BlockScope scope) { + return !this.completed; +} + +public boolean visit(JavadocReturnStatement statement, ClassScope scope) { + return !this.completed; +} + +public boolean visit(JavadocSingleNameReference argument, BlockScope scope) { + return !this.completed; +} + +public boolean visit(JavadocSingleNameReference argument, ClassScope scope) { + return !this.completed; +} + +public boolean visit(JavadocSingleTypeReference typeRef, BlockScope scope) { + return !this.completed; +} + +public boolean visit(JavadocSingleTypeReference typeRef, ClassScope scope) { + return !this.completed; +} + +public boolean visit(LabeledStatement labeledStatement, BlockScope scope) { + return !this.completed; +} + +public boolean visit(LongLiteral longLiteral, BlockScope scope) { + return !this.completed; +} + +public boolean visit(MarkerAnnotation annotation, BlockScope scope) { + return !this.completed; +} + +public boolean visit(MemberValuePair pair, BlockScope scope) { + return !this.completed; +} + +public boolean visit(NormalAnnotation annotation, BlockScope scope) { + return !this.completed; +} + +public boolean visit(NullLiteral nullLiteral, BlockScope scope) { + return !this.completed; +} + +public boolean visit(OR_OR_Expression or_or_Expression, BlockScope scope) { + return !this.completed; +} + +public boolean visit(PostfixExpression postfixExpression, BlockScope scope) { + return !this.completed; +} + +public boolean visit(PrefixExpression prefixExpression, BlockScope scope) { + return !this.completed; +} + +public boolean visit(QualifiedAllocationExpression qualifiedAllocationExpression, BlockScope scope) { + return !this.completed; +} + +public boolean visit(QualifiedNameReference qualifiedNameReference, ClassScope scope) { + return !this.completed; +} + +public boolean visit(QualifiedSuperReference qualifiedSuperReference, BlockScope scope) { + return !this.completed; +} + +public boolean visit(QualifiedSuperReference qualifiedSuperReference, ClassScope scope) { + return !this.completed; +} + +public boolean visit(QualifiedThisReference qualifiedThisReference, BlockScope scope) { + return !this.completed; +} + +public boolean visit(QualifiedThisReference qualifiedThisReference, ClassScope scope) { + return !this.completed; +} + +public boolean visit(QualifiedTypeReference qualifiedTypeReference, ClassScope scope) { + return !this.completed; +} + +public boolean visit(ReturnStatement returnStatement, BlockScope scope) { + return !this.completed; +} + +public boolean visit(SingleMemberAnnotation annotation, BlockScope scope) { + return !this.completed; +} + +public boolean visit(SingleNameReference singleNameReference, ClassScope scope) { + return !this.completed; +} + +public boolean visit(SingleTypeReference singleTypeReference, ClassScope scope) { + return !this.completed; +} + +public boolean visit(StringLiteral stringLiteral, BlockScope scope) { + return !this.completed; +} + +public boolean visit(StringLiteralConcatenation literal, BlockScope scope) { + return !this.completed; +} + +public boolean visit(SuperReference superReference, BlockScope scope) { + return !this.completed; +} + +public boolean visit(SwitchStatement switchStatement, BlockScope scope) { + return !this.completed; +} + +public boolean visit(SynchronizedStatement synchronizedStatement, BlockScope scope) { + return !this.completed; +} + +public boolean visit(ThisReference thisReference, BlockScope scope) { + return !this.completed; +} + +public boolean visit(ThisReference thisReference, ClassScope scope) { + return !this.completed; +} + +public boolean visit(ThrowStatement throwStatement, BlockScope scope) { + return !this.completed; +} + +public boolean visit(TrueLiteral trueLiteral, BlockScope scope) { + return !this.completed; +} + +public boolean visit(TypeDeclaration localTypeDeclaration, BlockScope scope) { + return !this.completed; +} + +public boolean visit(TypeDeclaration memberTypeDeclaration, ClassScope scope) { + return !this.completed; +} + +public boolean visit(TypeDeclaration typeDeclaration, CompilationUnitScope scope) { + return !this.completed; +} + +public boolean visit(TypeParameter typeParameter, BlockScope scope) { + return !this.completed; +} + +public boolean visit(TypeParameter typeParameter, ClassScope scope) { + return !this.completed; +} + +public boolean visit(UnaryExpression unaryExpression, BlockScope scope) { + return !this.completed; +} + +public boolean visit(WhileStatement whileStatement, BlockScope scope) { + return !this.completed; +} + +} #P org.eclipse.jdt.core.tests.compiler Index: src/org/eclipse/jdt/core/tests/compiler/parser/SourceElementParserTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceElementParserTest.java,v retrieving revision 1.39 diff -u -r1.39 SourceElementParserTest.java --- src/org/eclipse/jdt/core/tests/compiler/parser/SourceElementParserTest.java 22 Nov 2007 11:51:54 -0000 1.39 +++ src/org/eclipse/jdt/core/tests/compiler/parser/SourceElementParserTest.java 27 Nov 2007 15:09:24 -0000 @@ -50,6 +50,14 @@ return buildAllCompliancesTestSuite(SourceElementParserTest.class); } /** + * acceptAnnotationTypeReference method comment. + */ +public void acceptAnnotationTypeReference(char[][] typeName, int sourceStart, int sourceEnd) {} +/** + * acceptAnnotationTypeReference method comment. + */ +public void acceptAnnotationTypeReference(char[] typeName, int sourcePosition) {} +/** * acceptConstructorReference method comment. */ public void acceptConstructorReference(char[] typeName, int argCount, int sourcePosition) { Index: src/org/eclipse/jdt/core/tests/compiler/parser/TestSourceElementRequestor.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestSourceElementRequestor.java,v retrieving revision 1.20 diff -u -r1.20 TestSourceElementRequestor.java --- src/org/eclipse/jdt/core/tests/compiler/parser/TestSourceElementRequestor.java 22 Nov 2007 11:51:53 -0000 1.20 +++ src/org/eclipse/jdt/core/tests/compiler/parser/TestSourceElementRequestor.java 27 Nov 2007 15:09:24 -0000 @@ -23,6 +23,14 @@ super(); } /** + * acceptAnnotationTypeReference method comment. + */ +public void acceptAnnotationTypeReference(char[][] typeName, int sourceStart, int sourceEnd) {} +/** + * acceptAnnotationTypeReference method comment. + */ +public void acceptAnnotationTypeReference(char[] typeName, int sourcePosition) {} +/** * acceptConstructorReference method comment. */ public void acceptConstructorReference(char[] typeName, int argCount, int sourcePosition) {}