diff options
author | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2022-05-05 23:33:33 +0200 |
---|---|---|
committer | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2022-05-07 02:46:34 +0200 |
commit | 84d48a0aa5d78b71c801d1f9719327085a549e32 (patch) | |
tree | de3cb7c0eef1781ca5c097a4991b14a7fd2260b2 /src/core/lombok | |
parent | 7c29e55cb28250dabbdd4923d215d7741fde6e04 (diff) | |
download | lombok-84d48a0aa5d78b71c801d1f9719327085a549e32.tar.gz lombok-84d48a0aa5d78b71c801d1f9719327085a549e32.tar.bz2 lombok-84d48a0aa5d78b71c801d1f9719327085a549e32.zip |
[extern-annotations] Together with @rspilker, checked the list of 'annotations that mean: Non null' and cleaned it up.
Diffstat (limited to 'src/core/lombok')
-rw-r--r-- | src/core/lombok/core/handlers/HandlerUtil.java | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/core/lombok/core/handlers/HandlerUtil.java b/src/core/lombok/core/handlers/HandlerUtil.java index 039ce870..c06ee1ab 100644 --- a/src/core/lombok/core/handlers/HandlerUtil.java +++ b/src/core/lombok/core/handlers/HandlerUtil.java @@ -81,6 +81,13 @@ public class HandlerUtil { public static final List<String> NONNULL_ANNOTATIONS, BASE_COPYABLE_ANNOTATIONS, COPY_TO_SETTER_ANNOTATIONS, COPY_TO_BUILDER_SINGULAR_SETTER_ANNOTATIONS, JACKSON_COPY_TO_BUILDER_ANNOTATIONS; static { + // This is a list of annotations with a __highly specific meaning__: All annotations in this list indicate that passing null for the relevant item is __never__ acceptable, regardless of settings or circumstance. + // In other words, things like 'this models a database table, and the db table column has a nonnull constraint', or 'this represents a web form, and if this is null, the form is invalid' __do not count__ and should not be in this list; + // after all, you should be able to model invalid rows, or invalid forms. + + // In addition, the intent for these annotations is that they can be used 'in public' - it's not for internal-only usage annotations. + + // Presence of these annotations mean that lombok will generate null checks in any created setters and constructors. NONNULL_ANNOTATIONS = Collections.unmodifiableList(Arrays.asList(new String[] { "android.annotation.NonNull", "android.support.annotation.NonNull", @@ -88,11 +95,9 @@ public class HandlerUtil { "androidx.annotation.NonNull", "androidx.annotation.RecentlyNonNull", "com.android.annotations.NonNull", - "com.google.firebase.database.annotations.NotNull", - "com.google.firebase.internal.NonNull", - "com.mongodb.lang.NonNull", + "com.google.firebase.database.annotations.NotNull", // Even though it's in a database package, it does mean semantically: "Check if never null at the language level", and not 'db column cannot be null'. + "com.mongodb.lang.NonNull", // Even though mongo is a DB engine, this semantically refers to language, not DB table designs (mongo is a document DB engine, so this isn't surprising perhaps). "com.sun.istack.NotNull", - "com.sun.istack.internal.NotNull", "com.unboundid.util.NotNull", "edu.umd.cs.findbugs.annotations.NonNull", "io.micrometer.core.lang.NonNull", @@ -102,14 +107,11 @@ public class HandlerUtil { // "javax.validation.constraints.NotNull", // The field might contain a null value until it is persisted. "libcore.util.NonNull", "lombok.NonNull", - "org.antlr.v4.runtime.misc.NotNull", "org.checkerframework.checker.nullness.qual.NonNull", "org.checkerframework.checker.nullness.compatqual.NonNullDecl", "org.checkerframework.checker.nullness.compatqual.NonNullType", "org.codehaus.commons.nullanalysis.NotNull", "org.eclipse.jdt.annotation.NonNull", - "org.eclipse.jgit.annotations.NonNull", - "org.eclipse.lsp4j.jsonrpc.validation.NonNull", "org.jetbrains.annotations.NotNull", "org.jmlspecs.annotation.NonNull", "org.netbeans.api.annotations.common.NonNull", |