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/HandleCleanup.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/HandleCleanup.java')
-rw-r--r-- | src/core/lombok/javac/handlers/HandleCleanup.java | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/core/lombok/javac/handlers/HandleCleanup.java b/src/core/lombok/javac/handlers/HandleCleanup.java index cbbdc007..bfe357ef 100644 --- a/src/core/lombok/javac/handlers/HandleCleanup.java +++ b/src/core/lombok/javac/handlers/HandleCleanup.java @@ -50,6 +50,7 @@ import com.sun.tools.javac.tree.JCTree.JCStatement; import com.sun.tools.javac.tree.JCTree.JCTypeCast; import com.sun.tools.javac.tree.JCTree.JCVariableDecl; import com.sun.tools.javac.util.List; +import com.sun.tools.javac.util.ListBuffer; import com.sun.tools.javac.util.Name; /** @@ -93,14 +94,14 @@ public class HandleCleanup implements JavacAnnotationHandler<Cleanup> { } boolean seenDeclaration = false; - List<JCStatement> tryBlock = List.nil(); - List<JCStatement> newStatements = List.nil(); + ListBuffer<JCStatement> newStatements = ListBuffer.lb(); + ListBuffer<JCStatement> tryBlock = ListBuffer.lb(); for (JCStatement statement : statements) { if (!seenDeclaration) { if (statement == decl) seenDeclaration = true; - newStatements = newStatements.append(statement); + newStatements.append(statement); } else { - tryBlock = tryBlock.append(statement); + tryBlock.append(statement); } } @@ -108,8 +109,7 @@ public class HandleCleanup implements JavacAnnotationHandler<Cleanup> { annotationNode.addError("LOMBOK BUG: Can't find this local variable declaration inside its parent."); return true; } - - doAssignmentCheck(annotationNode, tryBlock, decl.name); + doAssignmentCheck(annotationNode, tryBlock.toList(), decl.name); TreeMaker maker = annotationNode.getTreeMaker(); JCFieldAccess cleanupMethod = maker.Select(maker.Ident(decl.name), annotationNode.toName(cleanupName)); @@ -123,14 +123,14 @@ public class HandleCleanup implements JavacAnnotationHandler<Cleanup> { JCBlock finalizer = maker.Block(0, List.<JCStatement>of(ifNotNullCleanup)); - newStatements = newStatements.append(maker.Try(maker.Block(0, tryBlock), List.<JCCatch>nil(), finalizer)); + newStatements.append(maker.Try(maker.Block(0, tryBlock.toList()), List.<JCCatch>nil(), finalizer)); if (blockNode instanceof JCBlock) { - ((JCBlock)blockNode).stats = newStatements; + ((JCBlock)blockNode).stats = newStatements.toList(); } else if (blockNode instanceof JCCase) { - ((JCCase)blockNode).stats = newStatements; + ((JCCase)blockNode).stats = newStatements.toList(); } else if (blockNode instanceof JCMethodDecl) { - ((JCMethodDecl)blockNode).body.stats = newStatements; + ((JCMethodDecl)blockNode).body.stats = newStatements.toList(); } else throw new AssertionError("Should not get here"); ancestor.rebuild(); |