diff options
author | Reinier Zwitserloot <reinier@tipit.to> | 2009-08-27 23:05:14 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@tipit.to> | 2009-08-27 23:05:14 +0200 |
commit | fe0da3f53f1e88b704e21463cc5fea3d998e394a (patch) | |
tree | fa97c0d94a562dd7dd862a5d8e6e2f1ac432d060 /src/lombok/javac/handlers/PKG.java | |
parent | e6bb460e2b1ba49698e5306ddcb5ce38748e2dfc (diff) | |
download | lombok-fe0da3f53f1e88b704e21463cc5fea3d998e394a.tar.gz lombok-fe0da3f53f1e88b704e21463cc5fea3d998e394a.tar.bz2 lombok-fe0da3f53f1e88b704e21463cc5fea3d998e394a.zip |
Now @Nullable is also copied over.
Diffstat (limited to 'src/lombok/javac/handlers/PKG.java')
-rw-r--r-- | src/lombok/javac/handlers/PKG.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lombok/javac/handlers/PKG.java b/src/lombok/javac/handlers/PKG.java index 006e92a3..42cfed13 100644 --- a/src/lombok/javac/handlers/PKG.java +++ b/src/lombok/javac/handlers/PKG.java @@ -22,6 +22,7 @@ package lombok.javac.handlers; import java.lang.reflect.Modifier; +import java.util.regex.Pattern; import lombok.AccessLevel; import lombok.core.TransformationsUtil; @@ -257,7 +258,10 @@ class PKG { return e; } - static List<JCAnnotation> findNonNullAnnotations(Node fieldNode) { + static final Pattern NON_NULL_PATTERN = Pattern.compile("^no[tn]null$", Pattern.CASE_INSENSITIVE); + static final Pattern NULLABLE_PATTERN = Pattern.compile("^nullable$", Pattern.CASE_INSENSITIVE); + + static List<JCAnnotation> findAnnotations(Node fieldNode, Pattern namePattern) { List<JCAnnotation> result = List.nil(); for ( Node child : fieldNode.down() ) { if ( child.getKind() == Kind.ANNOTATION ) { @@ -265,7 +269,7 @@ class PKG { String name = annotation.annotationType.toString(); int idx = name.lastIndexOf("."); String suspect = idx == -1 ? name : name.substring(idx + 1); - if (suspect.equalsIgnoreCase("NonNull") || suspect.equalsIgnoreCase("NotNull")) { + if (namePattern.matcher(suspect).matches()) { result = result.append(annotation); } } |