diff options
Diffstat (limited to 'src/core/lombok/eclipse/handlers/HandleGetter.java')
-rw-r--r-- | src/core/lombok/eclipse/handlers/HandleGetter.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/core/lombok/eclipse/handlers/HandleGetter.java b/src/core/lombok/eclipse/handlers/HandleGetter.java index c631e583..d53bf89b 100644 --- a/src/core/lombok/eclipse/handlers/HandleGetter.java +++ b/src/core/lombok/eclipse/handlers/HandleGetter.java @@ -198,7 +198,7 @@ public class HandleGetter extends EclipseAnnotationHandler<Getter> { int modifier = toEclipseModifier(level) | (field.modifiers & ClassFileConstants.AccStatic); for (String altName : toAllGetterNames(fieldNode, isBoolean)) { - switch (methodExists(altName, fieldNode, false)) { + switch (methodExists(altName, fieldNode, false, 0)) { case EXISTS_BY_LOMBOK: return; case EXISTS_BY_USER: @@ -216,14 +216,20 @@ public class HandleGetter extends EclipseAnnotationHandler<Getter> { } MethodDeclaration method = generateGetter((TypeDeclaration) fieldNode.up().get(), fieldNode, getterName, modifier, source, lazy); - Annotation[] copiedAnnotations = copyAnnotations(source, findAnnotations(field, TransformationsUtil.NON_NULL_PATTERN), findAnnotations(field, TransformationsUtil.NULLABLE_PATTERN), findDelegatesAndMarkAsHandled(fieldNode)); + + Annotation[] deprecated = null; + if (isFieldDeprecated(fieldNode)) { + deprecated = new Annotation[] { generateDeprecatedAnnotation(source) }; + } + + Annotation[] copiedAnnotations = copyAnnotations(source, findAnnotations(field, TransformationsUtil.NON_NULL_PATTERN), findAnnotations(field, TransformationsUtil.NULLABLE_PATTERN), findDelegatesAndMarkAsHandled(fieldNode), deprecated); if (copiedAnnotations.length != 0) { method.annotations = copiedAnnotations; } injectMethod(fieldNode.up(), method); } - + private static Annotation[] findDelegatesAndMarkAsHandled(EclipseNode fieldNode) { List<Annotation> delegates = new ArrayList<Annotation>(); for (EclipseNode child : fieldNode.down()) { |