diff options
author | Reinier Zwitserloot <reinier@tipit.to> | 2009-07-26 09:34:10 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@tipit.to> | 2009-07-26 09:34:10 +0200 |
commit | f74109fdc8d35a1577167736598d95dcad321f0f (patch) | |
tree | dcf2dc1f48621ec14dc2cb41f0757e51e37e2887 /src/lombok/javac | |
parent | dfbc6a79e79c1e070ad9d661a468199cffffddc1 (diff) | |
download | lombok-f74109fdc8d35a1577167736598d95dcad321f0f.tar.gz lombok-f74109fdc8d35a1577167736598d95dcad321f0f.tar.bz2 lombok-f74109fdc8d35a1577167736598d95dcad321f0f.zip |
Addresses issue #5:
hitting 'find callers' on a @Data annotation should find callers of the (static) constructor.
Right now it'll find callers to the *static* constructor ONLY. Letting it find callers of the public constructor if there is no static constructor just doesn't work.
Diffstat (limited to 'src/lombok/javac')
-rw-r--r-- | src/lombok/javac/handlers/HandleData.java | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/lombok/javac/handlers/HandleData.java b/src/lombok/javac/handlers/HandleData.java index 97a90d85..e2754d59 100644 --- a/src/lombok/javac/handlers/HandleData.java +++ b/src/lombok/javac/handlers/HandleData.java @@ -92,18 +92,6 @@ public class HandleData implements JavacAnnotationHandler<Data> { if ( !isFinal ) new HandleSetter().generateSetterForField(child, annotationNode.get()); } - String staticConstructorName = annotation.getInstance().staticConstructor(); - - if ( constructorExists(typeNode) == MemberExistsResult.NOT_EXISTS ) { - JCMethodDecl constructor = createConstructor(staticConstructorName.equals(""), typeNode, nodesForConstructor); - injectMethod(typeNode, constructor); - } - - if ( !staticConstructorName.isEmpty() && methodExists("of", typeNode) == MemberExistsResult.NOT_EXISTS ) { - JCMethodDecl staticConstructor = createStaticConstructor(staticConstructorName, typeNode, nodesForConstructor); - injectMethod(typeNode, staticConstructor); - } - if ( methodExists("equals", typeNode) == MemberExistsResult.NOT_EXISTS ) { JCMethodDecl method = createEquals(typeNode, nodesForEquality); injectMethod(typeNode, method); @@ -119,6 +107,18 @@ public class HandleData implements JavacAnnotationHandler<Data> { injectMethod(typeNode, method); } + String staticConstructorName = annotation.getInstance().staticConstructor(); + + if ( constructorExists(typeNode) == MemberExistsResult.NOT_EXISTS ) { + JCMethodDecl constructor = createConstructor(staticConstructorName.equals(""), typeNode, nodesForConstructor); + injectMethod(typeNode, constructor); + } + + if ( !staticConstructorName.isEmpty() && methodExists("of", typeNode) == MemberExistsResult.NOT_EXISTS ) { + JCMethodDecl staticConstructor = createStaticConstructor(staticConstructorName, typeNode, nodesForConstructor); + injectMethod(typeNode, staticConstructor); + } + return true; } |