diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2014-06-01 11:02:18 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2014-06-01 11:02:18 +0200 |
commit | f8b3056dc4f61251aba7adf627c942c85e8618ca (patch) | |
tree | 8f58fc4d57d53cb791d027881fb8b8dd9cef11a1 /src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java | |
parent | 627de194c03af3afa3478149dc777d2af4e9654b (diff) | |
download | lombok-f8b3056dc4f61251aba7adf627c942c85e8618ca.tar.gz lombok-f8b3056dc4f61251aba7adf627c942c85e8618ca.tar.bz2 lombok-f8b3056dc4f61251aba7adf627c942c85e8618ca.zip |
Fixed up and extended Tolerate with support for constructors, and added docs.
Diffstat (limited to 'src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java')
-rw-r--r-- | src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java index 11f31c9d..b37dbd81 100644 --- a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java +++ b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java @@ -1203,7 +1203,7 @@ public class EclipseHandlerUtil { if (node != null && node.get() instanceof TypeDeclaration) { TypeDeclaration typeDecl = (TypeDeclaration)node.get(); - if (typeDecl.methods != null) for (AbstractMethodDeclaration def : typeDecl.methods) { + if (typeDecl.methods != null) top: for (AbstractMethodDeclaration def : typeDecl.methods) { if (def instanceof MethodDeclaration) { char[] mName = def.selector; if (mName == null) continue; @@ -1225,13 +1225,9 @@ public class EclipseHandlerUtil { if (params < minArgs || params > maxArgs) continue; } - boolean tolerate = false; - if (def.annotations != null) { - for (Annotation anno : def.annotations) { - tolerate |= typeMatches(Tolerate.class, node, anno.type); - } + if (def.annotations != null) for (Annotation anno : def.annotations) { + if (typeMatches(Tolerate.class, node, anno.type)) continue top; } - if (tolerate) continue; return getGeneratedBy(def) == null ? MemberExistsResult.EXISTS_BY_USER : MemberExistsResult.EXISTS_BY_LOMBOK; } @@ -1255,9 +1251,14 @@ public class EclipseHandlerUtil { if (node != null && node.get() instanceof TypeDeclaration) { TypeDeclaration typeDecl = (TypeDeclaration)node.get(); - if (typeDecl.methods != null) for (AbstractMethodDeclaration def : typeDecl.methods) { + if (typeDecl.methods != null) top: for (AbstractMethodDeclaration def : typeDecl.methods) { if (def instanceof ConstructorDeclaration) { if ((def.bits & ASTNode.IsDefaultConstructor) != 0) continue; + + if (def.annotations != null) for (Annotation anno : def.annotations) { + if (typeMatches(Tolerate.class, node, anno.type)) continue top; + } + return getGeneratedBy(def) == null ? MemberExistsResult.EXISTS_BY_USER : MemberExistsResult.EXISTS_BY_LOMBOK; } } |