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/JavacHandlerUtil.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/JavacHandlerUtil.java')
-rw-r--r-- | src/core/lombok/javac/handlers/JavacHandlerUtil.java | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/core/lombok/javac/handlers/JavacHandlerUtil.java b/src/core/lombok/javac/handlers/JavacHandlerUtil.java index 244f7d38..32b17322 100644 --- a/src/core/lombok/javac/handlers/JavacHandlerUtil.java +++ b/src/core/lombok/javac/handlers/JavacHandlerUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2011 The Project Lombok Authors. + * Copyright (C) 2009-2012 The Project Lombok Authors. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -142,6 +142,24 @@ public class JavacHandlerUtil { } /** + * Returns if a field is marked deprecated, either by {@code @Deprecated} or in javadoc + * @param field the field to check + * @return {@code true} if a field is marked deprecated, either by {@code @Deprecated} or in javadoc, otherwise {@code false} + */ + public static boolean isFieldDeprecated(JavacNode field) { + JCVariableDecl fieldNode = (JCVariableDecl) field.get(); + if ((fieldNode.mods.flags & Flags.DEPRECATED) != 0) { + return true; + } + for (JavacNode child : field.down()) { + if (annotationTypeMatches(Deprecated.class, child)) { + return true; + } + } + return false; + } + + /** * Creates an instance of {@code AnnotationValues} for the provided AST Node. * * @param type An annotation class type, such as {@code lombok.Getter.class}. |