From efe3931cf3d9134d7d8e5adf792b05a47ce2c423 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Wed, 1 Jul 2009 20:16:26 +0200 Subject: Added ability to @Synchronized to explicitly name the lock object. Spruced up @Cleanup's position settings and also forced initialization, because the error appears in a screwed up place if you don't, and we can't seem to move it. --- src/lombok/javac/handlers/HandleCleanup.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/lombok/javac/handlers/HandleCleanup.java') diff --git a/src/lombok/javac/handlers/HandleCleanup.java b/src/lombok/javac/handlers/HandleCleanup.java index 9a8cf516..39f2c242 100644 --- a/src/lombok/javac/handlers/HandleCleanup.java +++ b/src/lombok/javac/handlers/HandleCleanup.java @@ -42,6 +42,11 @@ public class HandleCleanup implements JavacAnnotationHandler { JCVariableDecl decl = (JCVariableDecl)annotationNode.up().get(); + if ( decl.init == null ) { + annotationNode.addError("@Cleanup variable declarations need to be initialized."); + return true; + } + Node ancestor = annotationNode.up().directUp(); JCTree blockNode = ancestor.get(); @@ -109,7 +114,7 @@ public class HandleCleanup implements JavacAnnotationHandler { if ( ((JCIdent)statement).name.contentEquals(name) ) { Node problemNode = node.getNodeFor(statement); if ( problemNode != null ) problemNode.addWarning( - "You're assigning a guarded variable to something else. This is a bad idea."); + "You're assigning an auto-cleanup variable to something else. This is a bad idea."); } } } -- cgit