aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok
diff options
context:
space:
mode:
authorRoel Spilker <r.spilker@gmail.com>2010-07-25 01:49:29 +0200
committerRoel Spilker <r.spilker@gmail.com>2010-07-25 01:49:29 +0200
commit9bc463231524e634091b314376ff5a38cc5cbb51 (patch)
tree74deb7f7b79a2f9446d19ad01120f791d2ebe3c7 /src/core/lombok
parent304f57bd05b6298be8feb0fc368845249f805798 (diff)
downloadlombok-9bc463231524e634091b314376ff5a38cc5cbb51.tar.gz
lombok-9bc463231524e634091b314376ff5a38cc5cbb51.tar.bz2
lombok-9bc463231524e634091b314376ff5a38cc5cbb51.zip
Bugfix: in JavacNode intintializers were not structurally significant
Diffstat (limited to 'src/core/lombok')
-rw-r--r--src/core/lombok/core/LombokNode.java10
-rw-r--r--src/core/lombok/eclipse/EclipseNode.java2
-rw-r--r--src/core/lombok/javac/JavacNode.java5
3 files changed, 12 insertions, 5 deletions
diff --git a/src/core/lombok/core/LombokNode.java b/src/core/lombok/core/LombokNode.java
index 1d080c59..6fe37a6b 100644
--- a/src/core/lombok/core/LombokNode.java
+++ b/src/core/lombok/core/LombokNode.java
@@ -70,8 +70,12 @@ public abstract class LombokNode<A extends AST<A, L, N>, L extends LombokNode<A,
this.kind = kind;
this.node = node;
this.children = children == null ? new ArrayList<L>() : children;
- for (L child : this.children) child.parent = (L) this;
- this.isStructurallySignificant = calculateIsStructurallySignificant();
+ for (L child : this.children) {
+ child.parent = (L) this;
+ if (!child.isStructurallySignificant)
+ child.isStructurallySignificant = calculateIsStructurallySignificant(node);
+ }
+ this.isStructurallySignificant = calculateIsStructurallySignificant(null);
}
/** {@inheritDoc} */
@@ -101,7 +105,7 @@ public abstract class LombokNode<A extends AST<A, L, N>, L extends LombokNode<A,
/**
* See {@link #isStructurallySignificant}.
*/
- protected abstract boolean calculateIsStructurallySignificant();
+ protected abstract boolean calculateIsStructurallySignificant(N parent);
/**
* Convenient shortcut to the owning ast object's get method.
diff --git a/src/core/lombok/eclipse/EclipseNode.java b/src/core/lombok/eclipse/EclipseNode.java
index 50edda58..e6fd1b03 100644
--- a/src/core/lombok/eclipse/EclipseNode.java
+++ b/src/core/lombok/eclipse/EclipseNode.java
@@ -165,7 +165,7 @@ public class EclipseNode extends lombok.core.LombokNode<EclipseAST, EclipseNode,
}
/** {@inheritDoc} */
- @Override protected boolean calculateIsStructurallySignificant() {
+ @Override protected boolean calculateIsStructurallySignificant(ASTNode parent) {
if (node instanceof TypeDeclaration) return true;
if (node instanceof AbstractMethodDeclaration) return true;
if (node instanceof FieldDeclaration) return true;
diff --git a/src/core/lombok/javac/JavacNode.java b/src/core/lombok/javac/JavacNode.java
index 3f513887..8bbd007f 100644
--- a/src/core/lombok/javac/JavacNode.java
+++ b/src/core/lombok/javac/JavacNode.java
@@ -138,11 +138,14 @@ public class JavacNode extends lombok.core.LombokNode<JavacAST, JavacNode, JCTre
}
/** {@inheritDoc} */
- @Override protected boolean calculateIsStructurallySignificant() {
+ @Override protected boolean calculateIsStructurallySignificant(JCTree parent) {
if (node instanceof JCClassDecl) return true;
if (node instanceof JCMethodDecl) return true;
if (node instanceof JCVariableDecl) return true;
if (node instanceof JCCompilationUnit) return true;
+ //Static and instance initializers
+ if (node instanceof JCBlock) return parent instanceof JCClassDecl;
+
return false;
}