diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2018-09-04 01:48:49 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2018-09-04 01:54:16 +0200 |
commit | 92bc41ae6dce8e16fd9da64c08ad085822fd33ed (patch) | |
tree | 0271ff2abb590461d12f8aea5f4189a2f00f91b7 /src/core | |
parent | 21df1c99391fb8e2678efa2ca11816bfcadd4725 (diff) | |
download | lombok-92bc41ae6dce8e16fd9da64c08ad085822fd33ed.tar.gz lombok-92bc41ae6dce8e16fd9da64c08ad085822fd33ed.tar.bz2 lombok-92bc41ae6dce8e16fd9da64c08ad085822fd33ed.zip |
[debugging] Improved the ecj AST printer
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/lombok/eclipse/EclipseASTVisitor.java | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/core/lombok/eclipse/EclipseASTVisitor.java b/src/core/lombok/eclipse/EclipseASTVisitor.java index b2fd4b2f..37bda5e3 100644 --- a/src/core/lombok/eclipse/EclipseASTVisitor.java +++ b/src/core/lombok/eclipse/EclipseASTVisitor.java @@ -34,9 +34,14 @@ import org.eclipse.jdt.internal.compiler.ast.Argument; import org.eclipse.jdt.internal.compiler.ast.Block; import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration; import org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration; +import org.eclipse.jdt.internal.compiler.ast.Expression; import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration; import org.eclipse.jdt.internal.compiler.ast.Initializer; import org.eclipse.jdt.internal.compiler.ast.LocalDeclaration; +import org.eclipse.jdt.internal.compiler.ast.MarkerAnnotation; +import org.eclipse.jdt.internal.compiler.ast.MemberValuePair; +import org.eclipse.jdt.internal.compiler.ast.NormalAnnotation; +import org.eclipse.jdt.internal.compiler.ast.SingleMemberAnnotation; import org.eclipse.jdt.internal.compiler.ast.Statement; import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; import org.eclipse.jdt.internal.compiler.ast.TypeReference; @@ -351,7 +356,23 @@ public interface EclipseASTVisitor { } public void visitAnnotationOnMethod(AbstractMethodDeclaration method, EclipseNode node, Annotation annotation) { - forcePrint("<ANNOTATION%s: %s%s />", isGenerated(method) ? " (GENERATED)" : "", annotation, position(node)); + forcePrint("<ANNOTATION%s: %s%s>", isGenerated(method) ? " (GENERATED)" : "", annotation, position(node)); + if (annotation instanceof MarkerAnnotation || disablePrinting != 0) { + forcePrint("<ANNOTATION%s: %s%s />", isGenerated(method) ? " (GENERATED)" : "", annotation, position(node)); + } else { + forcePrint("<ANNOTATION%s: %s%s>", isGenerated(method) ? " (GENERATED)" : "", annotation, position(node)); + indent++; + if (annotation instanceof SingleMemberAnnotation) { + Expression expr = ((SingleMemberAnnotation) annotation).memberValue; + print("<SINGLE-MEMBER-VALUE %s /> %s", expr.getClass(), expr); + } + if (annotation instanceof NormalAnnotation) { + for (MemberValuePair mvp : ((NormalAnnotation) annotation).memberValuePairs) { + print("<Member %s: %s /> %s", new String(mvp.name), mvp.value.getClass(), mvp.value); + } + } + indent--; + } } public void endVisitMethod(EclipseNode node, AbstractMethodDeclaration method) { |