From 2cbc367fd216feb3f2f7352c0e7eee6d5e629e88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Schn=C3=A9ider?= Date: Thu, 15 Aug 2024 00:38:24 -0400 Subject: [PATCH] Migrate to JSpecify from OpenRewrite JSR-305 meta-annotations (#110) Use this link to re-run the recipe: https://app.moderne.io/builder/gW3xaSLWV?organizationId=T3BlblJld3JpdGU%3D Co-authored-by: Moderne --- .../openrewrite/javascript/Assertions.java | 2 +- .../javascript/JavaScriptParser.java | 2 +- .../javascript/JavaScriptVisitor.java | 2 +- .../TypeScriptSignatureBuilder.java | 2 +- .../javascript/TypeScriptTypeMapping.java | 20 +++++++------- .../javascript/cleanup/package-info.java | 4 +-- .../openrewrite/javascript/format/Spaces.java | 2 +- .../javascript/format/package-info.java | 4 +-- .../internal/JavaScriptPrinter.java | 6 ++--- .../internal/JavaScriptTypeCache.java | 2 +- .../internal/JavetNativeBridge.java | 2 +- .../javascript/internal/JavetUtils.java | 2 +- .../javascript/internal/TsTreePrinter.java | 2 +- .../internal/TypeScriptParserVisitor.java | 8 +++--- .../javascript/internal/package-info.java | 4 +-- .../internal/tsc/TSCConversion.java | 2 +- .../javascript/internal/tsc/TSCGlobals.java | 2 +- .../internal/tsc/TSCInstanceOfChecks.java | 2 +- .../javascript/internal/tsc/TSCNode.java | 2 +- .../internal/tsc/TSCProgramContext.java | 6 ++--- .../javascript/internal/tsc/TSCRuntime.java | 2 +- .../javascript/internal/tsc/TSCSymbol.java | 2 +- .../internal/tsc/TSCSyntaxListNode.java | 4 +-- .../internal/tsc/TSCTypeAccessors.java | 4 +-- .../internal/tsc/TSCTypeChecker.java | 2 +- .../javascript/internal/tsc/TSCV8Backed.java | 4 +-- .../javascript/internal/tsc/package-info.java | 4 +-- .../openrewrite/javascript/package-info.java | 4 +-- .../search/FindJavaScriptSources.java | 2 +- .../javascript/search/package-info.java | 4 +-- .../service/JavaScriptImportService.java | 2 +- .../javascript/service/package-info.java | 4 +-- .../javascript/style/package-info.java | 4 +-- .../javascript/table/package-info.java | 4 +-- .../org/openrewrite/javascript/tree/JS.java | 26 +++++++++---------- .../javascript/tree/package-info.java | 4 +-- .../javascript/recipe/package-info.java | 4 +-- 37 files changed, 78 insertions(+), 80 deletions(-) diff --git a/src/main/java/org/openrewrite/javascript/Assertions.java b/src/main/java/org/openrewrite/javascript/Assertions.java index fecd7a1a..2dc03bb9 100644 --- a/src/main/java/org/openrewrite/javascript/Assertions.java +++ b/src/main/java/org/openrewrite/javascript/Assertions.java @@ -17,9 +17,9 @@ import org.intellij.lang.annotations.Language; +import org.jspecify.annotations.Nullable; import org.openrewrite.ExecutionContext; import org.openrewrite.ParseExceptionResult; -import org.openrewrite.internal.lang.Nullable; import org.openrewrite.java.tree.J; import org.openrewrite.java.tree.Space; import org.openrewrite.javascript.tree.JS; diff --git a/src/main/java/org/openrewrite/javascript/JavaScriptParser.java b/src/main/java/org/openrewrite/javascript/JavaScriptParser.java index a7e5c102..9023f58c 100644 --- a/src/main/java/org/openrewrite/javascript/JavaScriptParser.java +++ b/src/main/java/org/openrewrite/javascript/JavaScriptParser.java @@ -16,12 +16,12 @@ package org.openrewrite.javascript; import lombok.Value; +import org.jspecify.annotations.Nullable; import org.openrewrite.ExecutionContext; import org.openrewrite.InMemoryExecutionContext; import org.openrewrite.Parser; import org.openrewrite.SourceFile; import org.openrewrite.internal.EncodingDetectingInputStream; -import org.openrewrite.internal.lang.Nullable; import org.openrewrite.java.internal.JavaTypeCache; import org.openrewrite.javascript.internal.JavetNativeBridge; import org.openrewrite.javascript.internal.TypeScriptParserVisitor; diff --git a/src/main/java/org/openrewrite/javascript/JavaScriptVisitor.java b/src/main/java/org/openrewrite/javascript/JavaScriptVisitor.java index 42c4cf5d..0e9ba682 100644 --- a/src/main/java/org/openrewrite/javascript/JavaScriptVisitor.java +++ b/src/main/java/org/openrewrite/javascript/JavaScriptVisitor.java @@ -15,9 +15,9 @@ */ package org.openrewrite.javascript; +import org.jspecify.annotations.Nullable; import org.openrewrite.SourceFile; import org.openrewrite.internal.ListUtils; -import org.openrewrite.internal.lang.Nullable; import org.openrewrite.java.JavaVisitor; import org.openrewrite.java.tree.*; import org.openrewrite.javascript.tree.*; diff --git a/src/main/java/org/openrewrite/javascript/TypeScriptSignatureBuilder.java b/src/main/java/org/openrewrite/javascript/TypeScriptSignatureBuilder.java index 1613bcaf..0d96e7d5 100644 --- a/src/main/java/org/openrewrite/javascript/TypeScriptSignatureBuilder.java +++ b/src/main/java/org/openrewrite/javascript/TypeScriptSignatureBuilder.java @@ -15,8 +15,8 @@ */ package org.openrewrite.javascript; +import org.jspecify.annotations.Nullable; import org.openrewrite.Incubating; -import org.openrewrite.internal.lang.Nullable; import org.openrewrite.java.JavaTypeSignatureBuilder; import org.openrewrite.java.tree.JavaType; import org.openrewrite.javascript.internal.tsc.TSCNode; diff --git a/src/main/java/org/openrewrite/javascript/TypeScriptTypeMapping.java b/src/main/java/org/openrewrite/javascript/TypeScriptTypeMapping.java index 5ea0619c..b86837d4 100644 --- a/src/main/java/org/openrewrite/javascript/TypeScriptTypeMapping.java +++ b/src/main/java/org/openrewrite/javascript/TypeScriptTypeMapping.java @@ -15,8 +15,8 @@ */ package org.openrewrite.javascript; +import org.jspecify.annotations.Nullable; import org.openrewrite.Incubating; -import org.openrewrite.internal.lang.Nullable; import org.openrewrite.java.JavaTypeMapping; import org.openrewrite.java.internal.JavaTypeCache; import org.openrewrite.java.tree.Flag; @@ -107,11 +107,11 @@ private JavaType array(TSCNode node, String signature) { return arr; } - private @Nullable JavaType.FullyQualified classType(@Nullable TSCNode node) { + private JavaType.@Nullable FullyQualified classType(@Nullable TSCNode node) { return classType(node, signatureBuilder.signature(node)); } - private @Nullable JavaType.FullyQualified classType(@Nullable TSCNode node, String signature) { + private JavaType.@Nullable FullyQualified classType(@Nullable TSCNode node, String signature) { if (node == null || node.syntaxKind() != TSCSyntaxKind.SourceFile && node.getTypeForNode() == null) { return null; } @@ -279,11 +279,11 @@ public JavaType.GenericTypeVariable generic(TSCNode node, String signature) { return gtv; } - public @Nullable JavaType.Method methodDeclarationType(TSCNode node) { + public JavaType.@Nullable Method methodDeclarationType(TSCNode node) { return methodDeclarationType(node, null); } - public @Nullable JavaType.Method methodDeclarationType(TSCNode node, @Nullable JavaType.FullyQualified declaringType) { + public JavaType.@Nullable Method methodDeclarationType(TSCNode node, JavaType.@Nullable FullyQualified declaringType) { String signature = signatureBuilder.methodSignature(node); JavaType.Method existing = typeCache.get(signature); @@ -343,7 +343,7 @@ public JavaType.GenericTypeVariable generic(TSCNode node, String signature) { return method; } - public @Nullable JavaType.Method methodInvocationType(TSCNode node) { + public JavaType.@Nullable Method methodInvocationType(TSCNode node) { String signature = signatureBuilder.methodSignature(node); JavaType.Method existing = typeCache.get(signature); if (existing != null) { @@ -430,19 +430,19 @@ public JavaType.Primitive primitive(TSCNode node) { return JavaType.Primitive.None; } - public @Nullable JavaType.Variable variableType(TSCNode node) { + public JavaType.@Nullable Variable variableType(TSCNode node) { return variableType(node, null, signatureBuilder.variableSignature(node)); } - public @Nullable JavaType.Variable variableType(TSCNode node, String signature) { + public JavaType.@Nullable Variable variableType(TSCNode node, String signature) { return variableType(node, null, signature); } - public @Nullable JavaType.Variable variableType(TSCNode node, @Nullable JavaType.FullyQualified declaringType) { + public JavaType.@Nullable Variable variableType(TSCNode node, JavaType.@Nullable FullyQualified declaringType) { return variableType(node, declaringType, signatureBuilder.variableSignature(node)); } - public @Nullable JavaType.Variable variableType(TSCNode node, @Nullable JavaType.FullyQualified declaringType, String signature) { + public JavaType.@Nullable Variable variableType(TSCNode node, JavaType.@Nullable FullyQualified declaringType, String signature) { JavaType.Variable existing = typeCache.get(signature); if (existing != null) { return existing; diff --git a/src/main/java/org/openrewrite/javascript/cleanup/package-info.java b/src/main/java/org/openrewrite/javascript/cleanup/package-info.java index add10345..17e678cf 100644 --- a/src/main/java/org/openrewrite/javascript/cleanup/package-info.java +++ b/src/main/java/org/openrewrite/javascript/cleanup/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.javascript.cleanup; -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/javascript/format/Spaces.java b/src/main/java/org/openrewrite/javascript/format/Spaces.java index 528ff37e..cd2a9806 100644 --- a/src/main/java/org/openrewrite/javascript/format/Spaces.java +++ b/src/main/java/org/openrewrite/javascript/format/Spaces.java @@ -15,8 +15,8 @@ */ package org.openrewrite.javascript.format; +import org.jspecify.annotations.Nullable; import org.openrewrite.*; -import org.openrewrite.internal.lang.Nullable; import org.openrewrite.java.tree.J; import org.openrewrite.javascript.JavaScriptIsoVisitor; import org.openrewrite.javascript.style.IntelliJ; diff --git a/src/main/java/org/openrewrite/javascript/format/package-info.java b/src/main/java/org/openrewrite/javascript/format/package-info.java index 29505110..dffde326 100644 --- a/src/main/java/org/openrewrite/javascript/format/package-info.java +++ b/src/main/java/org/openrewrite/javascript/format/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.javascript.format; -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/javascript/internal/JavaScriptPrinter.java b/src/main/java/org/openrewrite/javascript/internal/JavaScriptPrinter.java index 7dee0c88..ea5ea91e 100644 --- a/src/main/java/org/openrewrite/javascript/internal/JavaScriptPrinter.java +++ b/src/main/java/org/openrewrite/javascript/internal/JavaScriptPrinter.java @@ -15,10 +15,10 @@ */ package org.openrewrite.javascript.internal; +import org.jspecify.annotations.Nullable; import org.openrewrite.Cursor; import org.openrewrite.PrintOutputCapture; import org.openrewrite.Tree; -import org.openrewrite.internal.lang.Nullable; import org.openrewrite.java.JavaPrinter; import org.openrewrite.java.marker.OmitParentheses; import org.openrewrite.java.marker.Semicolon; @@ -758,7 +758,7 @@ protected void beforeSyntax(J j, JsSpace.Location loc, PrintOutputCapture

p) beforeSyntax(j.getPrefix(), j.getMarkers(), loc, p); } - private void beforeSyntax(Space prefix, Markers markers, @Nullable JsSpace.Location loc, PrintOutputCapture

p) { + private void beforeSyntax(Space prefix, Markers markers, JsSpace.@Nullable Location loc, PrintOutputCapture

p) { for (Marker marker : markers.getMarkers()) { p.append(p.getMarkerPrinter().beforePrefix(marker, new Cursor(getCursor(), marker), JAVA_SCRIPT_MARKER_WRAPPER)); } @@ -775,7 +775,7 @@ protected void beforeSyntax(J j, Space.Location loc, PrintOutputCapture

p) { beforeSyntax(j.getPrefix(), j.getMarkers(), loc, p); } - protected void beforeSyntax(Space prefix, Markers markers, @Nullable Space.Location loc, PrintOutputCapture

p) { + protected void beforeSyntax(Space prefix, Markers markers, Space.@Nullable Location loc, PrintOutputCapture

p) { for (Marker marker : markers.getMarkers()) { p.out.append(p.getMarkerPrinter().beforePrefix(marker, new Cursor(getCursor(), marker), JAVA_SCRIPT_MARKER_WRAPPER)); } diff --git a/src/main/java/org/openrewrite/javascript/internal/JavaScriptTypeCache.java b/src/main/java/org/openrewrite/javascript/internal/JavaScriptTypeCache.java index a0c5f487..511a062b 100644 --- a/src/main/java/org/openrewrite/javascript/internal/JavaScriptTypeCache.java +++ b/src/main/java/org/openrewrite/javascript/internal/JavaScriptTypeCache.java @@ -15,7 +15,7 @@ */ package org.openrewrite.javascript.internal; -import org.openrewrite.internal.lang.Nullable; +import org.jspecify.annotations.Nullable; import java.util.HashMap; import java.util.Map; diff --git a/src/main/java/org/openrewrite/javascript/internal/JavetNativeBridge.java b/src/main/java/org/openrewrite/javascript/internal/JavetNativeBridge.java index f61446bc..63c85fc9 100644 --- a/src/main/java/org/openrewrite/javascript/internal/JavetNativeBridge.java +++ b/src/main/java/org/openrewrite/javascript/internal/JavetNativeBridge.java @@ -19,8 +19,8 @@ import com.caoccao.javet.exceptions.JavetException; import com.caoccao.javet.interop.loader.JavetLibLoader; import com.caoccao.javet.utils.JavetOSUtils; +import org.jspecify.annotations.Nullable; import org.openrewrite.internal.StringUtils; -import org.openrewrite.internal.lang.Nullable; import java.io.File; import java.io.FileOutputStream; diff --git a/src/main/java/org/openrewrite/javascript/internal/JavetUtils.java b/src/main/java/org/openrewrite/javascript/internal/JavetUtils.java index e07ffc96..6f8a54db 100644 --- a/src/main/java/org/openrewrite/javascript/internal/JavetUtils.java +++ b/src/main/java/org/openrewrite/javascript/internal/JavetUtils.java @@ -16,7 +16,7 @@ package org.openrewrite.javascript.internal; import com.caoccao.javet.values.IV8Value; -import org.openrewrite.internal.lang.Nullable; +import org.jspecify.annotations.Nullable; public class JavetUtils { private JavetUtils() {} diff --git a/src/main/java/org/openrewrite/javascript/internal/TsTreePrinter.java b/src/main/java/org/openrewrite/javascript/internal/TsTreePrinter.java index 1e334703..ff55d5ea 100644 --- a/src/main/java/org/openrewrite/javascript/internal/TsTreePrinter.java +++ b/src/main/java/org/openrewrite/javascript/internal/TsTreePrinter.java @@ -17,8 +17,8 @@ import lombok.AllArgsConstructor; import lombok.Data; +import org.jspecify.annotations.Nullable; import org.openrewrite.*; -import org.openrewrite.internal.lang.Nullable; import org.openrewrite.java.tree.*; import org.openrewrite.javascript.internal.tsc.TSCNode; import org.openrewrite.javascript.internal.tsc.TSCSourceFileContext; diff --git a/src/main/java/org/openrewrite/javascript/internal/TypeScriptParserVisitor.java b/src/main/java/org/openrewrite/javascript/internal/TypeScriptParserVisitor.java index f25987ac..97c174ae 100644 --- a/src/main/java/org/openrewrite/javascript/internal/TypeScriptParserVisitor.java +++ b/src/main/java/org/openrewrite/javascript/internal/TypeScriptParserVisitor.java @@ -15,9 +15,9 @@ */ package org.openrewrite.javascript.internal; +import org.jspecify.annotations.Nullable; import org.openrewrite.FileAttributes; import org.openrewrite.ParseExceptionResult; -import org.openrewrite.internal.lang.Nullable; import org.openrewrite.java.internal.JavaTypeCache; import org.openrewrite.java.marker.Semicolon; import org.openrewrite.java.marker.TrailingComma; @@ -486,7 +486,7 @@ private void visitBinaryUpdateExpression(TSCNode incrementor, List mapModifiers(@Nullable List nodes, List() : modifiers; } - private @Nullable J.TypeParameters mapTypeParameters(@Nullable List typeParameters) { + private J.@Nullable TypeParameters mapTypeParameters(@Nullable List typeParameters) { return typeParameters == null ? null : new J.TypeParameters(randomId(), sourceBefore(TSCSyntaxKind.LessThanToken), Markers.EMPTY, emptyList(), convertAll(typeParameters, commaDelim, t -> sourceBefore(TSCSyntaxKind.GreaterThanToken))); diff --git a/src/main/java/org/openrewrite/javascript/internal/package-info.java b/src/main/java/org/openrewrite/javascript/internal/package-info.java index 435c64f2..4e0e3159 100644 --- a/src/main/java/org/openrewrite/javascript/internal/package-info.java +++ b/src/main/java/org/openrewrite/javascript/internal/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.javascript.internal; -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/javascript/internal/tsc/TSCConversion.java b/src/main/java/org/openrewrite/javascript/internal/tsc/TSCConversion.java index ddc7f0d4..b36a498f 100644 --- a/src/main/java/org/openrewrite/javascript/internal/tsc/TSCConversion.java +++ b/src/main/java/org/openrewrite/javascript/internal/tsc/TSCConversion.java @@ -17,7 +17,7 @@ import com.caoccao.javet.exceptions.JavetException; import com.caoccao.javet.values.V8Value; -import org.openrewrite.internal.lang.Nullable; +import org.jspecify.annotations.Nullable; public interface TSCConversion { T convertUnsafe(TSCProgramContext context, V8Value value) throws JavetException; diff --git a/src/main/java/org/openrewrite/javascript/internal/tsc/TSCGlobals.java b/src/main/java/org/openrewrite/javascript/internal/tsc/TSCGlobals.java index fa413098..f089f7ef 100644 --- a/src/main/java/org/openrewrite/javascript/internal/tsc/TSCGlobals.java +++ b/src/main/java/org/openrewrite/javascript/internal/tsc/TSCGlobals.java @@ -17,7 +17,7 @@ import com.caoccao.javet.exceptions.JavetException; import com.caoccao.javet.values.reference.V8ValueObject; -import org.openrewrite.internal.lang.Nullable; +import org.jspecify.annotations.Nullable; import java.util.List; import java.util.function.Supplier; diff --git a/src/main/java/org/openrewrite/javascript/internal/tsc/TSCInstanceOfChecks.java b/src/main/java/org/openrewrite/javascript/internal/tsc/TSCInstanceOfChecks.java index 61b4f77f..eff2438e 100644 --- a/src/main/java/org/openrewrite/javascript/internal/tsc/TSCInstanceOfChecks.java +++ b/src/main/java/org/openrewrite/javascript/internal/tsc/TSCInstanceOfChecks.java @@ -23,7 +23,7 @@ import com.caoccao.javet.values.reference.V8ValueFunction; import com.caoccao.javet.values.reference.V8ValueObject; import org.intellij.lang.annotations.Language; -import org.openrewrite.internal.lang.Nullable; +import org.jspecify.annotations.Nullable; public class TSCInstanceOfChecks extends TSCV8ValueHolder { diff --git a/src/main/java/org/openrewrite/javascript/internal/tsc/TSCNode.java b/src/main/java/org/openrewrite/javascript/internal/tsc/TSCNode.java index e23b25fe..a86fa2e3 100644 --- a/src/main/java/org/openrewrite/javascript/internal/tsc/TSCNode.java +++ b/src/main/java/org/openrewrite/javascript/internal/tsc/TSCNode.java @@ -19,8 +19,8 @@ import com.caoccao.javet.values.V8Value; import com.caoccao.javet.values.reference.V8ValueArray; import com.caoccao.javet.values.reference.V8ValueObject; +import org.jspecify.annotations.Nullable; import org.openrewrite.DebugOnly; -import org.openrewrite.internal.lang.Nullable; import org.openrewrite.javascript.internal.tsc.generated.TSCSyntaxKind; import java.io.PrintStream; diff --git a/src/main/java/org/openrewrite/javascript/internal/tsc/TSCProgramContext.java b/src/main/java/org/openrewrite/javascript/internal/tsc/TSCProgramContext.java index f747eb4c..0f8a2f11 100644 --- a/src/main/java/org/openrewrite/javascript/internal/tsc/TSCProgramContext.java +++ b/src/main/java/org/openrewrite/javascript/internal/tsc/TSCProgramContext.java @@ -21,7 +21,7 @@ import com.caoccao.javet.values.reference.V8ValueObject; import lombok.Getter; import lombok.Value; -import org.openrewrite.internal.lang.Nullable; +import org.jspecify.annotations.Nullable; import java.nio.file.Path; import java.nio.file.Paths; @@ -109,11 +109,11 @@ public TSCGlobals getTypeScriptGlobals() { return this.typescriptGlobals; } - public @Nullable TSCInstanceOfChecks.InterfaceKind identifyInterfaceKind(V8Value valueV8) { + public TSCInstanceOfChecks.@Nullable InterfaceKind identifyInterfaceKind(V8Value valueV8) { return this.getInstanceOfChecks().identifyInterfaceKind(valueV8); } - public @Nullable TSCInstanceOfChecks.ConstructorKind identifyConstructorKind(V8Value valueV8) { + public TSCInstanceOfChecks.@Nullable ConstructorKind identifyConstructorKind(V8Value valueV8) { return this.getInstanceOfChecks().identifyConstructorKind(valueV8); } diff --git a/src/main/java/org/openrewrite/javascript/internal/tsc/TSCRuntime.java b/src/main/java/org/openrewrite/javascript/internal/tsc/TSCRuntime.java index 5a35e5ca..92711e22 100644 --- a/src/main/java/org/openrewrite/javascript/internal/tsc/TSCRuntime.java +++ b/src/main/java/org/openrewrite/javascript/internal/tsc/TSCRuntime.java @@ -26,8 +26,8 @@ import com.caoccao.javet.values.reference.V8ValueMap; import com.caoccao.javet.values.reference.V8ValueObject; import org.intellij.lang.annotations.Language; +import org.jspecify.annotations.Nullable; import org.openrewrite.DebugOnly; -import org.openrewrite.internal.lang.Nullable; import org.openrewrite.javascript.internal.JavetUtils; import java.io.IOException; diff --git a/src/main/java/org/openrewrite/javascript/internal/tsc/TSCSymbol.java b/src/main/java/org/openrewrite/javascript/internal/tsc/TSCSymbol.java index 66322b22..e927c9bd 100644 --- a/src/main/java/org/openrewrite/javascript/internal/tsc/TSCSymbol.java +++ b/src/main/java/org/openrewrite/javascript/internal/tsc/TSCSymbol.java @@ -18,7 +18,7 @@ import com.caoccao.javet.exceptions.JavetException; import com.caoccao.javet.values.reference.V8ValueObject; import lombok.Value; -import org.openrewrite.internal.lang.Nullable; +import org.jspecify.annotations.Nullable; import org.openrewrite.javascript.internal.tsc.generated.TSCSymbolFlag; import java.util.ArrayList; diff --git a/src/main/java/org/openrewrite/javascript/internal/tsc/TSCSyntaxListNode.java b/src/main/java/org/openrewrite/javascript/internal/tsc/TSCSyntaxListNode.java index f40c2d21..b80ebf43 100644 --- a/src/main/java/org/openrewrite/javascript/internal/tsc/TSCSyntaxListNode.java +++ b/src/main/java/org/openrewrite/javascript/internal/tsc/TSCSyntaxListNode.java @@ -16,8 +16,8 @@ package org.openrewrite.javascript.internal.tsc; import com.caoccao.javet.values.reference.V8ValueObject; -import org.openrewrite.internal.lang.NonNull; -import org.openrewrite.internal.lang.Nullable; +import org.jspecify.annotations.NonNull; +import org.jspecify.annotations.Nullable; import java.util.*; diff --git a/src/main/java/org/openrewrite/javascript/internal/tsc/TSCTypeAccessors.java b/src/main/java/org/openrewrite/javascript/internal/tsc/TSCTypeAccessors.java index de7dc462..c9be06c7 100644 --- a/src/main/java/org/openrewrite/javascript/internal/tsc/TSCTypeAccessors.java +++ b/src/main/java/org/openrewrite/javascript/internal/tsc/TSCTypeAccessors.java @@ -15,8 +15,8 @@ */ package org.openrewrite.javascript.internal.tsc; +import org.jspecify.annotations.Nullable; import org.openrewrite.DebugOnly; -import org.openrewrite.internal.lang.Nullable; import org.openrewrite.javascript.internal.tsc.generated.TSCObjectFlag; import org.openrewrite.javascript.internal.tsc.generated.TSCTypeFlag; @@ -312,7 +312,7 @@ default TSCType getTarget() { return getTypeProperty("target"); } - default @Nullable TSCNode.TypeNode getNode() { + default TSCNode.@Nullable TypeNode getNode() { return getOptionalTypeNodeProperty("node"); } diff --git a/src/main/java/org/openrewrite/javascript/internal/tsc/TSCTypeChecker.java b/src/main/java/org/openrewrite/javascript/internal/tsc/TSCTypeChecker.java index 9cbfb2f5..0e0ac345 100644 --- a/src/main/java/org/openrewrite/javascript/internal/tsc/TSCTypeChecker.java +++ b/src/main/java/org/openrewrite/javascript/internal/tsc/TSCTypeChecker.java @@ -16,7 +16,7 @@ package org.openrewrite.javascript.internal.tsc; import com.caoccao.javet.values.reference.V8ValueObject; -import org.openrewrite.internal.lang.Nullable; +import org.jspecify.annotations.Nullable; import org.openrewrite.javascript.internal.tsc.generated.TSCIndexKind; import org.openrewrite.javascript.internal.tsc.generated.TSCSignatureKind; import org.openrewrite.javascript.internal.tsc.generated.TSCSymbolFlag; diff --git a/src/main/java/org/openrewrite/javascript/internal/tsc/TSCV8Backed.java b/src/main/java/org/openrewrite/javascript/internal/tsc/TSCV8Backed.java index 9b9d2e2e..4ac965e2 100644 --- a/src/main/java/org/openrewrite/javascript/internal/tsc/TSCV8Backed.java +++ b/src/main/java/org/openrewrite/javascript/internal/tsc/TSCV8Backed.java @@ -22,8 +22,8 @@ import com.caoccao.javet.values.reference.V8ValueFunction; import com.caoccao.javet.values.reference.V8ValueObject; import lombok.Value; +import org.jspecify.annotations.Nullable; import org.openrewrite.DebugOnly; -import org.openrewrite.internal.lang.Nullable; import org.openrewrite.javascript.internal.tsc.generated.TSCSyntaxKind; import java.util.ArrayList; @@ -228,7 +228,7 @@ default TSCNode.TypeNode getTypeNodeProperty(String name) { return getPropertyNonNull(name, TYPE_NODE); } - default @Nullable TSCNode.TypeNode getOptionalTypeNodeProperty(String name) { + default TSCNode.@Nullable TypeNode getOptionalTypeNodeProperty(String name) { return getPropertyNullable(name, TYPE_NODE); } diff --git a/src/main/java/org/openrewrite/javascript/internal/tsc/package-info.java b/src/main/java/org/openrewrite/javascript/internal/tsc/package-info.java index e15461a2..1e3669d3 100644 --- a/src/main/java/org/openrewrite/javascript/internal/tsc/package-info.java +++ b/src/main/java/org/openrewrite/javascript/internal/tsc/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.javascript.internal.tsc; -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/javascript/package-info.java b/src/main/java/org/openrewrite/javascript/package-info.java index f6492d52..d4087c72 100644 --- a/src/main/java/org/openrewrite/javascript/package-info.java +++ b/src/main/java/org/openrewrite/javascript/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.javascript; -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/javascript/search/FindJavaScriptSources.java b/src/main/java/org/openrewrite/javascript/search/FindJavaScriptSources.java index 47dfea61..0eb15828 100644 --- a/src/main/java/org/openrewrite/javascript/search/FindJavaScriptSources.java +++ b/src/main/java/org/openrewrite/javascript/search/FindJavaScriptSources.java @@ -17,8 +17,8 @@ import lombok.EqualsAndHashCode; import lombok.Value; +import org.jspecify.annotations.Nullable; import org.openrewrite.*; -import org.openrewrite.internal.lang.Nullable; import org.openrewrite.javascript.table.JavaScriptSourceFile; import org.openrewrite.marker.SearchResult; import org.openrewrite.quark.Quark; diff --git a/src/main/java/org/openrewrite/javascript/search/package-info.java b/src/main/java/org/openrewrite/javascript/search/package-info.java index 85d5eb36..f7230433 100644 --- a/src/main/java/org/openrewrite/javascript/search/package-info.java +++ b/src/main/java/org/openrewrite/javascript/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.javascript.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/javascript/service/JavaScriptImportService.java b/src/main/java/org/openrewrite/javascript/service/JavaScriptImportService.java index 8827cebe..1ce397f1 100644 --- a/src/main/java/org/openrewrite/javascript/service/JavaScriptImportService.java +++ b/src/main/java/org/openrewrite/javascript/service/JavaScriptImportService.java @@ -15,10 +15,10 @@ */ package org.openrewrite.javascript.service; +import org.jspecify.annotations.Nullable; import org.openrewrite.Cursor; import org.openrewrite.ExecutionContext; import org.openrewrite.Tree; -import org.openrewrite.internal.lang.Nullable; import org.openrewrite.java.JavaVisitor; import org.openrewrite.java.service.ImportService; import org.openrewrite.java.tree.J; diff --git a/src/main/java/org/openrewrite/javascript/service/package-info.java b/src/main/java/org/openrewrite/javascript/service/package-info.java index 1604f861..1e6b351c 100644 --- a/src/main/java/org/openrewrite/javascript/service/package-info.java +++ b/src/main/java/org/openrewrite/javascript/service/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.javascript.service; -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/javascript/style/package-info.java b/src/main/java/org/openrewrite/javascript/style/package-info.java index 42b26954..509ee2a6 100644 --- a/src/main/java/org/openrewrite/javascript/style/package-info.java +++ b/src/main/java/org/openrewrite/javascript/style/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.javascript.style; -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/javascript/table/package-info.java b/src/main/java/org/openrewrite/javascript/table/package-info.java index 8c4f1e76..3acb3fc9 100644 --- a/src/main/java/org/openrewrite/javascript/table/package-info.java +++ b/src/main/java/org/openrewrite/javascript/table/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.javascript.table; -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/javascript/tree/JS.java b/src/main/java/org/openrewrite/javascript/tree/JS.java index e390532c..5b01262d 100644 --- a/src/main/java/org/openrewrite/javascript/tree/JS.java +++ b/src/main/java/org/openrewrite/javascript/tree/JS.java @@ -18,8 +18,8 @@ import lombok.*; import lombok.experimental.FieldDefaults; import lombok.experimental.NonFinal; +import org.jspecify.annotations.Nullable; import org.openrewrite.*; -import org.openrewrite.internal.lang.Nullable; import org.openrewrite.java.JavaPrinter; import org.openrewrite.java.internal.TypesInUse; import org.openrewrite.java.service.ImportService; @@ -510,8 +510,7 @@ public Export withExports(List exports) { @Getter @With - @Nullable - J.Literal target; + J.@Nullable Literal target; @Nullable JLeftPadded initializer; @@ -743,11 +742,11 @@ class JsImport implements JS, Statement { @Nullable JRightPadded name; - public @Nullable J.Identifier getName() { + public J.@Nullable Identifier getName() { return name == null ? null : name.getElement(); } - public JsImport withName(@Nullable J.Identifier name) { + public JsImport withName(J.@Nullable Identifier name) { return getPadding().withName(JRightPadded.withElement(this.name, name)); } @@ -767,10 +766,10 @@ public JsImport withImports(List imports) { @With Space from; - @Nullable + @Getter @With - J.Literal target; + J.@Nullable Literal target; @Nullable JLeftPadded initializer; @@ -1094,7 +1093,7 @@ public List getAllAnnotations() { return allAnnotations; } - public @Nullable JavaType.FullyQualified getTypeAsFullyQualified() { + public JavaType.@Nullable FullyQualified getTypeAsFullyQualified() { return typeExpression == null ? null : TypeUtils.asFullyQualified(typeExpression.getType()); } @@ -1137,11 +1136,11 @@ public static final class Binding implements JS, NameTree { @Nullable JRightPadded propertyName; - public @Nullable J.Identifier getPropertyName() { + public J.@Nullable Identifier getPropertyName() { return propertyName == null ? null : propertyName.getElement(); } - public ObjectBindingDeclarations.Binding withPropertyName(@Nullable J.Identifier propertyName) { + public ObjectBindingDeclarations.Binding withPropertyName(J.@Nullable Identifier propertyName) { return getPadding().withPropertyName(JRightPadded.withElement(this.propertyName, propertyName)); } @@ -1170,9 +1169,8 @@ public ObjectBindingDeclarations.Binding withInitializer(@Nullable Expression in } @With - @Nullable @Getter - JavaType.Variable variableType; + JavaType.@Nullable Variable variableType; @Override public JavaType getType() { @@ -1538,9 +1536,9 @@ final class TypeDeclaration implements JS, Statement, TypedTree { @With J.Identifier name; - @Nullable + @With - J.TypeParameters typeParameters; + J.@Nullable TypeParameters typeParameters; JLeftPadded initializer; diff --git a/src/main/java/org/openrewrite/javascript/tree/package-info.java b/src/main/java/org/openrewrite/javascript/tree/package-info.java index f7885d29..e3782223 100644 --- a/src/main/java/org/openrewrite/javascript/tree/package-info.java +++ b/src/main/java/org/openrewrite/javascript/tree/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.javascript.tree; -import org.openrewrite.internal.lang.NonNullApi; +import org.jspecify.annotations.NullMarked; import org.openrewrite.internal.lang.NonNullFields; diff --git a/src/test/java/org/openrewrite/javascript/recipe/package-info.java b/src/test/java/org/openrewrite/javascript/recipe/package-info.java index d8290ca5..1bba0188 100644 --- a/src/test/java/org/openrewrite/javascript/recipe/package-info.java +++ b/src/test/java/org/openrewrite/javascript/recipe/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.javascript.recipe; -import org.openrewrite.internal.lang.NonNullApi; +import org.jspecify.annotations.NullMarked; import org.openrewrite.internal.lang.NonNullFields;