From e6532bbe94f9b5f0452e97bc9462e084b25f7aa2 Mon Sep 17 00:00:00 2001 From: Dmitry Kurelchuk Date: Fri, 20 Apr 2018 22:47:34 +0300 Subject: move ClassLiteral and FieldSelect from core/lombok/core/AnnotationValues.java to utils/lombok/core/ --- src/core/lombok/core/AnnotationValues.java | 26 +------------------------- src/utils/lombok/core/ClassLiteral.java | 13 +++++++++++++ src/utils/lombok/core/FieldSelect.java | 13 +++++++++++++ src/utils/lombok/eclipse/Eclipse.java | 10 +++++----- src/utils/lombok/javac/Javac.java | 7 ++++--- 5 files changed, 36 insertions(+), 33 deletions(-) create mode 100644 src/utils/lombok/core/ClassLiteral.java create mode 100644 src/utils/lombok/core/FieldSelect.java diff --git a/src/core/lombok/core/AnnotationValues.java b/src/core/lombok/core/AnnotationValues.java index 8db7c857..df18ec30 100644 --- a/src/core/lombok/core/AnnotationValues.java +++ b/src/core/lombok/core/AnnotationValues.java @@ -42,31 +42,7 @@ public class AnnotationValues { private final Class type; private final Map values; private final LombokNode ast; - - public static class ClassLiteral { - private final String className; - - public ClassLiteral(String className) { - this.className = className; - } - - public String getClassName() { - return className; - } - } - - public static class FieldSelect { - private final String finalPart; - - public FieldSelect(String finalPart) { - this.finalPart = finalPart; - } - - public String getFinalPart() { - return finalPart; - } - } - + /** * Represents a single method on the annotation class. For example, the value() method on the Getter annotation. */ diff --git a/src/utils/lombok/core/ClassLiteral.java b/src/utils/lombok/core/ClassLiteral.java new file mode 100644 index 00000000..077ead31 --- /dev/null +++ b/src/utils/lombok/core/ClassLiteral.java @@ -0,0 +1,13 @@ +package lombok.core; + +public class ClassLiteral { + private final String className; + + public ClassLiteral(String className) { + this.className = className; + } + + public String getClassName() { + return className; + } +} diff --git a/src/utils/lombok/core/FieldSelect.java b/src/utils/lombok/core/FieldSelect.java new file mode 100644 index 00000000..ab784401 --- /dev/null +++ b/src/utils/lombok/core/FieldSelect.java @@ -0,0 +1,13 @@ +package lombok.core; + +public class FieldSelect { + private final String finalPart; + + public FieldSelect(String finalPart) { + this.finalPart = finalPart; + } + + public String getFinalPart() { + return finalPart; + } +} diff --git a/src/utils/lombok/eclipse/Eclipse.java b/src/utils/lombok/eclipse/Eclipse.java index 296c0a19..f2b5486c 100644 --- a/src/utils/lombok/eclipse/Eclipse.java +++ b/src/utils/lombok/eclipse/Eclipse.java @@ -27,6 +27,8 @@ import java.util.Arrays; import java.util.List; import java.util.regex.Pattern; +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.Annotation; @@ -44,8 +46,6 @@ import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; import org.eclipse.jdt.internal.compiler.lookup.TypeIds; -import lombok.core.AnnotationValues; - public class Eclipse { private static final Annotation[] EMPTY_ANNOTATIONS_ARRAY = new Annotation[0]; /** @@ -177,13 +177,13 @@ public class Eclipse { default: return null; } } else if (e instanceof ClassLiteralAccess) { - return new AnnotationValues.ClassLiteral(Eclipse.toQualifiedName(((ClassLiteralAccess)e).type.getTypeName())); + return new ClassLiteral(Eclipse.toQualifiedName(((ClassLiteralAccess)e).type.getTypeName())); } else if (e instanceof SingleNameReference) { - return new AnnotationValues.FieldSelect(new String(((SingleNameReference)e).token)); + return new FieldSelect(new String(((SingleNameReference)e).token)); } else if (e instanceof QualifiedNameReference) { String qName = Eclipse.toQualifiedName(((QualifiedNameReference)e).tokens); int idx = qName.lastIndexOf('.'); - return new AnnotationValues.FieldSelect(idx == -1 ? qName : qName.substring(idx+1)); + return new FieldSelect(idx == -1 ? qName : qName.substring(idx+1)); } return null; diff --git a/src/utils/lombok/javac/Javac.java b/src/utils/lombok/javac/Javac.java index 2a66baba..92961726 100644 --- a/src/utils/lombok/javac/Javac.java +++ b/src/utils/lombok/javac/Javac.java @@ -36,7 +36,8 @@ import javax.lang.model.type.NoType; import javax.lang.model.type.TypeKind; import javax.lang.model.type.TypeVisitor; -import lombok.core.AnnotationValues; +import lombok.core.ClassLiteral; +import lombok.core.FieldSelect; import lombok.javac.JavacTreeMaker.TreeTag; import lombok.javac.JavacTreeMaker.TypeTag; @@ -148,10 +149,10 @@ public class Javac { if (expr instanceof JCIdent || expr instanceof JCFieldAccess) { String x = expr.toString(); - if (x.endsWith(".class")) return new AnnotationValues.ClassLiteral(x.substring(0, x.length() - 6)); + if (x.endsWith(".class")) return new ClassLiteral(x.substring(0, x.length() - 6)); int idx = x.lastIndexOf('.'); if (idx > -1) x = x.substring(idx + 1); - return new AnnotationValues.FieldSelect(x); + return new FieldSelect(x); } return null; -- cgit