diff options
author | Roel Spilker <r.spilker@gmail.com> | 2012-03-05 20:18:10 +0100 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2012-03-05 20:18:10 +0100 |
commit | 4c8cc228e8f72972fa91a6c96d6e5bdf5ab6905c (patch) | |
tree | 9756c0ca5699e261d6851180fd6160436593ea67 /src | |
parent | 7988f17c28fb8f6a6f99a612f85ee804bed38dfe (diff) | |
parent | 73dab3e96613521b8769b29e6a3c7e4ee5f26911 (diff) | |
download | lombok-4c8cc228e8f72972fa91a6c96d6e5bdf5ab6905c.tar.gz lombok-4c8cc228e8f72972fa91a6c96d6e5bdf5ab6905c.tar.bz2 lombok-4c8cc228e8f72972fa91a6c96d6e5bdf5ab6905c.zip |
Issue 348: @Delegate should also generate @Deprecated when the interface methods javadoc contains@deprecated
Diffstat (limited to 'src')
-rw-r--r-- | src/core/lombok/javac/handlers/HandleDelegate.java | 3 | ||||
-rw-r--r-- | src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java | 18 |
2 files changed, 4 insertions, 17 deletions
diff --git a/src/core/lombok/javac/handlers/HandleDelegate.java b/src/core/lombok/javac/handlers/HandleDelegate.java index 41e587f8..18817d49 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; @@ -335,7 +336,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 = (member.flags() & DEPRECATED) != 0; signatures.add(new MethodSig(member.name, methodType, isDeprecated, exElem)); } diff --git a/src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java b/src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java index 87335b4e..acf1589d 100644 --- a/src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java +++ b/src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java @@ -21,8 +21,8 @@ */ package lombok.eclipse.agent; -import static lombok.eclipse.handlers.EclipseHandlerUtil.*; import static lombok.eclipse.Eclipse.*; +import static lombok.eclipse.handlers.EclipseHandlerUtil.*; import java.lang.reflect.Method; import java.util.ArrayList; @@ -65,7 +65,6 @@ import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; import org.eclipse.jdt.internal.compiler.ast.TypeParameter; import org.eclipse.jdt.internal.compiler.ast.TypeReference; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; -import org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding; import org.eclipse.jdt.internal.compiler.lookup.ArrayBinding; import org.eclipse.jdt.internal.compiler.lookup.BaseTypeBinding; import org.eclipse.jdt.internal.compiler.lookup.Binding; @@ -416,19 +415,6 @@ public class PatchDelegate { } } - private static boolean hasDeprecatedAnnotation(MethodBinding binding) { - AnnotationBinding[] annotations = binding.getAnnotations(); - if (annotations != null) for (AnnotationBinding ann : annotations) { - ReferenceBinding annType = ann.getAnnotationType(); - char[] pkg = annType.qualifiedPackageName(); - char[] src = annType.qualifiedSourceName(); - - if (charArrayEquals("java.lang", pkg) && charArrayEquals("Deprecated", src)) return true; - } - - return false; - } - public static void checkConflictOfTypeVarNames(BindingTuple binding, EclipseNode typeNode) throws CantMakeDelegates { TypeVariableBinding[] typeVars = binding.parameterized.typeVariables(); if (typeVars == null || typeVars.length == 0) return; @@ -581,7 +567,7 @@ public class PatchDelegate { method.modifiers = ClassFileConstants.AccPublic; method.returnType = makeType(binding.returnType, source, false); - boolean isDeprecated = hasDeprecatedAnnotation(binding); + boolean isDeprecated = binding.isDeprecated(); method.selector = binding.selector; |