aboutsummaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2018-04-23 23:43:15 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2018-05-14 22:03:46 +0200
commitad21a1573bab57c63ffd5b9867f8e19ac7f0c94b (patch)
tree6aeb4aff3490999ff799374cf9cbbbc33a5d03c5 /src/utils
parent82a7354a848a26021afd3a889cefd65db7693eb9 (diff)
downloadlombok-ad21a1573bab57c63ffd5b9867f8e19ac7f0c94b.tar.gz
lombok-ad21a1573bab57c63ffd5b9867f8e19ac7f0c94b.tar.bz2
lombok-ad21a1573bab57c63ffd5b9867f8e19ac7f0c94b.zip
[annotation based ToString] hey.. we have annotation based ToString now, where you can include/exclude fields by annotating the fields.
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/lombok/eclipse/Eclipse.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/utils/lombok/eclipse/Eclipse.java b/src/utils/lombok/eclipse/Eclipse.java
index f2b5486c..5ef33086 100644
--- a/src/utils/lombok/eclipse/Eclipse.java
+++ b/src/utils/lombok/eclipse/Eclipse.java
@@ -42,6 +42,7 @@ import org.eclipse.jdt.internal.compiler.ast.SingleNameReference;
import org.eclipse.jdt.internal.compiler.ast.TryStatement;
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
+import org.eclipse.jdt.internal.compiler.ast.UnaryExpression;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import org.eclipse.jdt.internal.compiler.lookup.TypeIds;
@@ -184,6 +185,17 @@ public class Eclipse {
String qName = Eclipse.toQualifiedName(((QualifiedNameReference)e).tokens);
int idx = qName.lastIndexOf('.');
return new FieldSelect(idx == -1 ? qName : qName.substring(idx+1));
+ } else if (e instanceof UnaryExpression) {
+ if ("-".equals(((UnaryExpression) e).operatorToString())) {
+ Object inner = calculateValue(((UnaryExpression) e).expression);
+ if (inner instanceof Integer) return - ((Integer) inner).intValue();
+ if (inner instanceof Byte) return - ((Byte) inner).byteValue();
+ if (inner instanceof Short) return - ((Short) inner).shortValue();
+ if (inner instanceof Long) return - ((Long) inner).longValue();
+ if (inner instanceof Float) return - ((Float) inner).floatValue();
+ if (inner instanceof Double) return - ((Double) inner).doubleValue();
+ return null;
+ }
}
return null;