org.eclipse.jdt.internal.core.search.matching.ClassFileMatchLocator Maven / Gradle / Ivy
/*******************************************************************************
* Copyright (c) 2000, 2012 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.runtime.CoreException;
import org.eclipse.jdt.core.*;
import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.core.search.*;
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
import org.eclipse.jdt.internal.compiler.classfmt.FieldInfo;
import org.eclipse.jdt.internal.compiler.classfmt.MethodInfo;
import org.eclipse.jdt.internal.compiler.env.*;
import org.eclipse.jdt.internal.compiler.lookup.*;
import org.eclipse.jdt.internal.core.*;
import org.eclipse.jdt.internal.core.search.indexing.IIndexConstants;
public class ClassFileMatchLocator implements IIndexConstants {
private static final long TARGET_ANNOTATION_BITS =
TagBits.AnnotationForType |
TagBits.AnnotationForParameter |
TagBits.AnnotationForPackage |
TagBits.AnnotationForMethod |
TagBits.AnnotationForLocalVariable |
TagBits.AnnotationForField |
TagBits.AnnotationForConstructor |
TagBits.AnnotationForAnnotationType;
private static final char[] JAVA_LANG_ANNOTATION_ELEMENTTYPE = CharOperation.concatWith(TypeConstants.JAVA_LANG_ANNOTATION_ELEMENTTYPE, '.');
public static char[] convertClassFileFormat(char[] name) {
return CharOperation.replaceOnCopy(name, '/', '.');
}
private boolean checkAnnotation(IBinaryAnnotation annotation, TypeReferencePattern pattern) {
if (checkTypeName(pattern.simpleName, pattern.qualification, convertClassFileFormat(Signature.toCharArray(annotation.getTypeName())), pattern.isCaseSensitive, pattern.isCamelCase)) {
return true;
}
IBinaryElementValuePair[] valuePairs = annotation.getElementValuePairs();
if (valuePairs != null) {
for (int j=0, vpLength=valuePairs.length; j