diff options
author | Roel Spilker <r.spilker@gmail.com> | 2010-11-15 00:44:16 +0100 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2010-11-15 00:44:16 +0100 |
commit | 1c2556b1f7b26ea0b70d356d9eeefb638560a46f (patch) | |
tree | 5d98d91d72ddf1c3029423bb1953eec409d94538 /src/core/lombok/javac/handlers/HandleToString.java | |
parent | d44421dada3d35750c08163ef76514018f89b055 (diff) | |
download | lombok-1c2556b1f7b26ea0b70d356d9eeefb638560a46f.tar.gz lombok-1c2556b1f7b26ea0b70d356d9eeefb638560a46f.tar.bz2 lombok-1c2556b1f7b26ea0b70d356d9eeefb638560a46f.zip |
In javac, use ListBuffer to append
Diffstat (limited to 'src/core/lombok/javac/handlers/HandleToString.java')
-rw-r--r-- | src/core/lombok/javac/handlers/HandleToString.java | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/core/lombok/javac/handlers/HandleToString.java b/src/core/lombok/javac/handlers/HandleToString.java index 82e32c06..183658c2 100644 --- a/src/core/lombok/javac/handlers/HandleToString.java +++ b/src/core/lombok/javac/handlers/HandleToString.java @@ -49,6 +49,7 @@ import com.sun.tools.javac.tree.JCTree.JCStatement; import com.sun.tools.javac.tree.JCTree.JCTypeParameter; import com.sun.tools.javac.tree.JCTree.JCVariableDecl; import com.sun.tools.javac.util.List; +import com.sun.tools.javac.util.ListBuffer; /** * Handles the {@code ToString} annotation for javac. @@ -130,12 +131,12 @@ public class HandleToString implements JavacAnnotationHandler<ToString> { return false; } - List<JavacNode> nodesForToString = List.nil(); + ListBuffer<JavacNode> nodesForToString = ListBuffer.lb(); if (includes != null) { for (JavacNode child : typeNode.down()) { if (child.getKind() != Kind.FIELD) continue; JCVariableDecl fieldDecl = (JCVariableDecl) child.get(); - if (includes.contains(fieldDecl.name.toString())) nodesForToString = nodesForToString.append(child); + if (includes.contains(fieldDecl.name.toString())) nodesForToString.append(child); } } else { for (JavacNode child : typeNode.down()) { @@ -147,13 +148,13 @@ public class HandleToString implements JavacAnnotationHandler<ToString> { if (excludes != null && excludes.contains(fieldDecl.name.toString())) continue; //Skip fields that start with $. if (fieldDecl.name.toString().startsWith("$")) continue; - nodesForToString = nodesForToString.append(child); + nodesForToString.append(child); } } switch (methodExists("toString", typeNode)) { case NOT_EXISTS: - JCMethodDecl method = createToString(typeNode, nodesForToString, includeFieldNames, callSuper, fieldAccess); + JCMethodDecl method = createToString(typeNode, nodesForToString.toList(), includeFieldNames, callSuper, fieldAccess); injectMethod(typeNode, method); return true; case EXISTS_BY_LOMBOK: |