diff --git a/src/main/java/org/openrewrite/kotlin/AddImport.java b/src/main/java/org/openrewrite/kotlin/AddImport.java index 5aee87a82..14feecedf 100644 --- a/src/main/java/org/openrewrite/kotlin/AddImport.java +++ b/src/main/java/org/openrewrite/kotlin/AddImport.java @@ -16,9 +16,9 @@ package org.openrewrite.kotlin; import lombok.EqualsAndHashCode; +import org.jspecify.annotations.Nullable; import org.openrewrite.internal.ListUtils; import org.openrewrite.internal.StringUtils; -import org.openrewrite.internal.lang.Nullable; import org.openrewrite.java.JavaIsoVisitor; import org.openrewrite.java.marker.JavaSourceSet; import org.openrewrite.java.search.FindMethods; diff --git a/src/main/java/org/openrewrite/kotlin/Assertions.java b/src/main/java/org/openrewrite/kotlin/Assertions.java index 8605b1984..9143729dc 100644 --- a/src/main/java/org/openrewrite/kotlin/Assertions.java +++ b/src/main/java/org/openrewrite/kotlin/Assertions.java @@ -17,9 +17,9 @@ import org.intellij.lang.annotations.Language; +import org.jspecify.annotations.Nullable; import org.openrewrite.*; import org.openrewrite.internal.ThrowingConsumer; -import org.openrewrite.internal.lang.Nullable; import org.openrewrite.java.search.FindMissingTypes; import org.openrewrite.java.tree.*; import org.openrewrite.kotlin.marker.Extension; diff --git a/src/main/java/org/openrewrite/kotlin/FindKotlinSources.java b/src/main/java/org/openrewrite/kotlin/FindKotlinSources.java index 822cd692e..f40caf24e 100644 --- a/src/main/java/org/openrewrite/kotlin/FindKotlinSources.java +++ b/src/main/java/org/openrewrite/kotlin/FindKotlinSources.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.kotlin.table.KotlinSourceFile; import org.openrewrite.kotlin.tree.K; import org.openrewrite.marker.SearchResult; @@ -65,7 +65,7 @@ public Tree visit(@Nullable Tree tree, ExecutionContext ctx) { return tree; } - private @Nullable KotlinSourceFile.SourceFileType getSourceFileType(SourceFile sourceFile) { + private KotlinSourceFile.@Nullable SourceFileType getSourceFileType(SourceFile sourceFile) { KotlinSourceFile.SourceFileType sourceFileType = null; if (sourceFile instanceof K.CompilationUnit) { sourceFileType = KotlinSourceFile.SourceFileType.Kotlin; diff --git a/src/main/java/org/openrewrite/kotlin/KotlinParser.java b/src/main/java/org/openrewrite/kotlin/KotlinParser.java index 3ec523875..d1dd87826 100644 --- a/src/main/java/org/openrewrite/kotlin/KotlinParser.java +++ b/src/main/java/org/openrewrite/kotlin/KotlinParser.java @@ -63,8 +63,8 @@ import org.jetbrains.kotlin.psi.KtFile; import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatformAnalyzerServices; import org.jetbrains.kotlin.utils.PathUtil; +import org.jspecify.annotations.Nullable; import org.openrewrite.*; -import org.openrewrite.internal.lang.Nullable; import org.openrewrite.java.JavaParser; import org.openrewrite.java.internal.JavaTypeCache; import org.openrewrite.java.marker.JavaSourceSet; diff --git a/src/main/java/org/openrewrite/kotlin/KotlinVisitor.java b/src/main/java/org/openrewrite/kotlin/KotlinVisitor.java index 5aea5f98a..8d3871901 100644 --- a/src/main/java/org/openrewrite/kotlin/KotlinVisitor.java +++ b/src/main/java/org/openrewrite/kotlin/KotlinVisitor.java @@ -15,10 +15,10 @@ */ package org.openrewrite.kotlin; +import org.jspecify.annotations.Nullable; import org.openrewrite.Cursor; 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.kotlin.marker.*; diff --git a/src/main/java/org/openrewrite/kotlin/cleanup/EqualsMethodUsage.java b/src/main/java/org/openrewrite/kotlin/cleanup/EqualsMethodUsage.java index cb710a3a4..888fc6388 100644 --- a/src/main/java/org/openrewrite/kotlin/cleanup/EqualsMethodUsage.java +++ b/src/main/java/org/openrewrite/kotlin/cleanup/EqualsMethodUsage.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.java.tree.Expression; import org.openrewrite.java.tree.J; import org.openrewrite.java.tree.Space; @@ -37,8 +37,8 @@ @Value @EqualsAndHashCode(callSuper = false) public class EqualsMethodUsage extends Recipe { - @Nullable - private static J.Binary equalsBinaryTemplate; + + private static J.@Nullable Binary equalsBinaryTemplate; @Override public String getDisplayName() { diff --git a/src/main/java/org/openrewrite/kotlin/cleanup/RemoveTrailingSemicolon.java b/src/main/java/org/openrewrite/kotlin/cleanup/RemoveTrailingSemicolon.java index 6a80ff473..9af7efffb 100644 --- a/src/main/java/org/openrewrite/kotlin/cleanup/RemoveTrailingSemicolon.java +++ b/src/main/java/org/openrewrite/kotlin/cleanup/RemoveTrailingSemicolon.java @@ -17,11 +17,11 @@ import lombok.EqualsAndHashCode; import lombok.Value; +import org.jspecify.annotations.Nullable; import org.openrewrite.ExecutionContext; import org.openrewrite.PrintOutputCapture; import org.openrewrite.Recipe; import org.openrewrite.TreeVisitor; -import org.openrewrite.internal.lang.Nullable; import org.openrewrite.java.tree.J; import org.openrewrite.java.tree.Space; import org.openrewrite.kotlin.KotlinIsoVisitor; diff --git a/src/main/java/org/openrewrite/kotlin/cleanup/package-info.java b/src/main/java/org/openrewrite/kotlin/cleanup/package-info.java index 490389621..dbacfd740 100644 --- a/src/main/java/org/openrewrite/kotlin/cleanup/package-info.java +++ b/src/main/java/org/openrewrite/kotlin/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.kotlin.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/kotlin/format/AutoFormatVisitor.java b/src/main/java/org/openrewrite/kotlin/format/AutoFormatVisitor.java index 946a42df5..fd7807956 100644 --- a/src/main/java/org/openrewrite/kotlin/format/AutoFormatVisitor.java +++ b/src/main/java/org/openrewrite/kotlin/format/AutoFormatVisitor.java @@ -16,10 +16,10 @@ package org.openrewrite.kotlin.format; +import org.jspecify.annotations.Nullable; import org.openrewrite.Cursor; import org.openrewrite.SourceFile; import org.openrewrite.Tree; -import org.openrewrite.internal.lang.Nullable; import org.openrewrite.java.tree.J; import org.openrewrite.java.tree.JavaSourceFile; import org.openrewrite.kotlin.KotlinIsoVisitor; diff --git a/src/main/java/org/openrewrite/kotlin/format/BlankLinesVisitor.java b/src/main/java/org/openrewrite/kotlin/format/BlankLinesVisitor.java index 24f0aecf3..a8adfd12a 100644 --- a/src/main/java/org/openrewrite/kotlin/format/BlankLinesVisitor.java +++ b/src/main/java/org/openrewrite/kotlin/format/BlankLinesVisitor.java @@ -16,9 +16,9 @@ package org.openrewrite.kotlin.format; +import org.jspecify.annotations.Nullable; import org.openrewrite.Tree; import org.openrewrite.internal.ListUtils; -import org.openrewrite.internal.lang.Nullable; import org.openrewrite.java.tree.*; import org.openrewrite.kotlin.KotlinIsoVisitor; import org.openrewrite.kotlin.marker.OmitBraces; diff --git a/src/main/java/org/openrewrite/kotlin/format/MinimumViableSpacingVisitor.java b/src/main/java/org/openrewrite/kotlin/format/MinimumViableSpacingVisitor.java index 7831aa484..12cc5b7b1 100644 --- a/src/main/java/org/openrewrite/kotlin/format/MinimumViableSpacingVisitor.java +++ b/src/main/java/org/openrewrite/kotlin/format/MinimumViableSpacingVisitor.java @@ -16,10 +16,10 @@ package org.openrewrite.kotlin.format; import com.fasterxml.jackson.annotation.JsonCreator; +import org.jspecify.annotations.Nullable; import org.openrewrite.Tree; import org.openrewrite.internal.ListUtils; import org.openrewrite.internal.StringUtils; -import org.openrewrite.internal.lang.Nullable; import org.openrewrite.java.marker.ImplicitReturn; import org.openrewrite.java.tree.*; import org.openrewrite.kotlin.KotlinIsoVisitor; diff --git a/src/main/java/org/openrewrite/kotlin/format/NormalizeFormatVisitor.java b/src/main/java/org/openrewrite/kotlin/format/NormalizeFormatVisitor.java index 35d171122..f20016911 100644 --- a/src/main/java/org/openrewrite/kotlin/format/NormalizeFormatVisitor.java +++ b/src/main/java/org/openrewrite/kotlin/format/NormalizeFormatVisitor.java @@ -16,10 +16,10 @@ package org.openrewrite.kotlin.format; import com.fasterxml.jackson.annotation.JsonCreator; +import org.jspecify.annotations.Nullable; import org.openrewrite.Tree; import org.openrewrite.internal.ListUtils; import org.openrewrite.internal.StringUtils; -import org.openrewrite.internal.lang.Nullable; import org.openrewrite.java.JavaVisitor; import org.openrewrite.java.JavadocVisitor; import org.openrewrite.java.tree.*; diff --git a/src/main/java/org/openrewrite/kotlin/format/NormalizeLineBreaksVisitor.java b/src/main/java/org/openrewrite/kotlin/format/NormalizeLineBreaksVisitor.java index 80ef22443..03e9363aa 100644 --- a/src/main/java/org/openrewrite/kotlin/format/NormalizeLineBreaksVisitor.java +++ b/src/main/java/org/openrewrite/kotlin/format/NormalizeLineBreaksVisitor.java @@ -15,9 +15,9 @@ */ package org.openrewrite.kotlin.format; +import org.jspecify.annotations.Nullable; import org.openrewrite.Tree; import org.openrewrite.internal.ListUtils; -import org.openrewrite.internal.lang.Nullable; import org.openrewrite.java.JavaVisitor; import org.openrewrite.java.JavadocVisitor; import org.openrewrite.java.tree.*; diff --git a/src/main/java/org/openrewrite/kotlin/format/NormalizeTabsOrSpacesVisitor.java b/src/main/java/org/openrewrite/kotlin/format/NormalizeTabsOrSpacesVisitor.java index 7860db364..545591ad6 100644 --- a/src/main/java/org/openrewrite/kotlin/format/NormalizeTabsOrSpacesVisitor.java +++ b/src/main/java/org/openrewrite/kotlin/format/NormalizeTabsOrSpacesVisitor.java @@ -16,11 +16,11 @@ package org.openrewrite.kotlin.format; +import org.jspecify.annotations.NonNull; +import org.jspecify.annotations.Nullable; import org.openrewrite.Tree; import org.openrewrite.internal.ListUtils; import org.openrewrite.internal.StringUtils; -import org.openrewrite.internal.lang.NonNull; -import org.openrewrite.internal.lang.Nullable; import org.openrewrite.java.JavaVisitor; import org.openrewrite.java.JavadocVisitor; import org.openrewrite.java.tree.*; diff --git a/src/main/java/org/openrewrite/kotlin/format/RemoveTrailingWhitespaceVisitor.java b/src/main/java/org/openrewrite/kotlin/format/RemoveTrailingWhitespaceVisitor.java index 615068e27..56c506129 100644 --- a/src/main/java/org/openrewrite/kotlin/format/RemoveTrailingWhitespaceVisitor.java +++ b/src/main/java/org/openrewrite/kotlin/format/RemoveTrailingWhitespaceVisitor.java @@ -17,8 +17,8 @@ import com.fasterxml.jackson.annotation.JsonCreator; +import org.jspecify.annotations.Nullable; import org.openrewrite.Tree; -import org.openrewrite.internal.lang.Nullable; import org.openrewrite.java.tree.J; import org.openrewrite.java.tree.JavaSourceFile; import org.openrewrite.java.tree.Space; diff --git a/src/main/java/org/openrewrite/kotlin/format/SpacesFromCompilationUnitStyle.java b/src/main/java/org/openrewrite/kotlin/format/SpacesFromCompilationUnitStyle.java index e9f8c2383..48be5b636 100644 --- a/src/main/java/org/openrewrite/kotlin/format/SpacesFromCompilationUnitStyle.java +++ b/src/main/java/org/openrewrite/kotlin/format/SpacesFromCompilationUnitStyle.java @@ -15,9 +15,9 @@ */ package org.openrewrite.kotlin.format; +import org.jspecify.annotations.Nullable; import org.openrewrite.ExecutionContext; import org.openrewrite.Tree; -import org.openrewrite.internal.lang.Nullable; import org.openrewrite.java.tree.J; import org.openrewrite.kotlin.KotlinIsoVisitor; import org.openrewrite.kotlin.style.IntelliJ; diff --git a/src/main/java/org/openrewrite/kotlin/format/SpacesVisitor.java b/src/main/java/org/openrewrite/kotlin/format/SpacesVisitor.java index 5babb3660..46ea4d727 100644 --- a/src/main/java/org/openrewrite/kotlin/format/SpacesVisitor.java +++ b/src/main/java/org/openrewrite/kotlin/format/SpacesVisitor.java @@ -15,11 +15,11 @@ */ package org.openrewrite.kotlin.format; +import org.jspecify.annotations.Nullable; import org.openrewrite.PrintOutputCapture; import org.openrewrite.Tree; import org.openrewrite.internal.ListUtils; import org.openrewrite.internal.StringUtils; -import org.openrewrite.internal.lang.Nullable; import org.openrewrite.java.marker.OmitParentheses; import org.openrewrite.java.marker.TrailingComma; import org.openrewrite.java.tree.*; diff --git a/src/main/java/org/openrewrite/kotlin/format/TabsAndIndentsVisitor.java b/src/main/java/org/openrewrite/kotlin/format/TabsAndIndentsVisitor.java index f26416411..83714839e 100644 --- a/src/main/java/org/openrewrite/kotlin/format/TabsAndIndentsVisitor.java +++ b/src/main/java/org/openrewrite/kotlin/format/TabsAndIndentsVisitor.java @@ -15,11 +15,11 @@ */ package org.openrewrite.kotlin.format; +import org.jspecify.annotations.Nullable; import org.openrewrite.Cursor; import org.openrewrite.Tree; import org.openrewrite.internal.ListUtils; import org.openrewrite.internal.StringUtils; -import org.openrewrite.internal.lang.Nullable; import org.openrewrite.java.marker.ImplicitReturn; import org.openrewrite.java.tree.*; import org.openrewrite.kotlin.KotlinIsoVisitor; diff --git a/src/main/java/org/openrewrite/kotlin/format/WrappingAndBracesVisitor.java b/src/main/java/org/openrewrite/kotlin/format/WrappingAndBracesVisitor.java index c0e57e906..7195d2962 100644 --- a/src/main/java/org/openrewrite/kotlin/format/WrappingAndBracesVisitor.java +++ b/src/main/java/org/openrewrite/kotlin/format/WrappingAndBracesVisitor.java @@ -16,10 +16,10 @@ package org.openrewrite.kotlin.format; +import org.jspecify.annotations.Nullable; import org.openrewrite.Cursor; import org.openrewrite.Tree; import org.openrewrite.internal.ListUtils; -import org.openrewrite.internal.lang.Nullable; import org.openrewrite.java.tree.*; import org.openrewrite.kotlin.KotlinIsoVisitor; import org.openrewrite.kotlin.marker.OmitBraces; diff --git a/src/main/java/org/openrewrite/kotlin/format/package-info.java b/src/main/java/org/openrewrite/kotlin/format/package-info.java index 9bff646e4..164c9bfb8 100644 --- a/src/main/java/org/openrewrite/kotlin/format/package-info.java +++ b/src/main/java/org/openrewrite/kotlin/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.kotlin.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/kotlin/internal/KotlinPrinter.java b/src/main/java/org/openrewrite/kotlin/internal/KotlinPrinter.java index 96e32599b..6820fb838 100755 --- a/src/main/java/org/openrewrite/kotlin/internal/KotlinPrinter.java +++ b/src/main/java/org/openrewrite/kotlin/internal/KotlinPrinter.java @@ -15,10 +15,10 @@ */ package org.openrewrite.kotlin.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.ImplicitReturn; import org.openrewrite.java.marker.OmitParentheses; @@ -645,7 +645,7 @@ public J visitClassDeclaration(J.ClassDeclaration classDecl, PrintOutputCapture< return visitClassDeclaration0(classDecl, null, p); } - private J.ClassDeclaration visitClassDeclaration0(J.ClassDeclaration classDecl, @Nullable K.TypeConstraints typeConstraints, PrintOutputCapture
p) { + private J.ClassDeclaration visitClassDeclaration0(J.ClassDeclaration classDecl, K.@Nullable TypeConstraints typeConstraints, PrintOutputCapture
p) { beforeSyntax(classDecl, Space.Location.CLASS_DECLARATION_PREFIX, p); visit(classDecl.getLeadingAnnotations(), p); for (J.Modifier m : classDecl.getModifiers()) { @@ -884,7 +884,7 @@ public J visitMethodDeclaration(J.MethodDeclaration method, PrintOutputCapture
p) { + private J.MethodDeclaration visitMethodDeclaration0(J.MethodDeclaration method, K.@Nullable TypeConstraints typeConstraints, PrintOutputCapture
p) { // Do not print generated methods. for (Marker marker : method.getMarkers().getMarkers()) { if (marker instanceof Implicit || marker instanceof PrimaryConstructor) { @@ -1404,7 +1404,7 @@ private void beforeSyntax(J j, Space.Location loc, PrintOutputCapture
p) { beforeSyntax(j.getPrefix(), j.getMarkers(), loc, p); } - private void beforeSyntax(Space prefix, Markers markers, @Nullable KSpace.Location loc, PrintOutputCapture
p) { + private void beforeSyntax(Space prefix, Markers markers, KSpace.@Nullable Location loc, PrintOutputCapture
p) { for (Marker marker : markers.getMarkers()) { p.append(p.getMarkerPrinter().beforePrefix(marker, new Cursor(getCursor(), marker), JAVA_MARKER_WRAPPER)); } @@ -1421,7 +1421,7 @@ private void beforeSyntax(K k, Space.Location loc, PrintOutputCapture
p) { beforeSyntax(k.getPrefix(), k.getMarkers(), loc, p); } - private void beforeSyntax(Space prefix, Markers markers, @Nullable Space.Location loc, PrintOutputCapture
p) { + private void beforeSyntax(Space prefix, Markers markers, Space.@Nullable Location loc, PrintOutputCapture
p) {
for (Marker marker : markers.getMarkers()) {
p.append(p.getMarkerPrinter().beforePrefix(marker, new Cursor(getCursor(), marker), JAVA_MARKER_WRAPPER));
}
diff --git a/src/main/java/org/openrewrite/kotlin/internal/KotlinTreeParserVisitor.java b/src/main/java/org/openrewrite/kotlin/internal/KotlinTreeParserVisitor.java
index 8e7f374fe..0e6a11f98 100644
--- a/src/main/java/org/openrewrite/kotlin/internal/KotlinTreeParserVisitor.java
+++ b/src/main/java/org/openrewrite/kotlin/internal/KotlinTreeParserVisitor.java
@@ -38,14 +38,14 @@
import org.jetbrains.kotlin.parsing.ParseUtilsKt;
import org.jetbrains.kotlin.psi.*;
import org.jetbrains.kotlin.psi.psiUtil.PsiUtilsKt;
+import org.jspecify.annotations.NonNull;
+import org.jspecify.annotations.Nullable;
import org.openrewrite.ExecutionContext;
import org.openrewrite.FileAttributes;
import org.openrewrite.ParseExceptionResult;
import org.openrewrite.Tree;
import org.openrewrite.internal.EncodingDetectingInputStream;
import org.openrewrite.internal.ListUtils;
-import org.openrewrite.internal.lang.NonNull;
-import org.openrewrite.internal.lang.Nullable;
import org.openrewrite.java.marker.ImplicitReturn;
import org.openrewrite.java.marker.OmitParentheses;
import org.openrewrite.java.marker.Quoted;
@@ -1923,7 +1923,7 @@ public J visitBinaryExpression(KtBinaryExpression expression, ExecutionContext d
return mapFunctionCall(expression, data);
}
- private @Nullable J.AssignmentOperation.Type mapAssignmentOperationType(KtOperationReferenceExpression operationReference) {
+ private J.AssignmentOperation.@Nullable Type mapAssignmentOperationType(KtOperationReferenceExpression operationReference) {
IElementType elementType = operationReference.getOperationSignTokenType();
if (elementType == KtTokens.PLUSEQ) {
@@ -3301,7 +3301,7 @@ public J visitValueArgumentList(KtValueArgumentList list, ExecutionContext data)
/*====================================================================
* Mapping methods
* ====================================================================*/
- private @Nullable K.Binary.Type mapKBinaryType(KtOperationReferenceExpression operationReference) {
+ private K.Binary.@Nullable Type mapKBinaryType(KtOperationReferenceExpression operationReference) {
IElementType elementType = operationReference.getOperationSignTokenType();
if (elementType == null) {
return null;
@@ -3328,7 +3328,7 @@ public J visitValueArgumentList(KtValueArgumentList list, ExecutionContext data)
}
}
- private @Nullable J.Binary.Type mapJBinaryType(KtOperationReferenceExpression operationReference) {
+ private J.Binary.@Nullable Type mapJBinaryType(KtOperationReferenceExpression operationReference) {
IElementType elementType = operationReference.getOperationSignTokenType();
if (elementType == null) {
@@ -3378,7 +3378,7 @@ else if (elementType == KtTokens.OROR)
return null;
}
- private @Nullable J.Unary.Type mapJUnaryType(KtSimpleNameExpression operationReference) {
+ private J.Unary.@Nullable Type mapJUnaryType(KtSimpleNameExpression operationReference) {
IElementType elementType = operationReference.getReferencedNameElementType();
if (elementType == KtTokens.EXCL) {
@@ -3444,7 +3444,7 @@ private JRightPadded