diff options
author | Rawi01 <Rawi01@users.noreply.github.com> | 2020-05-16 11:54:56 +0200 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2020-05-28 22:36:35 +0200 |
commit | a2a194f32da2058e8783cd664d74799cf418d03d (patch) | |
tree | eaa2a1aaea04cdfbcc6ad1eec89fda913afdcb52 /src/core/lombok/javac | |
parent | 7d08af7d856b41580fa4b913e2b0c9002a8fc341 (diff) | |
download | lombok-a2a194f32da2058e8783cd664d74799cf418d03d.tar.gz lombok-a2a194f32da2058e8783cd664d74799cf418d03d.tar.bz2 lombok-a2a194f32da2058e8783cd664d74799cf418d03d.zip |
[fixes #2006] Delegate now excludes already implemented methods
Diffstat (limited to 'src/core/lombok/javac')
-rw-r--r-- | src/core/lombok/javac/handlers/HandleDelegate.java | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/core/lombok/javac/handlers/HandleDelegate.java b/src/core/lombok/javac/handlers/HandleDelegate.java index c19540fa..d6e76ab1 100644 --- a/src/core/lombok/javac/handlers/HandleDelegate.java +++ b/src/core/lombok/javac/handlers/HandleDelegate.java @@ -48,6 +48,7 @@ import org.mangosdk.spi.ProviderFor; import com.sun.tools.javac.code.Attribute.Compound; import com.sun.tools.javac.code.Flags; import com.sun.tools.javac.code.Symbol; +import com.sun.tools.javac.code.Symbol.MethodSymbol; import com.sun.tools.javac.code.Symbol.TypeSymbol; import com.sun.tools.javac.code.Type; import com.sun.tools.javac.code.Type.ClassType; @@ -175,14 +176,14 @@ public class HandleDelegate extends JavacAnnotationHandler<Delegate> { List<MethodSig> signaturesToExclude = new ArrayList<MethodSig>(); Set<String> banList = new HashSet<String>(); banList.addAll(METHODS_IN_OBJECT); - /* To exclude all methods in the class itself, try this: - for (Symbol member : ((JCClassDecl)typeNode.get()).sym.getEnclosedElements()) { - if (member instanceof MethodSymbol) { - MethodSymbol method = (MethodSymbol) member; - banList.add(printSig((ExecutableType) method.asType(), method.name, annotationNode.getTypesUtil())); + + // Add already implemented methods to ban list + JavacNode typeNode = upToTypeNode(annotationNode); + for (Symbol m : ((JCClassDecl)typeNode.get()).sym.getEnclosedElements()) { + if (m instanceof MethodSymbol) { + banList.add(printSig((ExecutableType) m.asType(), m.name, annotationNode.getTypesUtil())); } } - */ try { for (Type t : toExclude) { |