aboutsummaryrefslogtreecommitdiff
path: root/src/utils/lombok/eclipse/Eclipse.java
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2018-09-04 01:47:59 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2018-09-11 01:59:19 +0200
commitcc8370ab2d7b3ca15023364c99e53735e62e13d7 (patch)
tree984b7fa824760fb2040067500aaacc859ed68821 /src/utils/lombok/eclipse/Eclipse.java
parentcd8434feee79c6e119de0a254e071c6c49a8938e (diff)
downloadlombok-cc8370ab2d7b3ca15023364c99e53735e62e13d7.tar.gz
lombok-cc8370ab2d7b3ca15023364c99e53735e62e13d7.tar.bz2
lombok-cc8370ab2d7b3ca15023364c99e53735e62e13d7.zip
code review and fixes for the ‘copyable annotations’ setting concept.
Diffstat (limited to 'src/utils/lombok/eclipse/Eclipse.java')
-rw-r--r--src/utils/lombok/eclipse/Eclipse.java22
1 files changed, 2 insertions, 20 deletions
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<Annotation> result = new ArrayList<Annotation>();
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<String> names) {
- List<Annotation> result = new ArrayList<Annotation>();
- 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)$");