aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/lombok/javac/handlers/HandleDelegate.java3
-rw-r--r--test/transform/resource/after-delombok/DelegateWithDeprecated.java29
-rw-r--r--test/transform/resource/after-ecj/DelegateWithDeprecated.java29
-rw-r--r--test/transform/resource/before/DelegateWithDeprecated.java13
4 files changed, 73 insertions, 1 deletions
diff --git a/src/core/lombok/javac/handlers/HandleDelegate.java b/src/core/lombok/javac/handlers/HandleDelegate.java
index 9eca23db..25f29698 100644
--- a/src/core/lombok/javac/handlers/HandleDelegate.java
+++ b/src/core/lombok/javac/handlers/HandleDelegate.java
@@ -22,6 +22,7 @@
package lombok.javac.handlers;
import static lombok.javac.handlers.JavacHandlerUtil.*;
+import static com.sun.tools.javac.code.Flags.*;
import java.util.ArrayList;
import java.util.Arrays;
@@ -329,7 +330,7 @@ public class HandleDelegate extends JavacAnnotationHandler<Delegate> {
ExecutableType methodType = (ExecutableType) types.asMemberOf(ct, member);
String sig = printSig(methodType, member.name, types);
if (!banList.add(sig)) continue; //If add returns false, it was already in there
- boolean isDeprecated = exElem.getAnnotation(Deprecated.class) != null;
+ boolean isDeprecated = exElem.getAnnotation(Deprecated.class) != null || (member.flags() & DEPRECATED) != 0;
signatures.add(new MethodSig(member.name, methodType, isDeprecated, exElem));
}
diff --git a/test/transform/resource/after-delombok/DelegateWithDeprecated.java b/test/transform/resource/after-delombok/DelegateWithDeprecated.java
new file mode 100644
index 00000000..011eaf36
--- /dev/null
+++ b/test/transform/resource/after-delombok/DelegateWithDeprecated.java
@@ -0,0 +1,29 @@
+class DelegateWithDeprecated {
+
+ private Bar bar;
+
+ private interface Bar {
+
+ @Deprecated
+ void deprecatedAnnotation();
+ /** @deprecated */
+ void deprecatedComment();
+
+ void notDeprecated();
+ }
+
+ @java.lang.Deprecated
+ @java.lang.SuppressWarnings("all")
+ public void deprecatedAnnotation() {
+ this.bar.deprecatedAnnotation();
+ }
+ @java.lang.Deprecated
+ @java.lang.SuppressWarnings("all")
+ public void deprecatedComment() {
+ this.bar.deprecatedComment();
+ }
+ @java.lang.SuppressWarnings("all")
+ public void notDeprecated() {
+ this.bar.notDeprecated();
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-ecj/DelegateWithDeprecated.java b/test/transform/resource/after-ecj/DelegateWithDeprecated.java
new file mode 100644
index 00000000..011eaf36
--- /dev/null
+++ b/test/transform/resource/after-ecj/DelegateWithDeprecated.java
@@ -0,0 +1,29 @@
+class DelegateWithDeprecated {
+
+ private Bar bar;
+
+ private interface Bar {
+
+ @Deprecated
+ void deprecatedAnnotation();
+ /** @deprecated */
+ void deprecatedComment();
+
+ void notDeprecated();
+ }
+
+ @java.lang.Deprecated
+ @java.lang.SuppressWarnings("all")
+ public void deprecatedAnnotation() {
+ this.bar.deprecatedAnnotation();
+ }
+ @java.lang.Deprecated
+ @java.lang.SuppressWarnings("all")
+ public void deprecatedComment() {
+ this.bar.deprecatedComment();
+ }
+ @java.lang.SuppressWarnings("all")
+ public void notDeprecated() {
+ this.bar.notDeprecated();
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/before/DelegateWithDeprecated.java b/test/transform/resource/before/DelegateWithDeprecated.java
new file mode 100644
index 00000000..b748c6ec
--- /dev/null
+++ b/test/transform/resource/before/DelegateWithDeprecated.java
@@ -0,0 +1,13 @@
+import lombok.Delegate;
+
+class DelegateWithDeprecated {
+ @Delegate private Bar bar;
+
+ private interface Bar {
+ @Deprecated
+ void deprecatedAnnotation();
+ /** @deprecated */
+ void deprecatedComment();
+ void notDeprecated();
+ }
+} \ No newline at end of file