aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorRawi01 <Rawi01@users.noreply.github.com>2023-02-11 20:33:46 +0100
committerRoel Spilker <r.spilker@gmail.com>2023-03-21 17:38:04 +0100
commite64c6b5879d36d45ec6a768ff907b7857a2ee217 (patch)
treedbae4d784afe5dd81c622a5928e06cb53cd8e3d2 /src/core
parent984cd1d5cf0af7263efaf167dc308ab59406cd68 (diff)
downloadlombok-e64c6b5879d36d45ec6a768ff907b7857a2ee217.tar.gz
lombok-e64c6b5879d36d45ec6a768ff907b7857a2ee217.tar.bz2
lombok-e64c6b5879d36d45ec6a768ff907b7857a2ee217.zip
[fixes #3346] Add jakarta Nonnull/Nullable annotations
Diffstat (limited to 'src/core')
-rw-r--r--src/core/lombok/ConfigurationKeys.java3
-rw-r--r--src/core/lombok/core/configuration/NullAnnotationLibrary.java3
-rw-r--r--src/core/lombok/core/handlers/HandlerUtil.java4
3 files changed, 7 insertions, 3 deletions
diff --git a/src/core/lombok/ConfigurationKeys.java b/src/core/lombok/ConfigurationKeys.java
index 22d5a4c5..93bcb85f 100644
--- a/src/core/lombok/ConfigurationKeys.java
+++ b/src/core/lombok/ConfigurationKeys.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013-2022 The Project Lombok Authors.
+ * Copyright (C) 2013-2023 The Project Lombok Authors.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -103,6 +103,7 @@ public class ConfigurationKeys {
* 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>
* <li>{@code javax} - The annotations {@code javax.annotation.NonNull} and {@code javax.annotation.Nullable} are used.</li>
+ * <li>{@code jakarta} - The annotations {@code jakarta.annotation.NonNull} and {@code jakarta.annotation.Nullable} are used.</li>
* <li>{@code eclipse} - The annotations {@code org.eclipse.jdt.annotation.NonNull} and {@code org.eclipse.jdt.annotation.Nullable} are used.</li>
* <li>{@code jetbrains} - The annotations {@code org.jetbrains.annotations.NotNull} and {@code org.jetbrains.annotations.Nullable} are used.</li>
* <li>{@code netbeans} - The annotations {@code org.netbeans.api.annotations.common.NonNull} and {@code org.netbeans.api.annotations.common.NullAllowed} are used.</li>
diff --git a/src/core/lombok/core/configuration/NullAnnotationLibrary.java b/src/core/lombok/core/configuration/NullAnnotationLibrary.java
index e8a07721..e1d31004 100644
--- a/src/core/lombok/core/configuration/NullAnnotationLibrary.java
+++ b/src/core/lombok/core/configuration/NullAnnotationLibrary.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2020 The Project Lombok Authors.
+ * Copyright (C) 2020-2023 The Project Lombok Authors.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -63,6 +63,7 @@ public final class NullAnnotationLibrary implements ConfigurationValueType {
public static final NullAnnotationLibrary NONE = new NullAnnotationLibrary("none", null, null, false);
public static final NullAnnotationLibrary JAVAX = new NullAnnotationLibrary("javax", "javax.annotation.Nonnull", "javax.annotation.Nullable", false);
+ public static final NullAnnotationLibrary JAKARTA = new NullAnnotationLibrary("jakarta", "jakarta.annotation.Nonnull", "jakarta.annotation.Nullable", false);
public static final NullAnnotationLibrary ECLIPSE = new NullAnnotationLibrary("eclipse", "org.eclipse.jdt.annotation.NonNull", "org.eclipse.jdt.annotation.Nullable", true);
public static final NullAnnotationLibrary JETBRAINS = new NullAnnotationLibrary("jetbrains", "org.jetbrains.annotations.NotNull", "org.jetbrains.annotations.Nullable", false);
public static final NullAnnotationLibrary NETBEANS = new NullAnnotationLibrary("netbeans", "org.netbeans.api.annotations.common.NonNull", "org.netbeans.api.annotations.common.NullAllowed", false);
diff --git a/src/core/lombok/core/handlers/HandlerUtil.java b/src/core/lombok/core/handlers/HandlerUtil.java
index 5e68f619..07704aa8 100644
--- a/src/core/lombok/core/handlers/HandlerUtil.java
+++ b/src/core/lombok/core/handlers/HandlerUtil.java
@@ -103,6 +103,7 @@ public class HandlerUtil {
"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",
@@ -160,9 +161,10 @@ public class HandlerUtil {
"io.reactivex.annotations.Nullable",
"io.reactivex.rxjava3.annotations.NonNull",
"io.reactivex.rxjava3.annotations.Nullable",
+ "jakarta.annotation.Nonnull",
+ "jakarta.annotation.Nullable",
"javax.annotation.CheckForNull",
"javax.annotation.Nonnull",
- "javax.annotation.Nonnull",
"javax.annotation.Nullable",
// "javax.validation.constraints.NotNull", // - this should definitely not be included; validation is not about language-level nullity, therefore should not be in this core list.
"libcore.util.NonNull",