aboutsummaryrefslogtreecommitdiff
path: root/src/lombok/core
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@tipit.to>2009-06-20 23:46:17 +0200
committerReinier Zwitserloot <reinier@tipit.to>2009-06-21 00:10:58 +0200
commit255bd5907176cb5d2c4fb1cf6a9b48b14af0b4ba (patch)
tree347c4b1cf5b34b3975cc00e26a42c75ee1295b76 /src/lombok/core
parent2e8e43a12e21151ff470a2729373b4af4980d113 (diff)
downloadlombok-255bd5907176cb5d2c4fb1cf6a9b48b14af0b4ba.tar.gz
lombok-255bd5907176cb5d2c4fb1cf6a9b48b14af0b4ba.tar.bz2
lombok-255bd5907176cb5d2c4fb1cf6a9b48b14af0b4ba.zip
Due to a java bug, constants in enums don't work, so instead the default access level for @Getter and @Setter have now just been hardcoded in GetterHandler and SetterHandler.
Added ability to look up the Node object for any given AST object on Node itself, as you don't usually have the AST object. Added toString() method generating to @Data, and this required some fancy footwork in finding if we've already generated methods, and editing a generated method to fill in binding and type resolutions. HandleGetter and HandleSetter have been updated to use these features. Exceptions caused by lombok handlers show up in the eclipse error log, but now, if they are related to a CompilationUnit, also as a problem (error) on the CUD - those error log entries are easy to miss! Our ASTs can now be appended to. When you generate a new AST node, you should add it to the AST, obviously. Getter/Setter have been updated to use this.
Diffstat (limited to 'src/lombok/core')
-rw-r--r--src/lombok/core/AST.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/lombok/core/AST.java b/src/lombok/core/AST.java
index 2229f9ef..c1186d24 100644
--- a/src/lombok/core/AST.java
+++ b/src/lombok/core/AST.java
@@ -97,6 +97,10 @@ public abstract class AST<N> {
protected abstract boolean calculateIsStructurallySignificant();
+ public Node getNodeFor(N obj) {
+ return AST.this.get(obj);
+ }
+
public N get() {
return node;
}
@@ -150,6 +154,19 @@ public abstract class AST<N> {
return fileName;
}
+ public Node add(N newChild, Kind kind) {
+ Node n = buildTree(newChild, kind);
+ if ( n == null ) return null;
+ n.parent = this;
+ return n;
+ }
+
+ public Node recursiveSetHandled() {
+ this.handled = true;
+ for ( Node child : children ) child.recursiveSetHandled();
+ return this;
+ }
+
public abstract void addError(String message);
public abstract void addWarning(String message);
@@ -164,6 +181,8 @@ public abstract class AST<N> {
}
}
+ protected abstract Node buildTree(N item, Kind kind);
+
protected static class FieldAccess {
public final Field field;
public final int dim;