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/eclipse/handlers/HandleSynchronized.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/eclipse/handlers/HandleSynchronized.java')
-rw-r--r-- | src/lombok/eclipse/handlers/HandleSynchronized.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lombok/eclipse/handlers/HandleSynchronized.java b/src/lombok/eclipse/handlers/HandleSynchronized.java index 28e8bd1f..e1d4ed6a 100644 --- a/src/lombok/eclipse/handlers/HandleSynchronized.java +++ b/src/lombok/eclipse/handlers/HandleSynchronized.java @@ -48,7 +48,8 @@ public class HandleSynchronized implements EclipseAnnotationHandler<Synchronized return true; } - char[] lockName = method.isStatic() ? STATIC_LOCK_NAME : INSTANCE_LOCK_NAME; + char[] lockName = annotation.getInstance().value().toCharArray(); + if ( lockName.length == 0 ) lockName = method.isStatic() ? STATIC_LOCK_NAME : INSTANCE_LOCK_NAME; if ( fieldExists(new String(lockName), methodNode) == MemberExistsResult.NOT_EXISTS ) { FieldDeclaration fieldDecl = new FieldDeclaration(lockName, 0, -1); |