aboutsummaryrefslogtreecommitdiff
path: root/src/utils/lombok
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/lombok')
-rw-r--r--src/utils/lombok/eclipse/Eclipse.java10
-rw-r--r--src/utils/lombok/javac/Javac.java20
2 files changed, 17 insertions, 13 deletions
diff --git a/src/utils/lombok/eclipse/Eclipse.java b/src/utils/lombok/eclipse/Eclipse.java
index 18b22256..296c0a19 100644
--- a/src/utils/lombok/eclipse/Eclipse.java
+++ b/src/utils/lombok/eclipse/Eclipse.java
@@ -44,6 +44,8 @@ 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];
/**
@@ -161,7 +163,7 @@ public class Eclipse {
*/
public static Object calculateValue(Expression e) {
if (e instanceof Literal) {
- ((Literal)e).computeConstant();
+ ((Literal) e).computeConstant();
switch (e.constant.typeID()) {
case TypeIds.T_int: return e.constant.intValue();
case TypeIds.T_byte: return e.constant.byteValue();
@@ -175,13 +177,13 @@ public class Eclipse {
default: return null;
}
} else if (e instanceof ClassLiteralAccess) {
- return Eclipse.toQualifiedName(((ClassLiteralAccess)e).type.getTypeName());
+ return new AnnotationValues.ClassLiteral(Eclipse.toQualifiedName(((ClassLiteralAccess)e).type.getTypeName()));
} else if (e instanceof SingleNameReference) {
- return new String(((SingleNameReference)e).token);
+ return new AnnotationValues.FieldSelect(new String(((SingleNameReference)e).token));
} else if (e instanceof QualifiedNameReference) {
String qName = Eclipse.toQualifiedName(((QualifiedNameReference)e).tokens);
int idx = qName.lastIndexOf('.');
- return idx == -1 ? qName : qName.substring(idx+1);
+ return new AnnotationValues.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 9ff4d22f..2a66baba 100644
--- a/src/utils/lombok/javac/Javac.java
+++ b/src/utils/lombok/javac/Javac.java
@@ -36,6 +36,7 @@ import javax.lang.model.type.NoType;
import javax.lang.model.type.TypeKind;
import javax.lang.model.type.TypeVisitor;
+import lombok.core.AnnotationValues;
import lombok.javac.JavacTreeMaker.TreeTag;
import lombok.javac.JavacTreeMaker.TypeTag;
@@ -143,16 +144,17 @@ public class Javac {
return ((Number) lit.value).intValue() == 0 ? false : true;
}
return lit.value;
- } else if (expr instanceof JCIdent || expr instanceof JCFieldAccess) {
+ }
+
+ if (expr instanceof JCIdent || expr instanceof JCFieldAccess) {
String x = expr.toString();
- if (x.endsWith(".class")) x = x.substring(0, x.length() - 6);
- else {
- int idx = x.lastIndexOf('.');
- if (idx > -1) x = x.substring(idx + 1);
- }
- return x;
- } else
- return null;
+ if (x.endsWith(".class")) return new AnnotationValues.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 null;
}
public static final TypeTag CTC_BOOLEAN = typeTag("BOOLEAN");