mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-14 02:16:18 +00:00
Add jspecify Nonnull/Nullable annotations
This commit is contained in:
1 parent
36be69b1c4
commit
0d0aba6bef
4 files changed
+6
-3
No files matched your search
@@ -62,5 +62,6 @@ Till Brychcy <till.brychcy@mercateo.com>
|
||||
Victor Williams Stafusa da Silva <victorwssilva@gmail.com>
|
||||
Yonatan Sherwin <yonatansherwin@gmail.com>
|
||||
Yun Zhi Lin <yun@yunspace.com>
|
||||
MoonFruit <dkmoonfruit@gmail.com>
|
||||
|
||||
By adding your name to this list, you grant full and irrevocable copyright and patent indemnity to Project Lombok and all use of Project Lombok in relation to all commits you add to Project Lombok, and you certify that you have the right to do so.
|
||||
@@ -106,7 +106,7 @@ public class ConfigurationKeys {
|
||||
public static final ConfigurationKey<Boolean> ADD_SUPPRESSWARNINGS_ANNOTATIONS = new ConfigurationKey<Boolean>("lombok.addSuppressWarnings", "Generate @java.lang.SuppressWarnings(\"all\") on all generated code (default: true).") {};
|
||||
|
||||
/**
|
||||
* lombok configuration: {@code lombok.addNullAnnotations = }one of: [{@code none}, {@code javax}, {@code eclipse}, {@code jetbrains}, {@code netbeans}, {@code androidx}, {@code android.support}, {@code checkerframework}, {@code findbugs}, {@code spring}, {@code JML}, or a custom set of fully qualified annotation types].
|
||||
* lombok configuration: {@code lombok.addNullAnnotations = }one of: [{@code none}, {@code javax}, {@code eclipse}, {@code jetbrains}, {@code netbeans}, {@code androidx}, {@code android.support}, {@code checkerframework}, {@code findbugs}, {@code spring}, {@code JML}, {@code jspecify} or a custom set of fully qualified annotation types].
|
||||
*
|
||||
* Lombok generally copies relevant nullity annotations from your source code to the right places. However, sometimes lombok generates code where the nullability of some node is not dependent on something in your source code. You can configure lombok to add an appropriate nullity annotation in this case.<ul>
|
||||
* <li>{@code none} (the default) - no annotations are added.</li>
|
||||
@@ -121,6 +121,7 @@ public class ConfigurationKeys {
|
||||
* <li>{@code findbugs} - The annotations {@code edu.umd.cs.findbugs.annotations.NonNull} and {@code edu.umd.cs.findbugs.annotations.Nullable} are used.</li>
|
||||
* <li>{@code spring} - The annotations {@code org.springframework.lang.NonNull} and {@code org.springframework.lang.Nullable} are used.</li>
|
||||
* <li>{@code jml} - The annotations {@code org.jmlspecs.annotation.NonNull} and {@code org.jmlspecs.annotation.Nullable} are used.</li>
|
||||
* <li>{@code jspecify} - The annotations {@code org.jspecify.annotations.NonNull} and {@code org.jspecify.annotations.Nullable} are used.</li>
|
||||
* <li><code>CUSTOM:<em>fully.qualified.nonnull.annotation</em>:<em>fully.qualified.nullable.annotation</em></code> to configure your own types; the nullable annotation (and the colon) are optional.</li>
|
||||
* </ul>
|
||||
* <p>
|
||||
|
||||
@@ -73,7 +73,8 @@ public final class NullAnnotationLibrary implements ConfigurationValueType {
|
||||
public static final NullAnnotationLibrary FINDBUGS = new NullAnnotationLibrary("findbugs", "edu.umd.cs.findbugs.annotations.NonNull", "edu.umd.cs.findbugs.annotations.Nullable", false);
|
||||
public static final NullAnnotationLibrary SPRING = new NullAnnotationLibrary("spring", "org.springframework.lang.NonNull", "org.springframework.lang.Nullable", false);
|
||||
public static final NullAnnotationLibrary JML = new NullAnnotationLibrary("jml", "org.jmlspecs.annotation.NonNull", "org.jmlspecs.annotation.Nullable", false);
|
||||
|
||||
public static final NullAnnotationLibrary JSPECIFY = new NullAnnotationLibrary("jspecify", "org.jspecify.annotations.NonNull", "org.jspecify.annotations.Nullable", true);
|
||||
|
||||
private static final List<NullAnnotationLibrary> ALL_AVAILABLE;
|
||||
private static final String EXAMPLE_VALUE;
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
<ol class="snippet example oneliner">
|
||||
<li><code>lombok.addNullAnnotations = <em><flavor></em></code></li>
|
||||
</ol>
|
||||
Many <em>flavors</em> are available: <code>javax</code> (=JSR305; not recommended), <code>jakarta</code>, <code>eclipse</code>, <code>jetbrains</code>, <code>netbeans</code>, <code>androidx</code>, <code>android.support</code> (deprecated within android), <code>checkerframework</code> (recommended), <code>findbugs</code>, <code>spring</code>, <code>jml</code>, or define your own via <code>CUSTOM:fully.qualified.NonNullAnnotation:fully.qualified.NullableAnnotation</code>; if your nullity annotation is solely of the type use style (it annotates types, such as eclipse's and checkerframework's offerings, versus annotating methods and parameters), the format is <code>CUSTOM:TYPE_USE:nonnullanno:nullableanno</code>.<br />
|
||||
Many <em>flavors</em> are available: <code>javax</code> (=JSR305; not recommended), <code>jakarta</code>, <code>eclipse</code>, <code>jetbrains</code>, <code>netbeans</code>, <code>androidx</code>, <code>android.support</code> (deprecated within android), <code>checkerframework</code> (recommended), <code>findbugs</code>, <code>spring</code>, <code>jml</code>, <code>jspecify</code>, or define your own via <code>CUSTOM:fully.qualified.NonNullAnnotation:fully.qualified.NullableAnnotation</code>; if your nullity annotation is solely of the type use style (it annotates types, such as eclipse's and checkerframework's offerings, versus annotating methods and parameters), the format is <code>CUSTOM:TYPE_USE:nonnullanno:nullableanno</code>.<br />
|
||||
<em>This feature was added in lombok v1.18.12</em>.<br />
|
||||
</p><p>
|
||||
Lombok can be configured to add <code>@lombok.Generated</code> annotations to all generated nodes where possible; useful for JaCoCo (which has built in support),
|
||||
|
||||
Reference in new issue
Block a user