diff options
author | Reinier Zwitserloot <reinier@tipit.to> | 2009-07-01 20:16:26 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@tipit.to> | 2009-07-01 20:16:26 +0200 |
commit | efe3931cf3d9134d7d8e5adf792b05a47ce2c423 (patch) | |
tree | 8ed8d2aa39ec902bf5601487d86ec7333cc06267 /src/lombok/javac/handlers/HandleCleanup.java | |
parent | 194c990f64165e0422b1f48a62cf1f77ccd52e43 (diff) | |
download | lombok-efe3931cf3d9134d7d8e5adf792b05a47ce2c423.tar.gz lombok-efe3931cf3d9134d7d8e5adf792b05a47ce2c423.tar.bz2 lombok-efe3931cf3d9134d7d8e5adf792b05a47ce2c423.zip |
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.
Diffstat (limited to 'src/lombok/javac/handlers/HandleCleanup.java')
-rw-r--r-- | src/lombok/javac/handlers/HandleCleanup.java | 7 |
1 files changed, 6 insertions, 1 deletions
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<Cleanup> { 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<Cleanup> { 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."); } } } |