diff options
Diffstat (limited to 'src/lombok/javac')
-rw-r--r-- | src/lombok/javac/handlers/HandleCleanup.java | 7 | ||||
-rw-r--r-- | src/lombok/javac/handlers/HandleSynchronized.java | 3 |
2 files changed, 8 insertions, 2 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."); } } } diff --git a/src/lombok/javac/handlers/HandleSynchronized.java b/src/lombok/javac/handlers/HandleSynchronized.java index 4acb6e27..84508171 100644 --- a/src/lombok/javac/handlers/HandleSynchronized.java +++ b/src/lombok/javac/handlers/HandleSynchronized.java @@ -41,7 +41,8 @@ public class HandleSynchronized implements JavacAnnotationHandler<Synchronized> return true; } boolean isStatic = (method.mods.flags & Flags.STATIC) != 0; - String lockName = isStatic ? STATIC_LOCK_NAME : INSTANCE_LOCK_NAME; + String lockName = annotation.getInstance().value(); + if ( lockName.length() == 0 ) lockName = isStatic ? STATIC_LOCK_NAME : INSTANCE_LOCK_NAME; TreeMaker maker = methodNode.getTreeMaker(); |