From 821370e01b1c1878c36da81c5baa93bf1dd5c973 Mon Sep 17 00:00:00 2001 From: Taiki Sugawara Date: Fri, 24 Feb 2012 23:55:02 +0900 Subject: Add deprecated comment support for eclipse. --- src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/eclipseAgent/lombok/eclipse') diff --git a/src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java b/src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java index 87335b4e..6977df2b 100644 --- a/src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java +++ b/src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java @@ -581,7 +581,7 @@ public class PatchDelegate { method.modifiers = ClassFileConstants.AccPublic; method.returnType = makeType(binding.returnType, source, false); - boolean isDeprecated = hasDeprecatedAnnotation(binding); + boolean isDeprecated = hasDeprecatedAnnotation(binding) || binding.isDeprecated(); method.selector = binding.selector; -- cgit From 73dab3e96613521b8769b29e6a3c7e4ee5f26911 Mon Sep 17 00:00:00 2001 From: Taiki Sugawara Date: Sat, 25 Feb 2012 00:11:57 +0900 Subject: Handle deprecated by ordinary usage. --- src/core/lombok/javac/handlers/HandleDelegate.java | 2 +- .../lombok/eclipse/agent/PatchDelegate.java | 18 ++---------------- 2 files changed, 3 insertions(+), 17 deletions(-) (limited to 'src/eclipseAgent/lombok/eclipse') diff --git a/src/core/lombok/javac/handlers/HandleDelegate.java b/src/core/lombok/javac/handlers/HandleDelegate.java index 25f29698..b1b1ecc6 100644 --- a/src/core/lombok/javac/handlers/HandleDelegate.java +++ b/src/core/lombok/javac/handlers/HandleDelegate.java @@ -330,7 +330,7 @@ public class HandleDelegate extends JavacAnnotationHandler { 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 || (member.flags() & DEPRECATED) != 0; + 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 6977df2b..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) || binding.isDeprecated(); + boolean isDeprecated = binding.isDeprecated(); method.selector = binding.selector; -- cgit