diff --git a/checker/src/main/java/org/checkerframework/checker/calledmethods/builder/LombokSupport.java b/checker/src/main/java/org/checkerframework/checker/calledmethods/builder/LombokSupport.java index 753a271ff81..1edcdf9c787 100644 --- a/checker/src/main/java/org/checkerframework/checker/calledmethods/builder/LombokSupport.java +++ b/checker/src/main/java/org/checkerframework/checker/calledmethods/builder/LombokSupport.java @@ -39,29 +39,51 @@ public LombokSupport(CalledMethodsAnnotatedTypeFactory atypeFactory) { this.atypeFactory = atypeFactory; } - // The list is copied from lombok.core.handlers.HandlerUtil. The list cannot be used from that - // class directly because Lombok does not provide class files for its own implementation, to - // prevent itself from being accidentally added to clients' compile classpaths. This design - // decision means that it is impossible to depend directly on Lombok internals. + // The list is copied from lombok.core.handlers.HandlerUtil: + // https://github.com/projectlombok/lombok/blob/master/src/core/lombok/core/handlers/HandlerUtil.java + // The list cannot be used from that class directly because Lombok does not provide + // class files for its own implementation, to prevent itself from being accidentally + // added to clients' compile classpaths. This design decision means that it is + // impossible to depend directly on Lombok internals. /** The list of annotations that Lombok treats as non-null. */ public static final List NONNULL_ANNOTATIONS = Collections.unmodifiableList( Arrays.asList( "android.annotation.NonNull", "android.support.annotation.NonNull", - "com.sun.istack.internal.NotNull", + "android.support.annotation.RecentlyNonNull", + "androidx.annotation.NonNull", + "androidx.annotation.RecentlyNonNull", + "com.android.annotations.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.unboundid.util.NotNull", "edu.umd.cs.findbugs.annotations.NonNull", + "io.micrometer.core.lang.NonNull", + "io.reactivex.annotations.NonNull", + "io.reactivex.rxjava3.annotations.NonNull", + "jakarta.annotation.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.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.jetbrains.annotations.NotNull", "org.jmlspecs.annotation.NonNull", + "org.jspecify.annotations.NonNull", "org.netbeans.api.annotations.common.NonNull", - "org.springframework.lang.NonNull")); + "org.springframework.lang.NonNull", + "reactor.util.annotation.NonNull")); /** * A map from elements that have a lombok.Builder.Default annotation to the simple property name diff --git a/checker/src/main/java/org/checkerframework/checker/nullness/NullnessAnnotatedTypeFactory.java b/checker/src/main/java/org/checkerframework/checker/nullness/NullnessAnnotatedTypeFactory.java index 62604a05af5..580e9fc49d8 100644 --- a/checker/src/main/java/org/checkerframework/checker/nullness/NullnessAnnotatedTypeFactory.java +++ b/checker/src/main/java/org/checkerframework/checker/nullness/NullnessAnnotatedTypeFactory.java @@ -170,6 +170,8 @@ public class NullnessAnnotatedTypeFactory "io.reactivex.rxjava3.annotations.NonNull", // https://github.com/jakartaee/common-annotations-api/blob/master/api/src/main/java/jakarta/annotation/Nonnull.java "jakarta.annotation.Nonnull", + // https://jakarta.ee/specifications/bean-validation/3.0/apidocs/jakarta/validation/constraints/notnull + "jakarta.validation.constraints.NotNull", // https://jcp.org/en/jsr/detail?id=305; no documentation at // https://www.javadoc.io/doc/com.google.code.findbugs/jsr305/3.0.1/javax/annotation/Nonnull.html "javax.annotation.Nonnull",