diff options
author | Reinier Zwitserloot <reinier@tipit.to> | 2009-06-24 01:22:53 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@tipit.to> | 2009-06-24 01:22:53 +0200 |
commit | c346b5c0546364e1721d0eda37ea5b465a20de0d (patch) | |
tree | 11f4adb2159ba61bb8f91b8cbb2acacbe0596836 | |
parent | 99a38d4d08cb020182663ffaf9418d28becf1fd6 (diff) | |
download | lombok-c346b5c0546364e1721d0eda37ea5b465a20de0d.tar.gz lombok-c346b5c0546364e1721d0eda37ea5b465a20de0d.tar.bz2 lombok-c346b5c0546364e1721d0eda37ea5b465a20de0d.zip |
Added printing for a constructor if it is the default (generated) constructor or not.
-rw-r--r-- | src/lombok/javac/JavacASTVisitor.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/lombok/javac/JavacASTVisitor.java b/src/lombok/javac/JavacASTVisitor.java index 4dc40784..714ae294 100644 --- a/src/lombok/javac/JavacASTVisitor.java +++ b/src/lombok/javac/JavacASTVisitor.java @@ -6,6 +6,7 @@ import java.io.PrintStream; import lombok.javac.JavacAST.Node; +import com.sun.tools.javac.code.Flags; import com.sun.tools.javac.tree.JCTree; import com.sun.tools.javac.tree.JCTree.JCAnnotation; import com.sun.tools.javac.tree.JCTree.JCBlock; @@ -145,8 +146,13 @@ public interface JavacASTVisitor { } @Override public void visitMethod(Node node, JCMethodDecl method) { - String type = method.name.contentEquals("<init>") ? "CONSTRUCTOR" : "METHOD"; - print("<%s %s>", type, method.name); + final String type; + if ( method.name.contentEquals("<init>") ) { + if ( (method.mods.flags & Flags.GENERATEDCONSTR) != 0 ) { + type = "DEFAULTCONSTRUCTOR"; + } else type = "CONSTRUCTOR"; + } else type = "METHOD"; + print("<%s %s> returns: %s", type, method.name, method.restype); indent++; } @@ -155,9 +161,8 @@ public interface JavacASTVisitor { } @Override public void endVisitMethod(Node node, JCMethodDecl method) { - String type = method.name.contentEquals("<init>") ? "CONSTRUCTOR" : "METHOD"; indent--; - print("</%s %s>", type, method.name); + print("</%s %s>", "XMETHOD", method.name); } @Override public void visitMethodArgument(Node node, JCVariableDecl arg, JCMethodDecl method) { |