diff options
author | Roel Spilker <r.spilker@gmail.com> | 2012-03-19 23:18:37 +0100 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2012-03-19 23:18:37 +0100 |
commit | 8bc82cad05b8760aa5a01ffabaa6238b6cc535e1 (patch) | |
tree | 0e02ca81914544fe3df18b5b548ca0916b25e57f /src/core/lombok/javac/handlers/HandleGetter.java | |
parent | b4fe2d4e25e164f6063df48891c3a941fabed2e9 (diff) | |
download | lombok-8bc82cad05b8760aa5a01ffabaa6238b6cc535e1.tar.gz lombok-8bc82cad05b8760aa5a01ffabaa6238b6cc535e1.tar.bz2 lombok-8bc82cad05b8760aa5a01ffabaa6238b6cc535e1.zip |
Fix for issue 342: @Deprecated annotation not propagated to generated getter/setter
Diffstat (limited to 'src/core/lombok/javac/handlers/HandleGetter.java')
-rw-r--r-- | src/core/lombok/javac/handlers/HandleGetter.java | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/core/lombok/javac/handlers/HandleGetter.java b/src/core/lombok/javac/handlers/HandleGetter.java index c286ed24..b3421f86 100644 --- a/src/core/lombok/javac/handlers/HandleGetter.java +++ b/src/core/lombok/javac/handlers/HandleGetter.java @@ -74,11 +74,9 @@ public class HandleGetter extends JavacAnnotationHandler<Getter> { public void generateGetterForType(JavacNode typeNode, JavacNode errorNode, AccessLevel level, boolean checkForTypeLevelGetter) { if (checkForTypeLevelGetter) { if (typeNode != null) for (JavacNode child : typeNode.down()) { - if (child.getKind() == Kind.ANNOTATION) { - if (annotationTypeMatches(Getter.class, child)) { - //The annotation will make it happen, so we can skip it. - return; - } + if (annotationTypeMatches(Getter.class, child)) { + //The annotation will make it happen, so we can skip it. + return; } } } @@ -244,6 +242,9 @@ public class HandleGetter extends JavacAnnotationHandler<Getter> { List<JCAnnotation> delegates = findDelegatesAndRemoveFromField(field); List<JCAnnotation> annsOnMethod = nonNulls.appendList(nullables); + if (isFieldDeprecated(field)) { + annsOnMethod = annsOnMethod.prepend(treeMaker.Annotation(chainDots(field, "java", "lang", "Deprecated"), List.<JCExpression>nil())); + } JCMethodDecl decl = recursiveSetGeneratedBy(treeMaker.MethodDef(treeMaker.Modifiers(access, annsOnMethod), methodName, methodType, methodGenericParams, parameters, throwsClauses, methodBody, annotationMethodDefaultValue), source); |