mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-15 16:14:46 +00:00
Added printing for a constructor if it is the default (generated) constructor or not.
This commit is contained in:
1 parent
99a38d4d08
commit
c346b5c054
1 file changed
+9
-4
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user