aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok/javac
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2014-06-01 11:02:18 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2014-06-01 11:02:18 +0200
commitf8b3056dc4f61251aba7adf627c942c85e8618ca (patch)
tree8f58fc4d57d53cb791d027881fb8b8dd9cef11a1 /src/core/lombok/javac
parent627de194c03af3afa3478149dc777d2af4e9654b (diff)
downloadlombok-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/javac')
-rw-r--r--src/core/lombok/javac/handlers/JavacHandlerUtil.java23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/core/lombok/javac/handlers/JavacHandlerUtil.java b/src/core/lombok/javac/handlers/JavacHandlerUtil.java
index 474c5faa..25b95590 100644
--- a/src/core/lombok/javac/handlers/JavacHandlerUtil.java
+++ b/src/core/lombok/javac/handlers/JavacHandlerUtil.java
@@ -570,7 +570,7 @@ public class JavacHandlerUtil {
node = upToTypeNode(node);
if (node != null && node.get() instanceof JCClassDecl) {
- for (JCTree def : ((JCClassDecl)node.get()).defs) {
+ top: for (JCTree def : ((JCClassDecl)node.get()).defs) {
if (def instanceof JCMethodDecl) {
JCMethodDecl md = (JCMethodDecl) def;
String name = md.name.toString();
@@ -592,15 +592,11 @@ public class JavacHandlerUtil {
if (params < minArgs || params > maxArgs) continue;
}
-
- boolean tolerate = false;
+
List<JCAnnotation> annotations = md.getModifiers().getAnnotations();
- if (annotations != null) {
- for (JCAnnotation anno : annotations) {
- tolerate |= typeMatches(Tolerate.class, node, anno.getAnnotationType());
- }
+ if (annotations != null) for (JCAnnotation anno : annotations) {
+ if (typeMatches(Tolerate.class, node, anno.getAnnotationType())) continue top;
}
- if (tolerate) continue;
return getGeneratedBy(def) == null ? MemberExistsResult.EXISTS_BY_USER : MemberExistsResult.EXISTS_BY_LOMBOK;
}
@@ -621,10 +617,15 @@ public class JavacHandlerUtil {
node = upToTypeNode(node);
if (node != null && node.get() instanceof JCClassDecl) {
- for (JCTree def : ((JCClassDecl)node.get()).defs) {
+ top: for (JCTree def : ((JCClassDecl)node.get()).defs) {
if (def instanceof JCMethodDecl) {
- if (((JCMethodDecl)def).name.contentEquals("<init>")) {
- if ((((JCMethodDecl)def).mods.flags & Flags.GENERATEDCONSTR) != 0) continue;
+ JCMethodDecl md = (JCMethodDecl) def;
+ if (md.name.contentEquals("<init>")) {
+ if ((md.mods.flags & Flags.GENERATEDCONSTR) != 0) continue;
+ List<JCAnnotation> annotations = md.getModifiers().getAnnotations();
+ if (annotations != null) for (JCAnnotation anno : annotations) {
+ if (typeMatches(Tolerate.class, node, anno.getAnnotationType())) continue top;
+ }
return getGeneratedBy(def) == null ? MemberExistsResult.EXISTS_BY_USER : MemberExistsResult.EXISTS_BY_LOMBOK;
}
}