### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core 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.28 diff -u -r1.28 JavaSearchPattern.java --- search/org/eclipse/jdt/internal/core/search/matching/JavaSearchPattern.java 3 Dec 2007 12:02:05 -0000 1.28 +++ search/org/eclipse/jdt/internal/core/search/matching/JavaSearchPattern.java 4 Dec 2007 22:31:07 -0000 @@ -115,9 +115,6 @@ case IJavaSearchConstants.SUPERTYPE_TYPE_REFERENCE: buffer.append("SUPERTYPE_TYPE_REFERENCE"); //$NON-NLS-1$ break; - case IJavaSearchConstants.SUPERINTERFACE_TYPE_REFERENCE: - buffer.append("SUPERINTERFACE_TYPE_REFERENCE"); //$NON-NLS-1$ - break; case IJavaSearchConstants.THROWS_CLAUSE_TYPE_REFERENCE: buffer.append("THROWS_CLAUSE_TYPE_REFERENCE"); //$NON-NLS-1$ break; @@ -127,8 +124,8 @@ case IJavaSearchConstants.CATCH_TYPE_REFERENCE: buffer.append("CATCH_TYPE_REFERENCE"); //$NON-NLS-1$ break; - case IJavaSearchConstants.ALLOCATION_EXPRESSION_TYPE_REFERENCE: - buffer.append("ALLOCATION_EXPRESSION_TYPE_REFERENCE"); //$NON-NLS-1$ + case IJavaSearchConstants.CLASS_INSTANCE_CREATION_TYPE_REFERENCE: + buffer.append("CLASS_INSTANCE_CREATION_TYPE_REFERENCE"); //$NON-NLS-1$ break; case IJavaSearchConstants.RETURN_TYPE_REFERENCE: buffer.append("RETURN_TYPE_REFERENCE"); //$NON-NLS-1$ Index: search/org/eclipse/jdt/internal/core/search/matching/MatchLocatorParser.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocatorParser.java,v retrieving revision 1.80 diff -u -r1.80 MatchLocatorParser.java --- search/org/eclipse/jdt/internal/core/search/matching/MatchLocatorParser.java 3 Dec 2007 12:02:05 -0000 1.80 +++ search/org/eclipse/jdt/internal/core/search/matching/MatchLocatorParser.java 4 Dec 2007 22:31:08 -0000 @@ -188,7 +188,7 @@ super.classInstanceCreation(alwaysQualified); if (this.patternFineGrain == 0) { this.patternLocator.match(this.expressionStack[this.expressionPtr], this.nodeSet); - } else if ((this.patternFineGrain & IJavaSearchConstants.ALLOCATION_EXPRESSION_TYPE_REFERENCE) != 0) { + } else if ((this.patternFineGrain & IJavaSearchConstants.CLASS_INSTANCE_CREATION_TYPE_REFERENCE) != 0) { AllocationExpression allocation = (AllocationExpression) this.expressionStack[this.expressionPtr]; this.patternLocator.match(allocation.type, this.nodeSet); } @@ -204,12 +204,14 @@ protected void consumeAssignment() { super.consumeAssignment(); - this.patternLocator.match(this.expressionStack[this.expressionPtr], this.nodeSet); + if (this.patternFineGrain == 0) { + this.patternLocator.match(this.expressionStack[this.expressionPtr], this.nodeSet); + } } protected void consumeCastExpressionLL1() { super.consumeCastExpressionLL1(); - if (this.patternFineGrain == 0 || (this.patternFineGrain & IJavaSearchConstants.CAST_TYPE_REFERENCE) != 0) { + if ((this.patternFineGrain & IJavaSearchConstants.CAST_TYPE_REFERENCE) != 0) { CastExpression castExpression = (CastExpression) this.expressionStack[this.expressionPtr]; if (castExpression.type instanceof Reference) { this.patternLocator.match((Reference) castExpression.type, this.nodeSet); @@ -218,7 +220,7 @@ } protected void consumeCastExpressionWithGenericsArray() { super.consumeCastExpressionWithGenericsArray(); - if (this.patternFineGrain == 0 || (this.patternFineGrain & IJavaSearchConstants.CAST_TYPE_REFERENCE) != 0) { + if ((this.patternFineGrain & IJavaSearchConstants.CAST_TYPE_REFERENCE) != 0) { CastExpression castExpression = (CastExpression) this.expressionStack[this.expressionPtr]; if (castExpression.type instanceof Reference) { this.patternLocator.match((Reference) castExpression.type, this.nodeSet); @@ -227,7 +229,7 @@ } protected void consumeCastExpressionWithNameArray() { super.consumeCastExpressionWithNameArray(); - if (this.patternFineGrain == 0 || (this.patternFineGrain & IJavaSearchConstants.CAST_TYPE_REFERENCE) != 0) { + if ((this.patternFineGrain & IJavaSearchConstants.CAST_TYPE_REFERENCE) != 0) { CastExpression castExpression = (CastExpression) this.expressionStack[this.expressionPtr]; if (castExpression.type instanceof Reference) { this.patternLocator.match((Reference) castExpression.type, this.nodeSet); @@ -236,7 +238,7 @@ } protected void consumeCastExpressionWithPrimitiveType() { super.consumeCastExpressionWithPrimitiveType(); - if (this.patternFineGrain == 0 || (this.patternFineGrain & IJavaSearchConstants.CAST_TYPE_REFERENCE) != 0) { + if ((this.patternFineGrain & IJavaSearchConstants.CAST_TYPE_REFERENCE) != 0) { CastExpression castExpression = (CastExpression) this.expressionStack[this.expressionPtr]; if (castExpression.type instanceof Reference) { this.patternLocator.match((Reference) castExpression.type, this.nodeSet); @@ -245,7 +247,7 @@ } protected void consumeCastExpressionWithQualifiedGenericsArray() { super.consumeCastExpressionWithQualifiedGenericsArray(); - if (this.patternFineGrain == 0 || (this.patternFineGrain & IJavaSearchConstants.CAST_TYPE_REFERENCE) != 0) { + if ((this.patternFineGrain & IJavaSearchConstants.CAST_TYPE_REFERENCE) != 0) { CastExpression castExpression = (CastExpression) this.expressionStack[this.expressionPtr]; if (castExpression.type instanceof Reference) { this.patternLocator.match((Reference) castExpression.type, this.nodeSet); @@ -263,12 +265,22 @@ protected void consumeClassInstanceCreationExpressionQualifiedWithTypeArguments() { super.consumeClassInstanceCreationExpressionWithTypeArguments(); - this.patternLocator.match(this.expressionStack[this.expressionPtr], this.nodeSet); + if (this.patternFineGrain == 0) { + this.patternLocator.match(this.expressionStack[this.expressionPtr], this.nodeSet); + } else if ((this.patternFineGrain & IJavaSearchConstants.CLASS_INSTANCE_CREATION_TYPE_REFERENCE) != 0) { + AllocationExpression allocation = (AllocationExpression) this.expressionStack[this.expressionPtr]; + this.patternLocator.match(allocation.type, this.nodeSet); + } } protected void consumeClassInstanceCreationExpressionWithTypeArguments() { super.consumeClassInstanceCreationExpressionWithTypeArguments(); - this.patternLocator.match(this.expressionStack[this.expressionPtr], this.nodeSet); + if (this.patternFineGrain == 0) { + this.patternLocator.match(this.expressionStack[this.expressionPtr], this.nodeSet); + } else if ((this.patternFineGrain & IJavaSearchConstants.CLASS_INSTANCE_CREATION_TYPE_REFERENCE) != 0) { + AllocationExpression allocation = (AllocationExpression) this.expressionStack[this.expressionPtr]; + this.patternLocator.match(allocation.type, this.nodeSet); + } } protected void consumeEnterVariable() { @@ -312,7 +324,7 @@ protected void consumeInterfaceType() { super.consumeInterfaceType(); - if ((this.patternFineGrain & IJavaSearchConstants.SUPERINTERFACE_TYPE_REFERENCE) != 0) { + if ((this.patternFineGrain & IJavaSearchConstants.SUPERTYPE_TYPE_REFERENCE) != 0) { TypeReference typeReference = (TypeReference) this.astStack[this.astPtr]; this.patternLocator.match(typeReference, this.nodeSet); } @@ -729,18 +741,19 @@ NameReference nameRef = super.getUnspecifiedReferenceOptimized(); if (this.patternFineGrain == 0) { this.patternLocator.match(nameRef, this.nodeSet); // NB: Don't check container since unspecified reference can happen anywhere - } - boolean flagQualifiedRef = (this.patternFineGrain & IJavaSearchConstants.QUALIFIED_REFERENCE) != 0; - boolean flagImplicitThis = (this.patternFineGrain & IJavaSearchConstants.IMPLICIT_THIS_REFERENCE) != 0; - if (flagQualifiedRef && flagImplicitThis) { - this.patternLocator.match(nameRef, this.nodeSet); - } else if (flagQualifiedRef) { - if (nameRef instanceof QualifiedNameReference) { - this.patternLocator.match(nameRef, this.nodeSet); - } - } else if (flagImplicitThis) { - if (nameRef instanceof SingleNameReference) { + } else { + boolean flagQualifiedRef = (this.patternFineGrain & IJavaSearchConstants.QUALIFIED_REFERENCE) != 0; + boolean flagImplicitThis = (this.patternFineGrain & IJavaSearchConstants.IMPLICIT_THIS_REFERENCE) != 0; + if (flagQualifiedRef && flagImplicitThis) { this.patternLocator.match(nameRef, this.nodeSet); + } else if (flagQualifiedRef) { + if (nameRef instanceof QualifiedNameReference) { + this.patternLocator.match(nameRef, this.nodeSet); + } + } else if (flagImplicitThis) { + if (nameRef instanceof SingleNameReference) { + this.patternLocator.match(nameRef, this.nodeSet); + } } } return nameRef; Index: search/org/eclipse/jdt/core/search/IJavaSearchConstants.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/IJavaSearchConstants.java,v retrieving revision 1.29 diff -u -r1.29 IJavaSearchConstants.java --- search/org/eclipse/jdt/core/search/IJavaSearchConstants.java 28 Nov 2007 14:25:40 -0000 1.29 +++ search/org/eclipse/jdt/core/search/IJavaSearchConstants.java 4 Dec 2007 22:31:07 -0000 @@ -248,7 +248,7 @@ int PARAMETER_DECLARATION_TYPE_REFERENCE = 0x100; /** - * Return only type references used as a super type. + * Return only type references used as a super type or as a super interface. *

