From cc8370ab2d7b3ca15023364c99e53735e62e13d7 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Tue, 4 Sep 2018 01:47:59 +0200 Subject: code review and fixes for the ‘copyable annotations’ setting concept. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/lombok/eclipse/Eclipse.java | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) (limited to 'src/utils') diff --git a/src/utils/lombok/eclipse/Eclipse.java b/src/utils/lombok/eclipse/Eclipse.java index 42adeeac..5b3c453e 100644 --- a/src/utils/lombok/eclipse/Eclipse.java +++ b/src/utils/lombok/eclipse/Eclipse.java @@ -31,11 +31,11 @@ import lombok.core.ClassLiteral; import lombok.core.FieldSelect; import org.eclipse.jdt.internal.compiler.ast.ASTNode; import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; +import org.eclipse.jdt.internal.compiler.ast.AbstractVariableDeclaration; import org.eclipse.jdt.internal.compiler.ast.Annotation; import org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess; import org.eclipse.jdt.internal.compiler.ast.Clinit; import org.eclipse.jdt.internal.compiler.ast.Expression; -import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration; import org.eclipse.jdt.internal.compiler.ast.Literal; import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference; import org.eclipse.jdt.internal.compiler.ast.SingleNameReference; @@ -139,7 +139,7 @@ public class Eclipse { * * Only the simple name is checked - the package and any containing class are ignored. */ - public static Annotation[] findAnnotations(FieldDeclaration field, Pattern namePattern) { + public static Annotation[] findAnnotations(AbstractVariableDeclaration field, Pattern namePattern) { List result = new ArrayList(); if (field.annotations == null) return EMPTY_ANNOTATIONS_ARRAY; for (Annotation annotation : field.annotations) { @@ -155,24 +155,6 @@ public class Eclipse { return result.toArray(EMPTY_ANNOTATIONS_ARRAY); } - /** - * Searches the given field node for annotations and returns each one that matches the provided list of names. - */ - public static Annotation[] findExactAnnotations(FieldDeclaration field, List names) { - List result = new ArrayList(); - if (field.annotations == null) return EMPTY_ANNOTATIONS_ARRAY; - for (Annotation annotation : field.annotations) { - TypeReference typeRef = annotation.type; - if (typeRef != null && typeRef.getTypeName() != null) { - String annoname = toQualifiedName(typeRef.getTypeName()); - if (names.contains(annoname)) { - result.add(annotation); - } - } - } - return result.toArray(EMPTY_ANNOTATIONS_ARRAY); - } - /** Matches any of the 8 primitive names, such as {@code boolean}. */ private static final Pattern PRIMITIVE_TYPE_NAME_PATTERN = Pattern.compile( "^(boolean|byte|short|int|long|float|double|char)$"); -- cgit