support delegate with deprecated comment.

This commit is contained in:
Taiki Sugawara committed 2012-02-22 05:01:35 +09:00
1 parent 0f86101098
commit c809047b78
4 files changed
+73 -1

No files matched your search

@@ -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));
}
@@ -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();
}
}
@@ -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();
}
}
@@ -0,0 +1,13 @@
import lombok.Delegate;
class DelegateWithDeprecated {
@Delegate private Bar bar;
private interface Bar {
@Deprecated
void deprecatedAnnotation();
/** @deprecated */
void deprecatedComment();
void notDeprecated();
}
}