diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2011-10-25 15:01:28 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2011-10-25 15:01:28 +0200 |
commit | 782daa49979c35cd93139b3cfbc98eafe346f790 (patch) | |
tree | a8f81b23c872fd76164b2d83f6a0448dca529745 /src | |
parent | c402dd86379e532895f73ee209c432f84bb5f421 (diff) | |
download | lombok-782daa49979c35cd93139b3cfbc98eafe346f790.tar.gz lombok-782daa49979c35cd93139b3cfbc98eafe346f790.tar.bz2 lombok-782daa49979c35cd93139b3cfbc98eafe346f790.zip |
Again made @NotNull have no special meaning.
See issues 43, 271, and 287.
Diffstat (limited to 'src')
-rw-r--r-- | src/core/lombok/NonNull.java | 4 | ||||
-rw-r--r-- | src/utils/lombok/core/TransformationsUtil.java | 6 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/core/lombok/NonNull.java b/src/core/lombok/NonNull.java index 96184dcd..b3d3c348 100644 --- a/src/core/lombok/NonNull.java +++ b/src/core/lombok/NonNull.java @@ -28,12 +28,12 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** - * Lombok is smart enough to translate any annotation named {@code @NonNull} or {@code @NotNull} in any casing and + * Lombok is smart enough to translate any annotation named {@code @NonNull} in any casing and * with any package name to the return type of generated getters and the parameter of generated setters and constructors, * as well as generate the appropriate null checks in the setter and constructor. * * You can use this annotation for the purpose, though you can also use JSR305's annotation, findbugs's, pmd's, or IDEA's, or just - * about anyone elses. As long as it is named {@code @NonNull} or {@code @NotNull}. + * about anyone elses. As long as it is named {@code @NonNull}. * * WARNING: If the java community ever does decide on supporting a single {@code @NonNull} annotation (for example via JSR305), then * this annotation will <strong>be deleted</strong> from the lombok package. If the need to update an import statement scares diff --git a/src/utils/lombok/core/TransformationsUtil.java b/src/utils/lombok/core/TransformationsUtil.java index 3fbfef58..25c3215a 100644 --- a/src/utils/lombok/core/TransformationsUtil.java +++ b/src/utils/lombok/core/TransformationsUtil.java @@ -72,7 +72,11 @@ public class TransformationsUtil { public static final Pattern PRIMITIVE_TYPE_NAME_PATTERN = Pattern.compile( "^(boolean|byte|short|int|long|float|double|char)$"); - public static final Pattern NON_NULL_PATTERN = Pattern.compile("^(?:notnull|nonnull)$", Pattern.CASE_INSENSITIVE); + /* NB: 'notnull' is not part of the pattern because there are lots of @NotNull annotations out there that are crappily named and actually mean + something else, such as 'this field must not be null _when saved to the db_ but its perfectly okay to start out as such, and a no-args + constructor and the implied starts-out-as-null state that goes with it is in fact mandatory' which happens with javax.validation.constraints.NotNull. + Various problems with spring have also been reported. See issue #287, issue #271, and issue #43. */ + public static final Pattern NON_NULL_PATTERN = Pattern.compile("^(?:nonnull)$", Pattern.CASE_INSENSITIVE); public static final Pattern NULLABLE_PATTERN = Pattern.compile("^(?:nullable|checkfornull)$", Pattern.CASE_INSENSITIVE); /** |