* When this flag is set, only {@link TypeReferenceMatch} matches will be * returned. @@ -259,17 +259,6 @@ int SUPERTYPE_TYPE_REFERENCE = 0x200; /** - * Return only type references used as a super interface. - *

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

- * @since 3.4 - * @category limitTo - */ - int SUPERINTERFACE_TYPE_REFERENCE = 0x400; - - /** * Return only type references used in a throws clause. *

* When this flag is set, only {@link TypeReferenceMatch} matches will be @@ -278,7 +267,7 @@ * @since 3.4 * @category limitTo */ - int THROWS_CLAUSE_TYPE_REFERENCE = 0x800; + int THROWS_CLAUSE_TYPE_REFERENCE = 0x400; /** * Return only type references used in a cast expression. @@ -289,7 +278,7 @@ * @since 3.4 * @category limitTo */ - int CAST_TYPE_REFERENCE = 0x1000; + int CAST_TYPE_REFERENCE = 0x800; /** * Return only type references used in a catch header. @@ -300,18 +289,32 @@ * @since 3.4 * @category limitTo */ - int CATCH_TYPE_REFERENCE = 0x2000; + int CATCH_TYPE_REFERENCE = 0x1000; /** - * Return only type references used in an allocation expression. + * Return only type references used in class instance creation. *

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

+ *

+ * Example: + *

+	 * public class Test {
+	 * 	Test() {}
+	 * 	static Test bar()  {
+	 * 		return new Test();
+	 * 	}
+	 * }
+	 *
+ * Searching references to the type Test using this flag in the + * above snippet will match only the reference in italic. + *

+ * Note that array creations are not returned when using this flag. + *

* @since 3.4 * @category limitTo */ - int ALLOCATION_EXPRESSION_TYPE_REFERENCE = 0x4000; + int CLASS_INSTANCE_CREATION_TYPE_REFERENCE = 0x2000; /** * Return only type references used as a method return type. @@ -322,7 +325,7 @@ * @since 3.4 * @category limitTo */ - int RETURN_TYPE_REFERENCE = 0x8000; + int RETURN_TYPE_REFERENCE = 0x4000; /** * Return only type references used in an import declaration. @@ -333,7 +336,7 @@ * @since 3.4 * @category limitTo */ - int IMPORT_DECLARATION_TYPE_REFERENCE = 0x10000; + int IMPORT_DECLARATION_TYPE_REFERENCE = 0x8000; /** * Return only type references used as an annotation. @@ -344,7 +347,7 @@ * @since 3.4 * @category limitTo */ - int ANNOTATION_TYPE_REFERENCE = 0x20000; + int ANNOTATION_TYPE_REFERENCE = 0x10000; /** * Return only type references used as a type argument in a parameterized @@ -356,7 +359,7 @@ * @since 3.4 * @category limitTo */ - int TYPE_ARGUMENT_TYPE_REFERENCE = 0x40000; + int TYPE_ARGUMENT_TYPE_REFERENCE = 0x20000; /** * Return only type references used as a type variable bound. @@ -367,7 +370,7 @@ * @since 3.4 * @category limitTo */ - int TYPE_VARIABLE_BOUND_TYPE_REFERENCE = 0x80000; + int TYPE_VARIABLE_BOUND_TYPE_REFERENCE = 0x40000; /** * Return only type references used as a wildcard bound. @@ -378,7 +381,7 @@ * @since 3.4 * @category limitTo */ - int WILDCARD_BOUND_TYPE_REFERENCE = 0x100000; + int WILDCARD_BOUND_TYPE_REFERENCE = 0x80000; /** * Return only super field accesses or super method invocations (e.g. using the #P org.eclipse.jdt.core.tests.model Index: src/org/eclipse/jdt/core/tests/model/SearchTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SearchTests.java,v retrieving revision 1.47 diff -u -r1.47 SearchTests.java --- src/org/eclipse/jdt/core/tests/model/SearchTests.java 3 Dec 2007 12:02:07 -0000 1.47 +++ src/org/eclipse/jdt/core/tests/model/SearchTests.java 4 Dec 2007 22:31:23 -0000 @@ -125,9 +125,6 @@ return "SearchTests.Waiting"; } } -static { - TESTS_PREFIX = "testSearchPatternValidateMatchRule"; -} public static Test suite() { return buildModelTestSuite(SearchTests.class); } @@ -1005,7 +1002,7 @@ * Fine grain patterns */ public void testSearchPatternCreation37() { - int allFlags = 0x0F1FFFF0; + int allFlags = 0xFFFFFFF0; SearchPattern searchPattern = createPattern("*", TYPE, allFlags, true); assertPattern( "TypeReferencePattern: qualification<*>, type<*>, pattern match, case sensitive, generic full match, " + @@ -1013,21 +1010,27 @@ "LOCAL_VARIABLE_DECLARATION_TYPE_REFERENCE | " + "PARAMETER_DECLARATION_TYPE_REFERENCE | " + "SUPERTYPE_TYPE_REFERENCE | " + - "SUPERINTERFACE_TYPE_REFERENCE | " + "THROWS_CLAUSE_TYPE_REFERENCE | " + "CAST_TYPE_REFERENCE | " + "CATCH_TYPE_REFERENCE | " + - "ALLOCATION_EXPRESSION_TYPE_REFERENCE | " + + "CLASS_INSTANCE_CREATION_TYPE_REFERENCE | " + "RETURN_TYPE_REFERENCE | " + "IMPORT_DECLARATION_TYPE_REFERENCE | " + "ANNOTATION_TYPE_REFERENCE | " + "TYPE_ARGUMENT_TYPE_REFERENCE | " + "TYPE_VARIABLE_BOUND_TYPE_REFERENCE | " + "WILDCARD_BOUND_TYPE_REFERENCE | " + + " | " + // unused slots + " | " + + " | " + + " | " + "SUPER_REFERENCE | " + "QUALIFIED_REFERENCE | " + "THIS_REFERENCE | " + - "IMPLICIT_THIS_REFERENCE", + "IMPLICIT_THIS_REFERENCE | " + + " | " + // unused slots + " | " + + " | ", searchPattern); } Index: src/org/eclipse/jdt/core/tests/model/JavaSearchFineGrainTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchFineGrainTests.java,v retrieving revision 1.3 diff -u -r1.3 JavaSearchFineGrainTests.java --- src/org/eclipse/jdt/core/tests/model/JavaSearchFineGrainTests.java 3 Dec 2007 12:02:07 -0000 1.3 +++ src/org/eclipse/jdt/core/tests/model/JavaSearchFineGrainTests.java 4 Dec 2007 22:31:22 -0000 @@ -245,11 +245,10 @@ LOCAL_VARIABLE_DECLARATION_TYPE_REFERENCE | PARAMETER_DECLARATION_TYPE_REFERENCE | SUPERTYPE_TYPE_REFERENCE | - SUPERINTERFACE_TYPE_REFERENCE | THROWS_CLAUSE_TYPE_REFERENCE | CAST_TYPE_REFERENCE | CATCH_TYPE_REFERENCE | - ALLOCATION_EXPRESSION_TYPE_REFERENCE | + CLASS_INSTANCE_CREATION_TYPE_REFERENCE | RETURN_TYPE_REFERENCE | IMPORT_DECLARATION_TYPE_REFERENCE | ANNOTATION_TYPE_REFERENCE | @@ -357,7 +356,7 @@ ); } public void testTypeRef_Allocation() throws CoreException { - search(setUpTypeRef(0), ALLOCATION_EXPRESSION_TYPE_REFERENCE); + search(setUpTypeRef(0), CLASS_INSTANCE_CREATION_TYPE_REFERENCE); assertSearchResults( "src/type/ref/TestTypes.java Types type.ref.TestTypes.method(Types) [ Object obj = new §|Types|§();@253] EXACT_MATCH" ); @@ -412,7 +411,7 @@ } public void testTypeRef_Superinterface() throws CoreException { IType type = setUpTypeRef(0); - search(((ICompilationUnit) type.getParent()).getType("ITest1"), SUPERINTERFACE_TYPE_REFERENCE, getJavaSearchWorkingCopiesScope()); + search(((ICompilationUnit) type.getParent()).getType("ITest1"), SUPERTYPE_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" @@ -535,7 +534,7 @@ } public void testTypeRefAll_Allocation() throws CoreException { setUpTypeRefAll(); - search("*", TYPE, ALLOCATION_EXPRESSION_TYPE_REFERENCE, getJavaSearchWorkingCopiesScope()); + search("*", TYPE, CLASS_INSTANCE_CREATION_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" + @@ -617,21 +616,15 @@ "src/type/def/Bug.java String type.def.Bug.comment() [ §|String|§ comment() default \"\";@65] 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" + "src/type/def/Types.java type.def.Types [public class Types extends §|Exception|§ implements ITest1, ITest2 {@57] EXACT_MATCH\n" + + "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_Throws() throws CoreException { @@ -1246,7 +1239,7 @@ } public void testTypeRefQualifiedAll_Allocation() throws CoreException { setUpTypeRefQualifiedAll(); - search("*", TYPE, ALLOCATION_EXPRESSION_TYPE_REFERENCE, getJavaSearchWorkingCopiesScope()); + search("*", TYPE, CLASS_INSTANCE_CREATION_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" + @@ -1325,21 +1318,15 @@ "src/type/def/Bug.java String type.def.Bug.comment() [ §|String|§ comment() default \"\";@65] 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" + "src/type/def/Types.java type.def.Types [public class Types extends §|Exception|§ implements ITest1, ITest2 {@57] EXACT_MATCH\n" + + "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_Throws() throws CoreException { @@ -2016,4 +2003,27 @@ "src/test13/Test.java void test13.S.bar(S) [ >void bar(S s) {}@558] EXACT_MATCH" ); } +public void testTypeRefGenericsTest15_ClassInstanceCreation() throws CoreException { + workingCopies = new ICompilationUnit[1]; + workingCopies[0] = getWorkingCopy("/JavaSearch15/src/test15/Test.java", + "package test15;\n" + + "public class Test {\n" + + " Test() {}\n" + + " Test(U u) {}\n" + + " static Test foo() {\n" + + " return new Test(\"\");\n" + + " }\n" + + " static Test bar() {\n" + + " return new Test();\n" + + " }\n" + + "}\n" + ); + IType type = workingCopies[0].getType("Test"); + IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] { type }); + search("*", TYPE, CLASS_INSTANCE_CREATION_TYPE_REFERENCE, SearchPattern.R_ERASURE_MATCH, scope); + assertSearchResults( + "src/test15/Test.java Test test15.Test.foo() [ return new §|Test|§(\"\");@108] EXACT_MATCH\n" + + "src/test15/Test.java Test test15.Test.bar() [ return new §|Test|§();@156] EXACT_MATCH" + ); +} }