aboutsummaryrefslogtreecommitdiff
path: root/src/lombok
diff options
context:
space:
mode:
Diffstat (limited to 'src/lombok')
-rw-r--r--src/lombok/eclipse/EclipseAST.java8
-rw-r--r--src/lombok/eclipse/EclipseASTAdapter.java36
-rw-r--r--src/lombok/eclipse/EclipseASTVisitor.java18
-rw-r--r--src/lombok/eclipse/TransformEclipseAST.java20
4 files changed, 43 insertions, 39 deletions
diff --git a/src/lombok/eclipse/EclipseAST.java b/src/lombok/eclipse/EclipseAST.java
index 9fed839c..3fdd02e4 100644
--- a/src/lombok/eclipse/EclipseAST.java
+++ b/src/lombok/eclipse/EclipseAST.java
@@ -64,13 +64,13 @@ public class EclipseAST {
} else if ( n instanceof Annotation ) {
Node parent = child.up();
if ( parent.node instanceof TypeDeclaration )
- visitor.visitAnnotationOnType(parent, (TypeDeclaration)parent.node, (Annotation)n);
+ visitor.visitAnnotationOnType((TypeDeclaration)parent.node, child, (Annotation)n);
else if ( parent.node instanceof AbstractMethodDeclaration )
- visitor.visitAnnotationOnMethod(parent, (AbstractMethodDeclaration)parent.node, (Annotation)n);
+ visitor.visitAnnotationOnMethod((AbstractMethodDeclaration)parent.node, child, (Annotation)n);
else if ( parent.node instanceof FieldDeclaration )
- visitor.visitAnnotationOnField(parent, (FieldDeclaration)parent.node, (Annotation)n);
+ visitor.visitAnnotationOnField((FieldDeclaration)parent.node, child, (Annotation)n);
else if ( parent.node instanceof LocalDeclaration )
- visitor.visitAnnotationOnLocal(parent, (LocalDeclaration)parent.node, (Annotation)n);
+ visitor.visitAnnotationOnLocal((LocalDeclaration)parent.node, child, (Annotation)n);
} else if ( n instanceof Statement ) {
visitor.visitStatement(child, (Statement)n);
traverseChildren(visitor, child);
diff --git a/src/lombok/eclipse/EclipseASTAdapter.java b/src/lombok/eclipse/EclipseASTAdapter.java
index d2e0050e..1bd5ae3d 100644
--- a/src/lombok/eclipse/EclipseASTAdapter.java
+++ b/src/lombok/eclipse/EclipseASTAdapter.java
@@ -12,22 +12,22 @@ import org.eclipse.jdt.internal.compiler.ast.Statement;
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
public abstract class EclipseASTAdapter implements EclipseASTVisitor {
- @Override public void visitCompilationUnit(Node node, CompilationUnitDeclaration unit) {}
- @Override public void endVisitCompilationUnit(Node node, CompilationUnitDeclaration unit) {}
- @Override public void visitType(Node node, TypeDeclaration type) {}
- @Override public void visitAnnotationOnType(Node node, TypeDeclaration type, Annotation annotation) {}
- @Override public void endVisitType(Node node, TypeDeclaration type) {}
- @Override public void visitInitializer(Node node, Initializer initializer) {}
- @Override public void endVisitInitializer(Node node, Initializer initializer) {}
- @Override public void visitField(Node node, FieldDeclaration field) {}
- @Override public void visitAnnotationOnField(Node node, FieldDeclaration Field, Annotation annotation) {}
- @Override public void endVisitField(Node node, FieldDeclaration field) {}
- @Override public void visitMethod(Node node, AbstractMethodDeclaration method) {}
- @Override public void visitAnnotationOnMethod(Node node, AbstractMethodDeclaration method, Annotation annotation) {}
- @Override public void endVisitMethod(Node node, AbstractMethodDeclaration method) {}
- @Override public void visitLocal(Node node, LocalDeclaration local) {}
- @Override public void visitAnnotationOnLocal(Node node, LocalDeclaration local, Annotation annotation) {}
- @Override public void endVisitLocal(Node node, LocalDeclaration local) {}
- @Override public void visitStatement(Node node, Statement statement) {}
- @Override public void endVisitStatement(Node node, Statement statement) {}
+ @Override public void visitCompilationUnit(Node top, CompilationUnitDeclaration unit) {}
+ @Override public void endVisitCompilationUnit(Node top, CompilationUnitDeclaration unit) {}
+ @Override public void visitType(Node typeNode, TypeDeclaration type) {}
+ @Override public void visitAnnotationOnType(TypeDeclaration type, Node annotationNode, Annotation annotation) {}
+ @Override public void endVisitType(Node typeNode, TypeDeclaration type) {}
+ @Override public void visitInitializer(Node initializerNode, Initializer initializer) {}
+ @Override public void endVisitInitializer(Node initializerNode, Initializer initializer) {}
+ @Override public void visitField(Node fieldNode, FieldDeclaration field) {}
+ @Override public void visitAnnotationOnField(FieldDeclaration field, Node annotationNode, Annotation annotation) {}
+ @Override public void endVisitField(Node fieldNode, FieldDeclaration field) {}
+ @Override public void visitMethod(Node methodNode, AbstractMethodDeclaration method) {}
+ @Override public void visitAnnotationOnMethod(AbstractMethodDeclaration method, Node annotationNode, Annotation annotation) {}
+ @Override public void endVisitMethod(Node methodNode, AbstractMethodDeclaration method) {}
+ @Override public void visitLocal(Node localNode, LocalDeclaration local) {}
+ @Override public void visitAnnotationOnLocal(LocalDeclaration local, Node annotationNode, Annotation annotation) {}
+ @Override public void endVisitLocal(Node localNode, LocalDeclaration local) {}
+ @Override public void visitStatement(Node statementNode, Statement statement) {}
+ @Override public void endVisitStatement(Node statementNode, Statement statement) {}
}
diff --git a/src/lombok/eclipse/EclipseASTVisitor.java b/src/lombok/eclipse/EclipseASTVisitor.java
index a9b4e706..9ab56ebe 100644
--- a/src/lombok/eclipse/EclipseASTVisitor.java
+++ b/src/lombok/eclipse/EclipseASTVisitor.java
@@ -17,7 +17,7 @@ import org.eclipse.jdt.internal.compiler.ast.Statement;
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
-//TODO
+//TODO expand javadoc
public interface EclipseASTVisitor {
/**
* Called at the very beginning and end.
@@ -29,7 +29,7 @@ public interface EclipseASTVisitor {
* Called when visiting a type (a class, interface, annotation, enum, etcetera).
*/
void visitType(Node typeNode, TypeDeclaration type);
- void visitAnnotationOnType(Node typeNode, TypeDeclaration type, Annotation annotation);
+ void visitAnnotationOnType(TypeDeclaration type, Node annotationNode, Annotation annotation);
void endVisitType(Node typeNode, TypeDeclaration type);
/**
@@ -39,7 +39,7 @@ public interface EclipseASTVisitor {
* in a call to the visitInitializer method.
*/
void visitField(Node fieldNode, FieldDeclaration field);
- void visitAnnotationOnField(Node fieldNode, FieldDeclaration Field, Annotation annotation);
+ void visitAnnotationOnField(FieldDeclaration field, Node annotationNode, Annotation annotation);
void endVisitField(Node fieldNode, FieldDeclaration field);
/**
@@ -56,7 +56,7 @@ public interface EclipseASTVisitor {
* show up as 'Initializer', in the visitInitializer method, with modifier bit STATIC set.
*/
void visitMethod(Node methodNode, AbstractMethodDeclaration method);
- void visitAnnotationOnMethod(Node methodNode, AbstractMethodDeclaration method, Annotation annotation);
+ void visitAnnotationOnMethod(AbstractMethodDeclaration method, Node annotationNode, Annotation annotation);
void endVisitMethod(Node methodNode, AbstractMethodDeclaration method);
/**
@@ -64,7 +64,7 @@ public interface EclipseASTVisitor {
* for method parameter (those would be Arguments, a subclass of LocalDeclaration).
*/
void visitLocal(Node localNode, LocalDeclaration local);
- void visitAnnotationOnLocal(Node localNode, LocalDeclaration local, Annotation annotation);
+ void visitAnnotationOnLocal(LocalDeclaration local, Node annotationNode, Annotation annotation);
void endVisitLocal(Node localNode, LocalDeclaration local);
/**
@@ -118,7 +118,7 @@ public interface EclipseASTVisitor {
indent++;
}
- @Override public void visitAnnotationOnType(Node node, TypeDeclaration type, Annotation annotation) {
+ @Override public void visitAnnotationOnType(TypeDeclaration type, Node node, Annotation annotation) {
print("<ANNOTATION: %s />", annotation);
}
@@ -146,7 +146,7 @@ public interface EclipseASTVisitor {
indent++;
}
- @Override public void visitAnnotationOnField(Node node, FieldDeclaration field, Annotation annotation) {
+ @Override public void visitAnnotationOnField(FieldDeclaration field, Node node, Annotation annotation) {
print("<ANNOTATION: %s />", annotation);
}
@@ -161,7 +161,7 @@ public interface EclipseASTVisitor {
indent++;
}
- @Override public void visitAnnotationOnMethod(Node node, AbstractMethodDeclaration method, Annotation annotation) {
+ @Override public void visitAnnotationOnMethod(AbstractMethodDeclaration method, Node node, Annotation annotation) {
print("<ANNOTATION: %s />", annotation);
}
@@ -177,7 +177,7 @@ public interface EclipseASTVisitor {
indent++;
}
- @Override public void visitAnnotationOnLocal(Node node, LocalDeclaration local, Annotation annotation) {
+ @Override public void visitAnnotationOnLocal(LocalDeclaration local, Node node, Annotation annotation) {
print("<ANNOTATION: %s />", annotation);
}
diff --git a/src/lombok/eclipse/TransformEclipseAST.java b/src/lombok/eclipse/TransformEclipseAST.java
index 1a1561c3..afc4cdb3 100644
--- a/src/lombok/eclipse/TransformEclipseAST.java
+++ b/src/lombok/eclipse/TransformEclipseAST.java
@@ -112,20 +112,24 @@ public class TransformEclipseAST {
}
private static class AnnotationVisitor extends EclipseASTAdapter {
- @Override public void visitAnnotationOnField(Node node, FieldDeclaration field, Annotation annotation) {
- handlers.handle((CompilationUnitDeclaration) node.top().node, node, annotation);
+ @Override public void visitAnnotationOnField(FieldDeclaration field, Node annotationNode, Annotation annotation) {
+ handlers.handle((CompilationUnitDeclaration) annotationNode.top().node, annotationNode.up(), annotation);
+ annotationNode.setHandled();
}
- @Override public void visitAnnotationOnLocal(Node node, LocalDeclaration local, Annotation annotation) {
- handlers.handle((CompilationUnitDeclaration) node.top().node, node, annotation);
+ @Override public void visitAnnotationOnLocal(LocalDeclaration local, Node annotationNode, Annotation annotation) {
+ handlers.handle((CompilationUnitDeclaration) annotationNode.top().node, annotationNode.up(), annotation);
+ annotationNode.setHandled();
}
- @Override public void visitAnnotationOnMethod(Node node, AbstractMethodDeclaration method, Annotation annotation) {
- handlers.handle((CompilationUnitDeclaration) node.top().node, node, annotation);
+ @Override public void visitAnnotationOnMethod(AbstractMethodDeclaration method, Node annotationNode, Annotation annotation) {
+ handlers.handle((CompilationUnitDeclaration) annotationNode.top().node, annotationNode.up(), annotation);
+ annotationNode.setHandled();
}
- @Override public void visitAnnotationOnType(Node node, TypeDeclaration type, Annotation annotation) {
- handlers.handle((CompilationUnitDeclaration) node.top().node, node, annotation);
+ @Override public void visitAnnotationOnType(TypeDeclaration type, Node annotationNode, Annotation annotation) {
+ handlers.handle((CompilationUnitDeclaration) annotationNode.top().node, annotationNode.up(), annotation);
+ annotationNode.setHandled();
}
}
}