From d286106331978f69aaf29af51b49a504244acbdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Schn=C3=A9ider?= Date: Thu, 15 Aug 2024 05:02:35 -0400 Subject: [PATCH] Migrate to JSpecify from OpenRewrite JSR-305 meta-annotations (#31) * Migrate to JSpecify from OpenRewrite JSR-305 meta-annotations Use this link to re-run the recipe: https://app.moderne.io/builder/gW3xaSLWV?organizationId=T3BlblJld3JpdGU%3D Co-authored-by: Moderne * Rely on package default for `NonNull` --------- Co-authored-by: Moderne Co-authored-by: Tim te Beek --- .../java/org/openrewrite/featureflags/ff4j/package-info.java | 4 ++-- .../openrewrite/featureflags/ff4j/search/FindFeatureFlag.java | 2 +- .../openrewrite/featureflags/ff4j/search/package-info.java | 4 ++-- .../featureflags/launchdarkly/ChangeVariationDefault.java | 3 --- .../openrewrite/featureflags/launchdarkly/package-info.java | 4 ++-- .../featureflags/launchdarkly/search/FindFeatureFlag.java | 2 +- .../featureflags/launchdarkly/search/package-info.java | 4 ++-- .../openrewrite/featureflags/openfeature/package-info.java | 4 ++-- .../featureflags/openfeature/search/FindFeatureFlag.java | 2 +- .../featureflags/openfeature/search/package-info.java | 4 ++-- src/main/java/org/openrewrite/featureflags/package-info.java | 4 ++-- .../org/openrewrite/featureflags/search/FindFeatureFlag.java | 2 +- .../org/openrewrite/featureflags/search/package-info.java | 4 ++-- .../org/openrewrite/featureflags/unleash/package-info.java | 4 ++-- .../featureflags/unleash/search/FindFeatureFlag.java | 2 +- .../openrewrite/featureflags/unleash/search/package-info.java | 4 ++-- 16 files changed, 25 insertions(+), 28 deletions(-) diff --git a/src/main/java/org/openrewrite/featureflags/ff4j/package-info.java b/src/main/java/org/openrewrite/featureflags/ff4j/package-info.java index 44a39d9..e303b15 100644 --- a/src/main/java/org/openrewrite/featureflags/ff4j/package-info.java +++ b/src/main/java/org/openrewrite/featureflags/ff4j/package-info.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -@NonNullApi +@NullMarked @NonNullFields package org.openrewrite.featureflags.ff4j; -import org.openrewrite.internal.lang.NonNullApi; +import org.jspecify.annotations.NullMarked; import org.openrewrite.internal.lang.NonNullFields; diff --git a/src/main/java/org/openrewrite/featureflags/ff4j/search/FindFeatureFlag.java b/src/main/java/org/openrewrite/featureflags/ff4j/search/FindFeatureFlag.java index 65929fe..e29204f 100644 --- a/src/main/java/org/openrewrite/featureflags/ff4j/search/FindFeatureFlag.java +++ b/src/main/java/org/openrewrite/featureflags/ff4j/search/FindFeatureFlag.java @@ -17,9 +17,9 @@ import lombok.EqualsAndHashCode; import lombok.Value; +import org.jspecify.annotations.Nullable; import org.openrewrite.Option; import org.openrewrite.Recipe; -import org.openrewrite.internal.lang.Nullable; import java.util.Collections; import java.util.List; diff --git a/src/main/java/org/openrewrite/featureflags/ff4j/search/package-info.java b/src/main/java/org/openrewrite/featureflags/ff4j/search/package-info.java index e11c0ca..0a3be78 100644 --- a/src/main/java/org/openrewrite/featureflags/ff4j/search/package-info.java +++ b/src/main/java/org/openrewrite/featureflags/ff4j/search/package-info.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -@NonNullApi +@NullMarked @NonNullFields package org.openrewrite.featureflags.ff4j.search; -import org.openrewrite.internal.lang.NonNullApi; +import org.jspecify.annotations.NullMarked; import org.openrewrite.internal.lang.NonNullFields; diff --git a/src/main/java/org/openrewrite/featureflags/launchdarkly/ChangeVariationDefault.java b/src/main/java/org/openrewrite/featureflags/launchdarkly/ChangeVariationDefault.java index 1a25ed1..b2d04c3 100644 --- a/src/main/java/org/openrewrite/featureflags/launchdarkly/ChangeVariationDefault.java +++ b/src/main/java/org/openrewrite/featureflags/launchdarkly/ChangeVariationDefault.java @@ -21,7 +21,6 @@ import org.openrewrite.analysis.constantfold.ConstantFold; import org.openrewrite.analysis.util.CursorUtil; import org.openrewrite.internal.ListUtils; -import org.openrewrite.internal.lang.NonNull; import org.openrewrite.java.JavaIsoVisitor; import org.openrewrite.java.MethodMatcher; import org.openrewrite.java.search.UsesMethod; @@ -47,13 +46,11 @@ public String getDescription() { @Option(displayName = "Feature flag key", description = "The key of the feature flag to remove.", example = "flag-key-123abc") - @NonNull String featureKey; @Option(displayName = "Default value", description = "The default value to use in feature flag invocations.", example = "true") - @NonNull String defaultValue; private static final MethodMatcher BOOL_VARIATION_MATCHER = new MethodMatcher("com.launchdarkly.sdk.server.LDClient boolVariation(String, com.launchdarkly.sdk.*, boolean)", true); diff --git a/src/main/java/org/openrewrite/featureflags/launchdarkly/package-info.java b/src/main/java/org/openrewrite/featureflags/launchdarkly/package-info.java index 94b620d..010a24e 100644 --- a/src/main/java/org/openrewrite/featureflags/launchdarkly/package-info.java +++ b/src/main/java/org/openrewrite/featureflags/launchdarkly/package-info.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -@NonNullApi +@NullMarked @NonNullFields package org.openrewrite.featureflags.launchdarkly; -import org.openrewrite.internal.lang.NonNullApi; +import org.jspecify.annotations.NullMarked; import org.openrewrite.internal.lang.NonNullFields; diff --git a/src/main/java/org/openrewrite/featureflags/launchdarkly/search/FindFeatureFlag.java b/src/main/java/org/openrewrite/featureflags/launchdarkly/search/FindFeatureFlag.java index f0ef0c9..80c1d1c 100644 --- a/src/main/java/org/openrewrite/featureflags/launchdarkly/search/FindFeatureFlag.java +++ b/src/main/java/org/openrewrite/featureflags/launchdarkly/search/FindFeatureFlag.java @@ -17,6 +17,7 @@ import lombok.EqualsAndHashCode; import lombok.Value; +import org.jspecify.annotations.Nullable; import org.openrewrite.*; import org.openrewrite.analysis.InvocationMatcher; import org.openrewrite.analysis.constantfold.ConstantFold; @@ -24,7 +25,6 @@ import org.openrewrite.analysis.dataflow.DataFlowSpec; import org.openrewrite.analysis.dataflow.Dataflow; import org.openrewrite.internal.StringUtils; -import org.openrewrite.internal.lang.Nullable; import org.openrewrite.java.JavaIsoVisitor; import org.openrewrite.java.MethodMatcher; import org.openrewrite.java.search.UsesMethod; diff --git a/src/main/java/org/openrewrite/featureflags/launchdarkly/search/package-info.java b/src/main/java/org/openrewrite/featureflags/launchdarkly/search/package-info.java index 08c2a07..257dba6 100644 --- a/src/main/java/org/openrewrite/featureflags/launchdarkly/search/package-info.java +++ b/src/main/java/org/openrewrite/featureflags/launchdarkly/search/package-info.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -@NonNullApi +@NullMarked @NonNullFields package org.openrewrite.featureflags.launchdarkly.search; -import org.openrewrite.internal.lang.NonNullApi; +import org.jspecify.annotations.NullMarked; import org.openrewrite.internal.lang.NonNullFields; diff --git a/src/main/java/org/openrewrite/featureflags/openfeature/package-info.java b/src/main/java/org/openrewrite/featureflags/openfeature/package-info.java index 9095013..7937c25 100644 --- a/src/main/java/org/openrewrite/featureflags/openfeature/package-info.java +++ b/src/main/java/org/openrewrite/featureflags/openfeature/package-info.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -@NonNullApi +@NullMarked @NonNullFields package org.openrewrite.featureflags.openfeature; -import org.openrewrite.internal.lang.NonNullApi; +import org.jspecify.annotations.NullMarked; import org.openrewrite.internal.lang.NonNullFields; diff --git a/src/main/java/org/openrewrite/featureflags/openfeature/search/FindFeatureFlag.java b/src/main/java/org/openrewrite/featureflags/openfeature/search/FindFeatureFlag.java index 2b20714..7160804 100644 --- a/src/main/java/org/openrewrite/featureflags/openfeature/search/FindFeatureFlag.java +++ b/src/main/java/org/openrewrite/featureflags/openfeature/search/FindFeatureFlag.java @@ -17,9 +17,9 @@ import lombok.EqualsAndHashCode; import lombok.Value; +import org.jspecify.annotations.Nullable; import org.openrewrite.Option; import org.openrewrite.Recipe; -import org.openrewrite.internal.lang.Nullable; import java.util.Collections; import java.util.List; diff --git a/src/main/java/org/openrewrite/featureflags/openfeature/search/package-info.java b/src/main/java/org/openrewrite/featureflags/openfeature/search/package-info.java index 889fd7c..08afd46 100644 --- a/src/main/java/org/openrewrite/featureflags/openfeature/search/package-info.java +++ b/src/main/java/org/openrewrite/featureflags/openfeature/search/package-info.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -@NonNullApi +@NullMarked @NonNullFields package org.openrewrite.featureflags.openfeature.search; -import org.openrewrite.internal.lang.NonNullApi; +import org.jspecify.annotations.NullMarked; import org.openrewrite.internal.lang.NonNullFields; diff --git a/src/main/java/org/openrewrite/featureflags/package-info.java b/src/main/java/org/openrewrite/featureflags/package-info.java index 6ad96c3..a8b4c11 100644 --- a/src/main/java/org/openrewrite/featureflags/package-info.java +++ b/src/main/java/org/openrewrite/featureflags/package-info.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -@NonNullApi +@NullMarked @NonNullFields package org.openrewrite.featureflags; -import org.openrewrite.internal.lang.NonNullApi; +import org.jspecify.annotations.NullMarked; import org.openrewrite.internal.lang.NonNullFields; diff --git a/src/main/java/org/openrewrite/featureflags/search/FindFeatureFlag.java b/src/main/java/org/openrewrite/featureflags/search/FindFeatureFlag.java index 91e7dce..0c9911f 100644 --- a/src/main/java/org/openrewrite/featureflags/search/FindFeatureFlag.java +++ b/src/main/java/org/openrewrite/featureflags/search/FindFeatureFlag.java @@ -17,6 +17,7 @@ import lombok.EqualsAndHashCode; import lombok.Value; +import org.jspecify.annotations.Nullable; import org.openrewrite.*; import org.openrewrite.analysis.InvocationMatcher; import org.openrewrite.analysis.constantfold.ConstantFold; @@ -24,7 +25,6 @@ import org.openrewrite.analysis.dataflow.DataFlowSpec; import org.openrewrite.analysis.dataflow.Dataflow; import org.openrewrite.internal.StringUtils; -import org.openrewrite.internal.lang.Nullable; import org.openrewrite.java.JavaIsoVisitor; import org.openrewrite.java.MethodMatcher; import org.openrewrite.java.search.UsesMethod; diff --git a/src/main/java/org/openrewrite/featureflags/search/package-info.java b/src/main/java/org/openrewrite/featureflags/search/package-info.java index 45ac455..52c2d2a 100644 --- a/src/main/java/org/openrewrite/featureflags/search/package-info.java +++ b/src/main/java/org/openrewrite/featureflags/search/package-info.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -@NonNullApi +@NullMarked @NonNullFields package org.openrewrite.featureflags.search; -import org.openrewrite.internal.lang.NonNullApi; +import org.jspecify.annotations.NullMarked; import org.openrewrite.internal.lang.NonNullFields; diff --git a/src/main/java/org/openrewrite/featureflags/unleash/package-info.java b/src/main/java/org/openrewrite/featureflags/unleash/package-info.java index 4e6fb09..7a5207a 100644 --- a/src/main/java/org/openrewrite/featureflags/unleash/package-info.java +++ b/src/main/java/org/openrewrite/featureflags/unleash/package-info.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -@NonNullApi +@NullMarked @NonNullFields package org.openrewrite.featureflags.unleash; -import org.openrewrite.internal.lang.NonNullApi; +import org.jspecify.annotations.NullMarked; import org.openrewrite.internal.lang.NonNullFields; diff --git a/src/main/java/org/openrewrite/featureflags/unleash/search/FindFeatureFlag.java b/src/main/java/org/openrewrite/featureflags/unleash/search/FindFeatureFlag.java index d58b3bb..90e003b 100644 --- a/src/main/java/org/openrewrite/featureflags/unleash/search/FindFeatureFlag.java +++ b/src/main/java/org/openrewrite/featureflags/unleash/search/FindFeatureFlag.java @@ -17,9 +17,9 @@ import lombok.EqualsAndHashCode; import lombok.Value; +import org.jspecify.annotations.Nullable; import org.openrewrite.Option; import org.openrewrite.Recipe; -import org.openrewrite.internal.lang.Nullable; import java.util.Collections; import java.util.List; diff --git a/src/main/java/org/openrewrite/featureflags/unleash/search/package-info.java b/src/main/java/org/openrewrite/featureflags/unleash/search/package-info.java index 8e1ac2f..e1a89a7 100644 --- a/src/main/java/org/openrewrite/featureflags/unleash/search/package-info.java +++ b/src/main/java/org/openrewrite/featureflags/unleash/search/package-info.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -@NonNullApi +@NullMarked @NonNullFields package org.openrewrite.featureflags.unleash.search; -import org.openrewrite.internal.lang.NonNullApi; +import org.jspecify.annotations.NullMarked; import org.openrewrite.internal.lang.NonNullFields;