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 buildIfThenPart(KtIfExpression expression) { Space.EMPTY); } - private @Nullable J.If.Else buildIfElsePart(KtIfExpression expression) { + private J.If.@Nullable Else buildIfElsePart(KtIfExpression expression) { if (expression.getElse() == null) { return null; } @@ -3637,15 +3637,15 @@ private JavaType.Primitive primitiveType(PsiElement psi) { return psiElementAssociations.primitiveType(psi); } - private @Nullable JavaType.Variable variableType(PsiElement psi, @Nullable FirElement parent) { + private JavaType.@Nullable Variable variableType(PsiElement psi, @Nullable FirElement parent) { return psiElementAssociations.variableType(psi, parent); } - private @Nullable JavaType.Method methodDeclarationType(PsiElement psi) { + private JavaType.@Nullable Method methodDeclarationType(PsiElement psi) { return psiElementAssociations.methodDeclarationType(psi); } - private @Nullable JavaType.Method methodInvocationType(PsiElement psi) { + private JavaType.@Nullable Method methodInvocationType(PsiElement psi) { return psiElementAssociations.methodInvocationType(psi); } @@ -3669,7 +3669,7 @@ private J.Identifier createIdentifier(String name, Space prefix, private J.Identifier createIdentifier(String name, Space prefix, @Nullable JavaType type, - @Nullable JavaType.Variable fieldType) { + JavaType.@Nullable Variable fieldType) { Markers markers = Markers.EMPTY; String updated = name; if (name.startsWith("`")) { diff --git a/src/main/java/org/openrewrite/kotlin/internal/PsiTreePrinter.java b/src/main/java/org/openrewrite/kotlin/internal/PsiTreePrinter.java index d37e0b1b8..49846088d 100644 --- a/src/main/java/org/openrewrite/kotlin/internal/PsiTreePrinter.java +++ b/src/main/java/org/openrewrite/kotlin/internal/PsiTreePrinter.java @@ -40,8 +40,8 @@ import org.jetbrains.kotlin.name.ClassId; import org.jetbrains.kotlin.name.FqName; import org.jetbrains.kotlin.psi.psiUtil.PsiUtilsKt; +import org.jspecify.annotations.Nullable; import org.openrewrite.*; -import org.openrewrite.internal.lang.Nullable; import org.openrewrite.java.internal.JavaTypeCache; import org.openrewrite.java.tree.*; import org.openrewrite.kotlin.KotlinIrTypeMapping; diff --git a/src/main/java/org/openrewrite/kotlin/internal/package-info.java b/src/main/java/org/openrewrite/kotlin/internal/package-info.java index de64c72ae..baaaa84ed 100644 --- a/src/main/java/org/openrewrite/kotlin/internal/package-info.java +++ b/src/main/java/org/openrewrite/kotlin/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.kotlin.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/kotlin/internal/template/package-info.java b/src/main/java/org/openrewrite/kotlin/internal/template/package-info.java index aad0d0987..d27983de1 100644 --- a/src/main/java/org/openrewrite/kotlin/internal/template/package-info.java +++ b/src/main/java/org/openrewrite/kotlin/internal/template/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.internal.template; -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/marker/IsNullSafe.java b/src/main/java/org/openrewrite/kotlin/marker/IsNullSafe.java index 19873a8db..d53288923 100644 --- a/src/main/java/org/openrewrite/kotlin/marker/IsNullSafe.java +++ b/src/main/java/org/openrewrite/kotlin/marker/IsNullSafe.java @@ -19,7 +19,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Value; import lombok.With; -import org.openrewrite.internal.lang.Nullable; +import org.jspecify.annotations.Nullable; import org.openrewrite.java.tree.Space; import org.openrewrite.marker.Marker; diff --git a/src/main/java/org/openrewrite/kotlin/marker/KObject.java b/src/main/java/org/openrewrite/kotlin/marker/KObject.java index 1e71a8b09..581914d91 100644 --- a/src/main/java/org/openrewrite/kotlin/marker/KObject.java +++ b/src/main/java/org/openrewrite/kotlin/marker/KObject.java @@ -19,7 +19,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Value; import lombok.With; -import org.openrewrite.internal.lang.Nullable; +import org.jspecify.annotations.Nullable; import org.openrewrite.java.tree.Space; import org.openrewrite.marker.Marker; diff --git a/src/main/java/org/openrewrite/kotlin/marker/package-info.java b/src/main/java/org/openrewrite/kotlin/marker/package-info.java index 4dd782244..d80f9727c 100644 --- a/src/main/java/org/openrewrite/kotlin/marker/package-info.java +++ b/src/main/java/org/openrewrite/kotlin/marker/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.marker; -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/package-info.java b/src/main/java/org/openrewrite/kotlin/package-info.java index 338fe11cb..1902d78fd 100644 --- a/src/main/java/org/openrewrite/kotlin/package-info.java +++ b/src/main/java/org/openrewrite/kotlin/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; -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/search/package-info.java b/src/main/java/org/openrewrite/kotlin/search/package-info.java index d1c0102b9..d9694e198 100644 --- a/src/main/java/org/openrewrite/kotlin/search/package-info.java +++ b/src/main/java/org/openrewrite/kotlin/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.kotlin.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/kotlin/service/KotlinAutoFormatService.java b/src/main/java/org/openrewrite/kotlin/service/KotlinAutoFormatService.java index 5e2f7accc..2d2d7dc82 100644 --- a/src/main/java/org/openrewrite/kotlin/service/KotlinAutoFormatService.java +++ b/src/main/java/org/openrewrite/kotlin/service/KotlinAutoFormatService.java @@ -15,8 +15,8 @@ */ package org.openrewrite.kotlin.service; +import org.jspecify.annotations.Nullable; import org.openrewrite.Tree; -import org.openrewrite.internal.lang.Nullable; import org.openrewrite.java.JavaVisitor; import org.openrewrite.java.service.AutoFormatService; import org.openrewrite.kotlin.format.AutoFormatVisitor; diff --git a/src/main/java/org/openrewrite/kotlin/service/KotlinImportService.java b/src/main/java/org/openrewrite/kotlin/service/KotlinImportService.java index b4e146943..728fc6a9a 100644 --- a/src/main/java/org/openrewrite/kotlin/service/KotlinImportService.java +++ b/src/main/java/org/openrewrite/kotlin/service/KotlinImportService.java @@ -15,7 +15,7 @@ */ package org.openrewrite.kotlin.service; -import org.openrewrite.internal.lang.Nullable; +import org.jspecify.annotations.Nullable; import org.openrewrite.java.JavaVisitor; import org.openrewrite.java.service.ImportService; import org.openrewrite.kotlin.AddImport; diff --git a/src/main/java/org/openrewrite/kotlin/service/package-info.java b/src/main/java/org/openrewrite/kotlin/service/package-info.java index 5a02e4b7a..aed168883 100644 --- a/src/main/java/org/openrewrite/kotlin/service/package-info.java +++ b/src/main/java/org/openrewrite/kotlin/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.kotlin.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/kotlin/style/Autodetect.java b/src/main/java/org/openrewrite/kotlin/style/Autodetect.java index c87473805..54d3b9742 100644 --- a/src/main/java/org/openrewrite/kotlin/style/Autodetect.java +++ b/src/main/java/org/openrewrite/kotlin/style/Autodetect.java @@ -19,11 +19,11 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.Value; +import org.jspecify.annotations.Nullable; import org.openrewrite.SourceFile; 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.TrailingComma; import org.openrewrite.java.tree.*; import org.openrewrite.kotlin.KotlinIsoVisitor; diff --git a/src/main/java/org/openrewrite/kotlin/style/ImportLayoutStyle.java b/src/main/java/org/openrewrite/kotlin/style/ImportLayoutStyle.java index 62eb87f04..eab92d63a 100644 --- a/src/main/java/org/openrewrite/kotlin/style/ImportLayoutStyle.java +++ b/src/main/java/org/openrewrite/kotlin/style/ImportLayoutStyle.java @@ -28,9 +28,9 @@ import com.fasterxml.jackson.databind.jsontype.TypeSerializer; import lombok.EqualsAndHashCode; import lombok.Getter; +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.tree.*; import org.openrewrite.kotlin.KotlinStyle; import org.openrewrite.kotlin.internal.KotlinPrinter; @@ -115,7 +115,7 @@ public ImportLayoutStyle(int topLevelSymbolsToUseStarImport, * @return The import list with a new import added. */ public List> addImport(List> originalImports, - J.Import toAdd, @Nullable J.Package pkg, + J.Import toAdd, J.@Nullable Package pkg, Collection classpath) { JRightPadded paddedToAdd = new JRightPadded<>(toAdd, Space.EMPTY, Markers.EMPTY); diff --git a/src/main/java/org/openrewrite/kotlin/style/package-info.java b/src/main/java/org/openrewrite/kotlin/style/package-info.java index 692ca5027..01b7f8e70 100644 --- a/src/main/java/org/openrewrite/kotlin/style/package-info.java +++ b/src/main/java/org/openrewrite/kotlin/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.kotlin.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/kotlin/table/package-info.java b/src/main/java/org/openrewrite/kotlin/table/package-info.java index 92d0a4d9f..134630469 100644 --- a/src/main/java/org/openrewrite/kotlin/table/package-info.java +++ b/src/main/java/org/openrewrite/kotlin/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.kotlin.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/kotlin/tree/K.java b/src/main/java/org/openrewrite/kotlin/tree/K.java index cb98c05dc..096cd88dd 100644 --- a/src/main/java/org/openrewrite/kotlin/tree/K.java +++ b/src/main/java/org/openrewrite/kotlin/tree/K.java @@ -20,9 +20,9 @@ import lombok.*; import lombok.experimental.FieldDefaults; import lombok.experimental.NonFinal; +import org.jspecify.annotations.Nullable; import org.openrewrite.*; import org.openrewrite.internal.ListUtils; -import org.openrewrite.internal.lang.Nullable; import org.openrewrite.java.JavaPrinter; import org.openrewrite.java.JavaTypeVisitor; import org.openrewrite.java.internal.TypesInUse; @@ -1552,9 +1552,9 @@ public Property(UUID id, JContainer typeParameters, @Nullable JRightPadded paddedVariableDeclarations, @Nullable VariableDeclarations variableDeclarations, - @Nullable K.TypeConstraints typeConstraints, - @Nullable @JsonProperty("getter") J.MethodDeclaration getter, - @Nullable @JsonProperty("setter") J.MethodDeclaration setter, + K.@Nullable TypeConstraints typeConstraints, + @JsonProperty("getter") J.@Nullable MethodDeclaration getter, + @JsonProperty("setter") J.@Nullable MethodDeclaration setter, @Nullable @JsonProperty("isSetterFirst") Boolean isSetterFirst, JContainer accessors, @Nullable JRightPadded receiver @@ -1687,10 +1687,9 @@ final class Return implements K, Statement, Expression { J.Return expression; - @Nullable - J.Identifier label; + J.@Nullable Identifier label; - public Return(UUID id, J.Return expression, @Nullable J.Identifier label) { + public Return(UUID id, J.Return expression, J.@Nullable Identifier label) { this(id, Collections.emptyList(), expression, label); } @@ -1923,8 +1922,7 @@ final class This implements K, Expression { Space prefix; Markers markers; - @Nullable - J.Identifier label; + J.@Nullable Identifier label; @Nullable JavaType type; diff --git a/src/main/java/org/openrewrite/kotlin/tree/package-info.java b/src/main/java/org/openrewrite/kotlin/tree/package-info.java index 0534c44b5..43b2eaf38 100644 --- a/src/main/java/org/openrewrite/kotlin/tree/package-info.java +++ b/src/main/java/org/openrewrite/kotlin/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.kotlin.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/kotlin/KotlinIrTypeMappingTest.java b/src/test/java/org/openrewrite/kotlin/KotlinIrTypeMappingTest.java index fe37ef27c..79291c67c 100644 --- a/src/test/java/org/openrewrite/kotlin/KotlinIrTypeMappingTest.java +++ b/src/test/java/org/openrewrite/kotlin/KotlinIrTypeMappingTest.java @@ -18,6 +18,7 @@ import org.jetbrains.kotlin.com.intellij.openapi.Disposable; import org.jetbrains.kotlin.com.intellij.openapi.util.Disposer; import org.jetbrains.kotlin.ir.declarations.*; +import org.jspecify.annotations.Nullable; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Nested; @@ -25,7 +26,6 @@ import org.openrewrite.InMemoryExecutionContext; import org.openrewrite.Parser; import org.openrewrite.internal.StringUtils; -import org.openrewrite.internal.lang.Nullable; import org.openrewrite.java.internal.JavaTypeCache; import org.openrewrite.kotlin.internal.CompiledSource; import org.openrewrite.test.RewriteTest; diff --git a/src/test/java/org/openrewrite/kotlin/KotlinTypeIrSignatureBuilderTest.java b/src/test/java/org/openrewrite/kotlin/KotlinTypeIrSignatureBuilderTest.java index ff834f1d3..b5a4c18ed 100644 --- a/src/test/java/org/openrewrite/kotlin/KotlinTypeIrSignatureBuilderTest.java +++ b/src/test/java/org/openrewrite/kotlin/KotlinTypeIrSignatureBuilderTest.java @@ -18,13 +18,13 @@ import org.jetbrains.kotlin.com.intellij.openapi.Disposable; import org.jetbrains.kotlin.com.intellij.openapi.util.Disposer; import org.jetbrains.kotlin.ir.declarations.*; +import org.jspecify.annotations.Nullable; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.openrewrite.InMemoryExecutionContext; import org.openrewrite.Parser; import org.openrewrite.internal.StringUtils; -import org.openrewrite.internal.lang.Nullable; import org.openrewrite.kotlin.internal.CompiledSource; import org.openrewrite.tree.ParsingExecutionContextView; diff --git a/src/test/java/org/openrewrite/kotlin/KotlinTypeSignatureBuilderTest.java b/src/test/java/org/openrewrite/kotlin/KotlinTypeSignatureBuilderTest.java index 4dc1ad7dc..cbf5a2c4f 100644 --- a/src/test/java/org/openrewrite/kotlin/KotlinTypeSignatureBuilderTest.java +++ b/src/test/java/org/openrewrite/kotlin/KotlinTypeSignatureBuilderTest.java @@ -18,13 +18,13 @@ import org.jetbrains.kotlin.com.intellij.openapi.Disposable; import org.jetbrains.kotlin.com.intellij.openapi.util.Disposer; import org.jetbrains.kotlin.fir.declarations.*; +import org.jspecify.annotations.Nullable; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.openrewrite.InMemoryExecutionContext; import org.openrewrite.Parser; import org.openrewrite.internal.StringUtils; -import org.openrewrite.internal.lang.Nullable; import org.openrewrite.kotlin.internal.CompiledSource; import org.openrewrite.tree.ParsingExecutionContextView;