### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core 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.317 diff -u -r1.317 MatchLocator.java --- search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java 9 Sep 2008 15:39:07 -0000 1.317 +++ search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java 17 Sep 2008 09:57:09 -0000 @@ -1420,7 +1420,7 @@ if (enclosingBinding != null) { enclosingElement = ((JavaElement) enclosingElement).resolved(enclosingBinding); } - FieldReferenceMatch match = new FieldReferenceMatch(enclosingElement, accuracy, offset, length, isReadAccess, isWriteAccess, insideDocComment, participant, resource); + InternalFieldReferenceMatch match = new InternalFieldReferenceMatch(enclosingElement, accuracy, offset, length, isReadAccess, isWriteAccess, insideDocComment, participant, resource); match.localElement(localElement); return match; } @@ -1451,7 +1451,7 @@ return new LocalVariableReferenceMatch(enclosingElement, accuracy, offset, length, isReadAccess, isWriteAccess, insideDocComment, participant, resource); } -public MethodReferenceMatch newMethodReferenceMatch( +public InternalMethodReferenceMatch newMethodReferenceMatch( IJavaElement enclosingElement, Binding enclosingBinding, int accuracy, @@ -1466,10 +1466,10 @@ if (enclosingBinding != null) enclosingElement = ((JavaElement) enclosingElement).resolved(enclosingBinding); boolean isOverridden = (accuracy & PatternLocator.SUPER_INVOCATION_FLAVOR) != 0; - return new MethodReferenceMatch(enclosingElement, accuracy, offset, length, isConstructor, isSynthetic, isOverridden, insideDocComment, participant, resource); + return new InternalMethodReferenceMatch(enclosingElement, accuracy, offset, length, isConstructor, isSynthetic, isOverridden, insideDocComment, participant, resource); } -public PackageReferenceMatch newPackageReferenceMatch( +public InternalPackageReferenceMatch newPackageReferenceMatch( IJavaElement enclosingElement, int accuracy, int offset, @@ -1478,7 +1478,7 @@ SearchParticipant participant = getParticipant(); IResource resource = this.currentPossibleMatch.resource; boolean insideDocComment = (reference.bits & ASTNode.InsideJavadoc) != 0; - return new PackageReferenceMatch(enclosingElement, accuracy, offset, length, insideDocComment, participant, resource); + return new InternalPackageReferenceMatch(enclosingElement, accuracy, offset, length, insideDocComment, participant, resource); } public SearchMatch newTypeParameterReferenceMatch( Index: search/org/eclipse/jdt/internal/core/search/matching/PackageReferenceLocator.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PackageReferenceLocator.java,v retrieving revision 1.44 diff -u -r1.44 PackageReferenceLocator.java --- search/org/eclipse/jdt/internal/core/search/matching/PackageReferenceLocator.java 27 Jun 2008 16:04:00 -0000 1.44 +++ search/org/eclipse/jdt/internal/core/search/matching/PackageReferenceLocator.java 17 Sep 2008 09:57:10 -0000 @@ -16,7 +16,6 @@ import org.eclipse.jdt.core.IPackageFragment; import org.eclipse.jdt.core.IPackageFragmentRoot; import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.core.search.PackageReferenceMatch; import org.eclipse.jdt.core.search.SearchPattern; import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.ast.*; @@ -263,7 +262,7 @@ if (last > positions.length) last = positions.length; int sourceStart = (int) (positions[0] >>> 32); int sourceEnd = ((int) positions[last - 1]); - PackageReferenceMatch packageReferenceMatch = locator.newPackageReferenceMatch(element, accuracy, sourceStart, sourceEnd-sourceStart+1, reference); + InternalPackageReferenceMatch packageReferenceMatch = locator.newPackageReferenceMatch(element, accuracy, sourceStart, sourceEnd-sourceStart+1, reference); packageReferenceMatch.localElement(localElement); this.match = packageReferenceMatch; locator.report(this.match); 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.84 diff -u -r1.84 MethodLocator.java --- search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java 4 Sep 2008 16:37:09 -0000 1.84 +++ search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java 17 Sep 2008 09:57:10 -0000 @@ -333,7 +333,7 @@ reportDeclaration(methodBinding, locator, declPattern.knownMethods); } } else { - MethodReferenceMatch methodReferenceMatch = locator.newMethodReferenceMatch(element, elementBinding, accuracy, -1, -1, false /*not constructor*/, false/*not synthetic*/, reference); + InternalMethodReferenceMatch methodReferenceMatch = locator.newMethodReferenceMatch(element, elementBinding, accuracy, -1, -1, false /*not constructor*/, false/*not synthetic*/, reference); methodReferenceMatch.localElement(localElement); this.match = methodReferenceMatch; if (this.pattern.findReferences && reference instanceof MessageSend) { Index: search/org/eclipse/jdt/internal/core/search/matching/InternalReferenceMatch.java =================================================================== RCS file: search/org/eclipse/jdt/internal/core/search/matching/InternalReferenceMatch.java diff -N search/org/eclipse/jdt/internal/core/search/matching/InternalReferenceMatch.java --- search/org/eclipse/jdt/internal/core/search/matching/InternalReferenceMatch.java 27 Jun 2008 16:04:00 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2008 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.internal.core.search.matching; - -import org.eclipse.core.resources.IResource; -import org.eclipse.jdt.core.*; -import org.eclipse.jdt.core.search.*; - -/** - * An intermediate class to store data in the search match and access them - * in a private manner. - * - * @since 3.4 - */ -public abstract class InternalReferenceMatch extends ReferenceMatch { - - IJavaElement localElement; - -public InternalReferenceMatch(IJavaElement enclosingElement, int accuracy, int offset, int length, boolean insideDocComment, SearchParticipant participant, IResource resource) { - super(enclosingElement, accuracy, offset, length, insideDocComment, participant, resource); -} - -/** - * Return the stored local element. - * - * @see org.eclipse.jdt.core.search.ReferenceMatch#getLocalElement() - */ -protected IJavaElement localElement() { - return this.localElement; -} - -/** - * Store the local element in the match. - * - * @param element The local element to be stored - */ -public void localElement(IJavaElement element) { - this.localElement = element; -} -} Index: search/org/eclipse/jdt/core/search/TypeReferenceMatch.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/TypeReferenceMatch.java,v retrieving revision 1.22 diff -u -r1.22 TypeReferenceMatch.java --- search/org/eclipse/jdt/core/search/TypeReferenceMatch.java 27 Jun 2008 16:04:08 -0000 1.22 +++ search/org/eclipse/jdt/core/search/TypeReferenceMatch.java 17 Sep 2008 09:57:09 -0000 @@ -12,7 +12,6 @@ import org.eclipse.core.resources.IResource; import org.eclipse.jdt.core.*; -import org.eclipse.jdt.internal.core.search.matching.InternalReferenceMatch; /** * A Java search match that represents a type reference. @@ -23,8 +22,9 @@ * * @since 3.0 */ -public class TypeReferenceMatch extends InternalReferenceMatch { +public class TypeReferenceMatch extends ReferenceMatch { + private IJavaElement localElement; private IJavaElement[] otherElements; /** @@ -77,22 +77,30 @@ * @since 3.2 */ public final IJavaElement[] getOtherElements() { - IJavaElement localElement = localElement(); - if (localElement == null || localElement.getElementType() != IJavaElement.ANNOTATION) { + if (this.localElement == null || this.localElement.getElementType() != IJavaElement.ANNOTATION) { return this.otherElements; } return null; } /** + * Return the stored local element. + * + * @see org.eclipse.jdt.core.search.ReferenceMatch#getLocalElement() + */ +protected IJavaElement localElement() { + return this.localElement; +} + +/** * Sets the local element of this search match. * - * @param localElement A more specific local element that corresponds to the match, + * @param element A more specific local element that corresponds to the match, * or null if none * @since 3.2 */ -public final void setLocalElement(IJavaElement localElement) { - localElement(localElement); +public final void setLocalElement(IJavaElement element) { + this.localElement = element; } /** Index: search/org/eclipse/jdt/core/search/FieldReferenceMatch.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/FieldReferenceMatch.java,v retrieving revision 1.19 diff -u -r1.19 FieldReferenceMatch.java --- search/org/eclipse/jdt/core/search/FieldReferenceMatch.java 27 Jun 2008 16:04:08 -0000 1.19 +++ search/org/eclipse/jdt/core/search/FieldReferenceMatch.java 17 Sep 2008 09:57:09 -0000 @@ -12,7 +12,6 @@ import org.eclipse.core.resources.IResource; import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.internal.core.search.matching.InternalReferenceMatch; /** * A Java search match that represents a field reference. @@ -23,7 +22,7 @@ * * @since 3.0 */ -public class FieldReferenceMatch extends InternalReferenceMatch { +public class FieldReferenceMatch extends ReferenceMatch { private boolean isReadAccess; private boolean isWriteAccess; Index: search/org/eclipse/jdt/core/search/MethodReferenceMatch.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/MethodReferenceMatch.java,v retrieving revision 1.27 diff -u -r1.27 MethodReferenceMatch.java --- search/org/eclipse/jdt/core/search/MethodReferenceMatch.java 27 Jun 2008 16:04:08 -0000 1.27 +++ search/org/eclipse/jdt/core/search/MethodReferenceMatch.java 17 Sep 2008 09:57:09 -0000 @@ -12,7 +12,6 @@ import org.eclipse.core.resources.IResource; import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.internal.core.search.matching.InternalReferenceMatch; /** * A Java search match that represents a method reference. @@ -23,7 +22,7 @@ * * @since 3.0 */ -public class MethodReferenceMatch extends InternalReferenceMatch { +public class MethodReferenceMatch extends ReferenceMatch { private boolean constructor; private boolean synthetic; private boolean superInvocation; Index: search/org/eclipse/jdt/core/search/PackageReferenceMatch.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/PackageReferenceMatch.java,v retrieving revision 1.14 diff -u -r1.14 PackageReferenceMatch.java --- search/org/eclipse/jdt/core/search/PackageReferenceMatch.java 27 Jun 2008 16:04:08 -0000 1.14 +++ search/org/eclipse/jdt/core/search/PackageReferenceMatch.java 17 Sep 2008 09:57:09 -0000 @@ -12,7 +12,6 @@ import org.eclipse.core.resources.IResource; import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.internal.core.search.matching.InternalReferenceMatch; /** * A Java search match that represents a package reference. @@ -23,7 +22,7 @@ * * @since 3.0 */ -public class PackageReferenceMatch extends InternalReferenceMatch { +public class PackageReferenceMatch extends ReferenceMatch { /** * Creates a new package reference match. Index: search/org/eclipse/jdt/internal/core/search/matching/InternalMethodReferenceMatch.java =================================================================== RCS file: search/org/eclipse/jdt/internal/core/search/matching/InternalMethodReferenceMatch.java diff -N search/org/eclipse/jdt/internal/core/search/matching/InternalMethodReferenceMatch.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ search/org/eclipse/jdt/internal/core/search/matching/InternalMethodReferenceMatch.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,45 @@ +/******************************************************************************* + * Copyright (c) 2000, 2008 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.internal.core.search.matching; + +import org.eclipse.core.resources.IResource; +import org.eclipse.jdt.core.*; +import org.eclipse.jdt.core.search.*; + +/** + * A field reference match that stores the local element + */ +public class InternalMethodReferenceMatch extends MethodReferenceMatch { + + IJavaElement localElement; + +public InternalMethodReferenceMatch(IJavaElement enclosingElement, int accuracy, int offset, int length, boolean constructor, boolean synthetic, boolean superInvocation, boolean insideDocComment, SearchParticipant participant, IResource resource) { + super(enclosingElement, accuracy, offset, length, constructor, synthetic, superInvocation, insideDocComment, participant, resource); +} + +/** + * Return the stored local element. + * + * @see org.eclipse.jdt.core.search.ReferenceMatch#getLocalElement() + */ +protected IJavaElement localElement() { + return this.localElement; +} + +/** + * Store the local element in the match. + * + * @param element The local element to be stored + */ +public void localElement(IJavaElement element) { + this.localElement = element; +} +} Index: search/org/eclipse/jdt/internal/core/search/matching/InternalFieldReferenceMatch.java =================================================================== RCS file: search/org/eclipse/jdt/internal/core/search/matching/InternalFieldReferenceMatch.java diff -N search/org/eclipse/jdt/internal/core/search/matching/InternalFieldReferenceMatch.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ search/org/eclipse/jdt/internal/core/search/matching/InternalFieldReferenceMatch.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,45 @@ +/******************************************************************************* + * Copyright (c) 2000, 2008 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.internal.core.search.matching; + +import org.eclipse.core.resources.IResource; +import org.eclipse.jdt.core.*; +import org.eclipse.jdt.core.search.*; + +/** + * A method reference match that stores the local element + */ +public class InternalFieldReferenceMatch extends FieldReferenceMatch { + + IJavaElement localElement; + +public InternalFieldReferenceMatch(IJavaElement enclosingElement, int accuracy, int offset, int length, boolean isReadAccess, boolean isWriteAccess, boolean insideDocComment, SearchParticipant participant, IResource resource) { + super(enclosingElement, accuracy, offset, length, isReadAccess, isWriteAccess, insideDocComment, participant, resource); +} + +/** + * Return the stored local element. + * + * @see org.eclipse.jdt.core.search.ReferenceMatch#getLocalElement() + */ +protected IJavaElement localElement() { + return this.localElement; +} + +/** + * Store the local element in the match. + * + * @param element The local element to be stored + */ +public void localElement(IJavaElement element) { + this.localElement = element; +} +} Index: search/org/eclipse/jdt/internal/core/search/matching/InternalPackageReferenceMatch.java =================================================================== RCS file: search/org/eclipse/jdt/internal/core/search/matching/InternalPackageReferenceMatch.java diff -N search/org/eclipse/jdt/internal/core/search/matching/InternalPackageReferenceMatch.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ search/org/eclipse/jdt/internal/core/search/matching/InternalPackageReferenceMatch.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,45 @@ +/******************************************************************************* + * Copyright (c) 2000, 2008 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.internal.core.search.matching; + +import org.eclipse.core.resources.IResource; +import org.eclipse.jdt.core.*; +import org.eclipse.jdt.core.search.*; + +/** + * A package reference match that stores the local element + */ +public class InternalPackageReferenceMatch extends PackageReferenceMatch { + + IJavaElement localElement; + +public InternalPackageReferenceMatch(IJavaElement enclosingElement, int accuracy, int offset, int length, boolean insideDocComment, SearchParticipant participant, IResource resource) { + super(enclosingElement, accuracy, offset, length, insideDocComment, participant, resource); +} + +/** + * Return the stored local element. + * + * @see org.eclipse.jdt.core.search.ReferenceMatch#getLocalElement() + */ +protected IJavaElement localElement() { + return this.localElement; +} + +/** + * Store the local element in the match. + * + * @param element The local element to be stored + */ +public void localElement(IJavaElement element) { + this.localElement = element; +} +}