diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2011-01-02 08:55:40 -0300 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2011-01-02 08:55:40 -0300 |
commit | 6da38688de8eafb7b53ca8be0add444ddc116b46 (patch) | |
tree | fc056d344690115b42615550a2cabddc3478b1e0 /src | |
parent | b9b13f8fcc9412874fcd068629bf36bc9a15cb7b (diff) | |
download | lombok-6da38688de8eafb7b53ca8be0add444ddc116b46.tar.gz lombok-6da38688de8eafb7b53ca8be0add444ddc116b46.tar.bz2 lombok-6da38688de8eafb7b53ca8be0add444ddc116b46.zip |
Added debug feature (disabled in this commit) to print types of nodes printed by EclipseASTVisitor.Printer
Diffstat (limited to 'src')
-rw-r--r-- | src/core/lombok/eclipse/EclipseASTVisitor.java | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/core/lombok/eclipse/EclipseASTVisitor.java b/src/core/lombok/eclipse/EclipseASTVisitor.java index 793166d7..0c0e2d96 100644 --- a/src/core/lombok/eclipse/EclipseASTVisitor.java +++ b/src/core/lombok/eclipse/EclipseASTVisitor.java @@ -110,6 +110,7 @@ public interface EclipseASTVisitor { private final boolean printContent; private int disablePrinting = 0; private int indent = 0; + private boolean printClassNames = false; /** * @param printContent if true, bodies are printed directly, as java code, @@ -134,7 +135,25 @@ public interface EclipseASTVisitor { private void forcePrint(String text, Object... params) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < indent; i++) sb.append(" "); - out.printf(sb.append(text).append('\n').toString(), params); + sb.append(text); + Object[] t; + if (printClassNames && params.length > 0) { + sb.append(" ["); + for (int i = 0; i < params.length; i++) { + if (i > 0) sb.append(", "); + sb.append("%s"); + } + sb.append("]"); + t = new Object[params.length + params.length]; + for (int i = 0; i < params.length; i++) { + t[i] = params[i]; + t[i + params.length] = (params[i] == null) ? "NULL " : params[i].getClass(); + } + } else { + t = params; + } + sb.append("\n"); + out.printf(sb.toString(), t); out.flush(); } |