diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2013-06-18 04:23:15 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2013-06-18 04:23:15 +0200 |
commit | e1c39bbc601408decb0ae147d181708a5af41307 (patch) | |
tree | f3a620da1778ae4b9654433bec65841a95ff5067 /src/core/lombok/javac/handlers/HandleSetter.java | |
parent | eb3d32c718d9ef46fd30bc677147cda85318fb9c (diff) | |
download | lombok-e1c39bbc601408decb0ae147d181708a5af41307.tar.gz lombok-e1c39bbc601408decb0ae147d181708a5af41307.tar.bz2 lombok-e1c39bbc601408decb0ae147d181708a5af41307.zip |
javac builder implementation. Passes all tests.
Added toString() impl for builders in both eclipse and javac.
Added all documentation, though it'll need some reviewing.
Diffstat (limited to 'src/core/lombok/javac/handlers/HandleSetter.java')
-rw-r--r-- | src/core/lombok/javac/handlers/HandleSetter.java | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/core/lombok/javac/handlers/HandleSetter.java b/src/core/lombok/javac/handlers/HandleSetter.java index c1e03c35..29728eae 100644 --- a/src/core/lombok/javac/handlers/HandleSetter.java +++ b/src/core/lombok/javac/handlers/HandleSetter.java @@ -194,9 +194,13 @@ public class HandleSetter extends JavacAnnotationHandler<Setter> { injectMethod(fieldNode.up(), createdSetter); } - private JCMethodDecl createSetter(long access, JavacNode field, TreeMaker treeMaker, JCTree source, List<JCAnnotation> onMethod, List<JCAnnotation> onParam) { + static JCMethodDecl createSetter(long access, JavacNode field, TreeMaker treeMaker, JCTree source, List<JCAnnotation> onMethod, List<JCAnnotation> onParam) { String setterName = toSetterName(field); boolean returnThis = shouldReturnThis(field); + return createSetter(access, field, treeMaker, setterName, returnThis, source, onMethod, onParam); + } + + static JCMethodDecl createSetter(long access, JavacNode field, TreeMaker treeMaker, String setterName, boolean shouldReturnThis, JCTree source, List<JCAnnotation> onMethod, List<JCAnnotation> onParam) { if (setterName == null) return null; JCVariableDecl fieldDecl = (JCVariableDecl) field.get(); @@ -222,17 +226,17 @@ public class HandleSetter extends JavacAnnotationHandler<Setter> { } JCExpression methodType = null; - if (returnThis) { + if (shouldReturnThis) { methodType = cloneSelfType(field); } if (methodType == null) { //WARNING: Do not use field.getSymbolTable().voidType - that field has gone through non-backwards compatible API changes within javac1.6. methodType = treeMaker.Type(new JCNoType(CTC_VOID)); - returnThis = false; + shouldReturnThis = false; } - if (returnThis) { + if (shouldReturnThis) { JCReturn returnStatement = treeMaker.Return(treeMaker.Ident(field.toName("this"))); statements.append(returnStatement); } |