Skip to content

Commit 013a76c

Browse files
authored
Update lists of aliases for @NonNull (#6883)
1 parent f23bf98 commit 013a76c

File tree

2 files changed

+31
-7
lines changed

2 files changed

+31
-7
lines changed

checker/src/main/java/org/checkerframework/checker/calledmethods/builder/LombokSupport.java

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,29 +39,51 @@ public LombokSupport(CalledMethodsAnnotatedTypeFactory atypeFactory) {
3939
this.atypeFactory = atypeFactory;
4040
}
4141

42-
// The list is copied from lombok.core.handlers.HandlerUtil. The list cannot be used from that
43-
// class directly because Lombok does not provide class files for its own implementation, to
44-
// prevent itself from being accidentally added to clients' compile classpaths. This design
45-
// decision means that it is impossible to depend directly on Lombok internals.
42+
// The list is copied from lombok.core.handlers.HandlerUtil:
43+
// https://github.com/projectlombok/lombok/blob/master/src/core/lombok/core/handlers/HandlerUtil.java
44+
// The list cannot be used from that class directly because Lombok does not provide
45+
// class files for its own implementation, to prevent itself from being accidentally
46+
// added to clients' compile classpaths. This design decision means that it is
47+
// impossible to depend directly on Lombok internals.
4648
/** The list of annotations that Lombok treats as non-null. */
4749
public static final List<String> NONNULL_ANNOTATIONS =
4850
Collections.unmodifiableList(
4951
Arrays.asList(
5052
"android.annotation.NonNull",
5153
"android.support.annotation.NonNull",
52-
"com.sun.istack.internal.NotNull",
54+
"android.support.annotation.RecentlyNonNull",
55+
"androidx.annotation.NonNull",
56+
"androidx.annotation.RecentlyNonNull",
57+
"com.android.annotations.NonNull",
58+
"com.google.firebase.database.annotations.NotNull", // Even though it's in a
59+
// database package, it does mean semantically: "Check if
60+
// never null at the language level", and not 'db column cannot be null'.
61+
"com.mongodb.lang.NonNull", // Even though mongo is a DB engine,
62+
// this semantically refers to language, not DB table designs (mongo is a
63+
// document DB engine, so this isn't surprising perhaps).
64+
"com.sun.istack.NotNull",
65+
"com.unboundid.util.NotNull",
5366
"edu.umd.cs.findbugs.annotations.NonNull",
67+
"io.micrometer.core.lang.NonNull",
68+
"io.reactivex.annotations.NonNull",
69+
"io.reactivex.rxjava3.annotations.NonNull",
70+
"jakarta.annotation.Nonnull",
5471
"javax.annotation.Nonnull",
5572
// "javax.validation.constraints.NotNull", // The field might contain a
5673
// null value until it is persisted.
74+
"libcore.util.NonNull",
5775
"lombok.NonNull",
5876
"org.checkerframework.checker.nullness.qual.NonNull",
77+
"org.checkerframework.checker.nullness.compatqual.NonNullDecl",
78+
"org.checkerframework.checker.nullness.compatqual.NonNullType",
79+
"org.codehaus.commons.nullanalysis.NotNull",
5980
"org.eclipse.jdt.annotation.NonNull",
60-
"org.eclipse.jgit.annotations.NonNull",
6181
"org.jetbrains.annotations.NotNull",
6282
"org.jmlspecs.annotation.NonNull",
83+
"org.jspecify.annotations.NonNull",
6384
"org.netbeans.api.annotations.common.NonNull",
64-
"org.springframework.lang.NonNull"));
85+
"org.springframework.lang.NonNull",
86+
"reactor.util.annotation.NonNull"));
6587

6688
/**
6789
* A map from elements that have a lombok.Builder.Default annotation to the simple property name

checker/src/main/java/org/checkerframework/checker/nullness/NullnessAnnotatedTypeFactory.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ public class NullnessAnnotatedTypeFactory
170170
"io.reactivex.rxjava3.annotations.NonNull",
171171
// https://github.com/jakartaee/common-annotations-api/blob/master/api/src/main/java/jakarta/annotation/Nonnull.java
172172
"jakarta.annotation.Nonnull",
173+
// https://jakarta.ee/specifications/bean-validation/3.0/apidocs/jakarta/validation/constraints/notnull
174+
"jakarta.validation.constraints.NotNull",
173175
// https://jcp.org/en/jsr/detail?id=305; no documentation at
174176
// https://www.javadoc.io/doc/com.google.code.findbugs/jsr305/3.0.1/javax/annotation/Nonnull.html
175177
"javax.annotation.Nonnull",

0 commit comments

Comments
 (0)