From 1c2556b1f7b26ea0b70d356d9eeefb638560a46f Mon Sep 17 00:00:00 2001 From: Roel Spilker Date: Mon, 15 Nov 2010 00:44:16 +0100 Subject: In javac, use ListBuffer to append --- src/core/lombok/javac/handlers/HandleToString.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/core/lombok/javac/handlers/HandleToString.java') 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 { return false; } - List nodesForToString = List.nil(); + ListBuffer 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 { 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: -- cgit