diff --git a/src/core/lombok/core/handlers/HandlerUtil.java b/src/core/lombok/core/handlers/HandlerUtil.java index 15f5702a95..2415b75059 100644 --- a/src/core/lombok/core/handlers/HandlerUtil.java +++ b/src/core/lombok/core/handlers/HandlerUtil.java @@ -82,38 +82,128 @@ public static int primeForNull() { public static final List NONNULL_ANNOTATIONS, BASE_COPYABLE_ANNOTATIONS, COPY_TO_SETTER_ANNOTATIONS, COPY_TO_BUILDER_SINGULAR_SETTER_ANNOTATIONS, JACKSON_COPY_TO_BUILDER_ANNOTATIONS; static { NONNULL_ANNOTATIONS = Collections.unmodifiableList(Arrays.asList(new String[] { - "androidx.annotation.NonNull", + "android.annotation.NonNull", "android.support.annotation.NonNull", + "android.support.annotation.RecentlyNonNull", + "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.sun.istack.NotNull", "com.sun.istack.internal.NotNull", + "com.unboundid.util.NotNull", "edu.umd.cs.findbugs.annotations.NonNull", + "io.micrometer.core.lang.NonNull", + "io.reactivex.annotations.NonNull", + "io.reactivex.rxjava3.annotations.NonNull", "javax.annotation.Nonnull", // "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", "org.springframework.lang.NonNull", + "reactor.util.annotation.NonNull", })); BASE_COPYABLE_ANNOTATIONS = Collections.unmodifiableList(Arrays.asList(new String[] { - "androidx.annotation.NonNull", - "androidx.annotation.Nullable", + "android.annotation.NonNull", + "android.annotation.Nullable", "android.support.annotation.NonNull", "android.support.annotation.Nullable", + "android.support.annotation.RecentlyNonNull", + "android.support.annotation.RecentlyNullable", + "androidx.annotation.NonNull", + "androidx.annotation.Nullable", + "androidx.annotation.RecentlyNonNull", + "androidx.annotation.RecentlyNullable", + "com.android.annotations.NonNull", + "com.android.annotations.Nullable", + "com.beust.jcommander.internal.Nullable", + "com.google.api.server.spi.config.Nullable", + "com.google.firebase.database.annotations.NotNull", + "com.google.firebase.database.annotations.Nullable", + "com.google.firebase.internal.NonNull", + "com.google.firebase.internal.Nullable", + "com.google.gerrit.common.Nullable", + "com.mongodb.lang.NonNull", + "com.mongodb.lang.Nullable", + "com.sun.istack.NotNull", + "com.sun.istack.Nullable", + "com.sun.istack.internal.NotNull", + "com.sun.istack.internal.Nullable", + "com.unboundid.util.NotNull", + "com.unboundid.util.Nullable", + "edu.umd.cs.findbugs.annotations.CheckForNull", "edu.umd.cs.findbugs.annotations.NonNull", "edu.umd.cs.findbugs.annotations.Nullable", + "edu.umd.cs.findbugs.annotations.PossiblyNull", "edu.umd.cs.findbugs.annotations.UnknownNullness", + "io.micrometer.core.lang.NonNull", + "io.micrometer.core.lang.Nullable", + "io.reactivex.annotations.NonNull", + "io.reactivex.annotations.Nullable", + "io.reactivex.rxjava3.annotations.NonNull", + "io.reactivex.rxjava3.annotations.Nullable", "javax.annotation.CheckForNull", "javax.annotation.Nonnull", + "javax.annotation.Nonnull", "javax.annotation.Nullable", + "javax.validation.constraints.NotNull", + "junitparams.converters.Nullable", + "libcore.util.NonNull", + "libcore.util.Nullable", "lombok.NonNull", + "org.antlr.v4.runtime.misc.NotNull", + "org.apache.avro.reflect.Nullable", + "org.apache.cxf.jaxrs.ext.Nullable", + "org.apache.shindig.common.Nullable", + "org.checkerframework.checker.nullness.compatqual.NonNullDecl", + "org.checkerframework.checker.nullness.compatqual.NonNullType", + "org.checkerframework.checker.nullness.compatqual.NullableDecl", + "org.checkerframework.checker.nullness.compatqual.NullableType", + "org.checkerframework.checker.nullness.qual.NonNull", + "org.checkerframework.checker.nullness.qual.Nullable", + "org.codehaus.commons.nullanalysis.NotNull", + "org.codehaus.commons.nullanalysis.Nullable", + "org.eclipse.jdt.annotation.NonNull", + "org.eclipse.jdt.annotation.Nullable", + "org.eclipse.jgit.annotations.NonNull", + "org.eclipse.jgit.annotations.Nullable", + "org.eclipse.lsp4j.jsonrpc.validation.NonNull", + "org.jetbrains.annotations.NotNull", + "org.jetbrains.annotations.Nullable", + "org.jetbrains.annotations.UnknownNullability", "org.jmlspecs.annotation.NonNull", "org.jmlspecs.annotation.Nullable", + "org.jspecify.nullness.Nullable", + "org.jspecify.nullness.NullnessUnspecified", + "org.netbeans.api.annotations.common.CheckForNull", + "org.netbeans.api.annotations.common.NonNull", + "org.netbeans.api.annotations.common.NullAllowed", + "org.netbeans.api.annotations.common.NullUnknown", + "org.springframework.lang.NonNull", + "org.springframework.lang.Nullable", + + // Checker Framework annotations. // To update Checker Framework annotations, run: - // grep --recursive --files-with-matches -e '^@Target\b.*TYPE_USE' $CHECKERFRAMEWORK/checker/src/main/java $CHECKERFRAMEWORK/framework/src/main/java | grep '\.java$' | sed 's/.*\/java\//\t\t\t"/' | sed 's/\.java$/",/' | sed 's/\//./g' | sort + // grep --recursive --files-with-matches -e '^@Target\b.*TYPE_USE' $CHECKERFRAMEWORK/checker/src/main/java $CHECKERFRAMEWORK/checker-qual/src/main/java $CHECKERFRAMEWORK/checker-util/src/main/java $CHECKERFRAMEWORK/framework/src/main/java | grep '\.java$' | sed 's/.*\/java\//\t\t\t"/' | sed 's/\.java$/",/' | sed 's/\//./g' | sort // Only add new annotations, do not remove annotations that have been removed from the lastest version of the Checker Framework. + "org.checkerframework.checker.builder.qual.CalledMethods", + "org.checkerframework.checker.builder.qual.NotCalledMethods", + "org.checkerframework.checker.calledmethods.qual.CalledMethods", + "org.checkerframework.checker.calledmethods.qual.CalledMethodsBottom", + "org.checkerframework.checker.calledmethods.qual.CalledMethodsPredicate", "org.checkerframework.checker.compilermsgs.qual.CompilerMessageKey", "org.checkerframework.checker.compilermsgs.qual.CompilerMessageKeyBottom", "org.checkerframework.checker.compilermsgs.qual.UnknownCompilerMessageKey", @@ -137,6 +227,7 @@ public static int primeForNull() { "org.checkerframework.checker.formatter.qual.Format", "org.checkerframework.checker.formatter.qual.FormatBottom", "org.checkerframework.checker.formatter.qual.InvalidFormat", + "org.checkerframework.checker.formatter.qual.UnknownFormat", "org.checkerframework.checker.guieffect.qual.AlwaysSafe", "org.checkerframework.checker.guieffect.qual.PolyUI", "org.checkerframework.checker.guieffect.qual.UI", @@ -181,6 +272,7 @@ public static int primeForNull() { "org.checkerframework.checker.index.qual.SubstringIndexFor", "org.checkerframework.checker.index.qual.SubstringIndexUnknown", "org.checkerframework.checker.index.qual.UpperBoundBottom", + "org.checkerframework.checker.index.qual.UpperBoundLiteral", "org.checkerframework.checker.index.qual.UpperBoundUnknown", "org.checkerframework.checker.initialization.qual.FBCBottom", "org.checkerframework.checker.initialization.qual.Initialized", @@ -194,18 +286,21 @@ public static int primeForNull() { "org.checkerframework.checker.lock.qual.GuardedByBottom", "org.checkerframework.checker.lock.qual.GuardedByUnknown", "org.checkerframework.checker.lock.qual.GuardSatisfied", + "org.checkerframework.checker.lock.qual.NewObject", + "org.checkerframework.checker.mustcall.qual.MustCall", + "org.checkerframework.checker.mustcall.qual.MustCallAlias", + "org.checkerframework.checker.mustcall.qual.MustCallUnknown", + "org.checkerframework.checker.mustcall.qual.PolyMustCall", "org.checkerframework.checker.nullness.qual.KeyFor", "org.checkerframework.checker.nullness.qual.KeyForBottom", "org.checkerframework.checker.nullness.qual.MonotonicNonNull", "org.checkerframework.checker.nullness.qual.NonNull", - "org.checkerframework.checker.nullness.qual.NonRaw", "org.checkerframework.checker.nullness.qual.Nullable", "org.checkerframework.checker.nullness.qual.PolyKeyFor", "org.checkerframework.checker.nullness.qual.PolyNull", - "org.checkerframework.checker.nullness.qual.PolyRaw", - "org.checkerframework.checker.nullness.qual.Raw", "org.checkerframework.checker.nullness.qual.UnknownKeyFor", "org.checkerframework.checker.optional.qual.MaybePresent", + "org.checkerframework.checker.optional.qual.OptionalBottom", "org.checkerframework.checker.optional.qual.PolyPresent", "org.checkerframework.checker.optional.qual.Present", "org.checkerframework.checker.propkey.qual.PropertyKey", @@ -215,29 +310,36 @@ public static int primeForNull() { "org.checkerframework.checker.regex.qual.Regex", "org.checkerframework.checker.regex.qual.RegexBottom", "org.checkerframework.checker.regex.qual.UnknownRegex", + "org.checkerframework.checker.signature.qual.ArrayWithoutPackage", "org.checkerframework.checker.signature.qual.BinaryName", - "org.checkerframework.checker.signature.qual.BinaryNameInUnnamedPackage", + "org.checkerframework.checker.signature.qual.BinaryNameOrPrimitiveType", + "org.checkerframework.checker.signature.qual.BinaryNameWithoutPackage", + "org.checkerframework.checker.signature.qual.CanonicalName", + "org.checkerframework.checker.signature.qual.CanonicalNameAndBinaryName", + "org.checkerframework.checker.signature.qual.CanonicalNameOrEmpty", + "org.checkerframework.checker.signature.qual.CanonicalNameOrPrimitiveType", "org.checkerframework.checker.signature.qual.ClassGetName", "org.checkerframework.checker.signature.qual.ClassGetSimpleName", "org.checkerframework.checker.signature.qual.DotSeparatedIdentifiers", + "org.checkerframework.checker.signature.qual.DotSeparatedIdentifiersOrPrimitiveType", "org.checkerframework.checker.signature.qual.FieldDescriptor", "org.checkerframework.checker.signature.qual.FieldDescriptorForPrimitive", - "org.checkerframework.checker.signature.qual.FieldDescriptorForPrimitiveOrArrayInUnnamedPackage", + "org.checkerframework.checker.signature.qual.FieldDescriptorWithoutPackage", "org.checkerframework.checker.signature.qual.FqBinaryName", "org.checkerframework.checker.signature.qual.FullyQualifiedName", "org.checkerframework.checker.signature.qual.Identifier", - "org.checkerframework.checker.signature.qual.IdentifierOrArray", + "org.checkerframework.checker.signature.qual.IdentifierOrPrimitiveType", "org.checkerframework.checker.signature.qual.InternalForm", "org.checkerframework.checker.signature.qual.MethodDescriptor", "org.checkerframework.checker.signature.qual.PolySignature", + "org.checkerframework.checker.signature.qual.PrimitiveType", "org.checkerframework.checker.signature.qual.SignatureBottom", - "org.checkerframework.checker.signedness.qual.Constant", - "org.checkerframework.checker.signedness.qual.PolySignedness", "org.checkerframework.checker.signedness.qual.PolySigned", "org.checkerframework.checker.signedness.qual.Signed", "org.checkerframework.checker.signedness.qual.SignednessBottom", "org.checkerframework.checker.signedness.qual.SignednessGlb", "org.checkerframework.checker.signedness.qual.SignedPositive", + "org.checkerframework.checker.signedness.qual.SignedPositiveFromUnsigned", "org.checkerframework.checker.signedness.qual.UnknownSignedness", "org.checkerframework.checker.signedness.qual.Unsigned", "org.checkerframework.checker.tainting.qual.PolyTainted", @@ -251,37 +353,48 @@ public static int primeForNull() { "org.checkerframework.checker.units.qual.cd", "org.checkerframework.checker.units.qual.Current", "org.checkerframework.checker.units.qual.degrees", + "org.checkerframework.checker.units.qual.Force", "org.checkerframework.checker.units.qual.g", "org.checkerframework.checker.units.qual.h", "org.checkerframework.checker.units.qual.K", "org.checkerframework.checker.units.qual.kg", "org.checkerframework.checker.units.qual.km", "org.checkerframework.checker.units.qual.km2", + "org.checkerframework.checker.units.qual.km3", "org.checkerframework.checker.units.qual.kmPERh", + "org.checkerframework.checker.units.qual.kN", "org.checkerframework.checker.units.qual.Length", "org.checkerframework.checker.units.qual.Luminance", "org.checkerframework.checker.units.qual.m", "org.checkerframework.checker.units.qual.m2", + "org.checkerframework.checker.units.qual.m3", "org.checkerframework.checker.units.qual.Mass", "org.checkerframework.checker.units.qual.min", "org.checkerframework.checker.units.qual.mm", "org.checkerframework.checker.units.qual.mm2", + "org.checkerframework.checker.units.qual.mm3", "org.checkerframework.checker.units.qual.mol", "org.checkerframework.checker.units.qual.mPERs", "org.checkerframework.checker.units.qual.mPERs2", + "org.checkerframework.checker.units.qual.N", "org.checkerframework.checker.units.qual.PolyUnit", "org.checkerframework.checker.units.qual.radians", "org.checkerframework.checker.units.qual.s", "org.checkerframework.checker.units.qual.Speed", "org.checkerframework.checker.units.qual.Substance", + "org.checkerframework.checker.units.qual.t", "org.checkerframework.checker.units.qual.Temperature", "org.checkerframework.checker.units.qual.Time", "org.checkerframework.checker.units.qual.UnitsBottom", "org.checkerframework.checker.units.qual.UnknownUnits", + "org.checkerframework.checker.units.qual.Volume", "org.checkerframework.common.aliasing.qual.LeakedToResult", "org.checkerframework.common.aliasing.qual.MaybeAliased", "org.checkerframework.common.aliasing.qual.NonLeaked", "org.checkerframework.common.aliasing.qual.Unique", + "org.checkerframework.common.initializedfields.qual.InitializedFields", + "org.checkerframework.common.initializedfields.qual.InitializedFieldsBottom", + "org.checkerframework.common.initializedfields.qual.PolyInitializedFields", "org.checkerframework.common.reflection.qual.ClassBound", "org.checkerframework.common.reflection.qual.ClassVal", "org.checkerframework.common.reflection.qual.ClassValBottom", @@ -289,6 +402,9 @@ public static int primeForNull() { "org.checkerframework.common.reflection.qual.MethodValBottom", "org.checkerframework.common.reflection.qual.UnknownClass", "org.checkerframework.common.reflection.qual.UnknownMethod", + "org.checkerframework.common.returnsreceiver.qual.BottomThis", + "org.checkerframework.common.returnsreceiver.qual.This", + "org.checkerframework.common.returnsreceiver.qual.UnknownThis", "org.checkerframework.common.subtyping.qual.Bottom", "org.checkerframework.common.util.report.qual.ReportUnqualified", "org.checkerframework.common.value.qual.ArrayLen", @@ -296,23 +412,15 @@ public static int primeForNull() { "org.checkerframework.common.value.qual.BoolVal", "org.checkerframework.common.value.qual.BottomVal", "org.checkerframework.common.value.qual.DoubleVal", + "org.checkerframework.common.value.qual.EnumVal", "org.checkerframework.common.value.qual.IntRange", "org.checkerframework.common.value.qual.IntVal", + "org.checkerframework.common.value.qual.MatchesRegex", "org.checkerframework.common.value.qual.MinLen", "org.checkerframework.common.value.qual.PolyValue", "org.checkerframework.common.value.qual.StringVal", "org.checkerframework.common.value.qual.UnknownVal", - "org.checkerframework.framework.qual.PolyAll", - "org.checkerframework.framework.util.PurityUnqualified", - - "org.eclipse.jdt.annotation.NonNull", - "org.eclipse.jdt.annotation.Nullable", - "org.jetbrains.annotations.NotNull", - "org.jetbrains.annotations.Nullable", - "org.springframework.lang.NonNull", - "org.springframework.lang.Nullable", - "org.netbeans.api.annotations.common.NonNull", - "org.netbeans.api.annotations.common.NullAllowed", + "org.checkerframework.framework.qual.PurityUnqualified", })); COPY_TO_SETTER_ANNOTATIONS = Collections.unmodifiableList(Arrays.asList(new String[] { "com.fasterxml.jackson.annotation.JacksonInject",