From 35a337f746a7ede4c738b0bae9c6d9323262473d Mon Sep 17 00:00:00 2001 From: sciencesakura Date: Sat, 21 Feb 2026 18:05:38 +0900 Subject: [PATCH] Switch to JSpecify for nullability expression. --- core/pom.xml | 6 ++-- .../com/sciencesakura/dbsetup/csv/Import.java | 28 +++++++++---------- pom.xml | 12 ++++---- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/core/pom.xml b/core/pom.xml index 994a0b9..b591a3e 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -25,9 +25,9 @@ commons-csv - org.jetbrains - annotations - true + org.jspecify + jspecify + provided diff --git a/core/src/main/java/com/sciencesakura/dbsetup/csv/Import.java b/core/src/main/java/com/sciencesakura/dbsetup/csv/Import.java index 51707f2..d1a24b2 100644 --- a/core/src/main/java/com/sciencesakura/dbsetup/csv/Import.java +++ b/core/src/main/java/com/sciencesakura/dbsetup/csv/Import.java @@ -22,7 +22,7 @@ import java.util.Map; import org.apache.commons.csv.CSVFormat; import org.apache.commons.csv.CSVParser; -import org.jetbrains.annotations.NotNull; +import org.jspecify.annotations.NonNull; /** * An operation which imports the CSV file into the database. @@ -48,8 +48,8 @@ public final class Import implements Operation { * @return the new {@code Import.Builder} instance * @throws IllegalArgumentException if the CSV file is not found */ - @NotNull - public static Builder csv(@NotNull String location) { + @NonNull + public static Builder csv(@NonNull String location) { var urlLocation = Import.class.getClassLoader() .getResource(requireNonNull(location, "location must not be null")); if (urlLocation == null) { @@ -65,8 +65,8 @@ public static Builder csv(@NotNull String location) { * @return the new {@code Import.Builder} instance * @throws IllegalArgumentException if the TSV file is not found */ - @NotNull - public static Builder tsv(@NotNull String location) { + @NonNull + public static Builder tsv(@NonNull String location) { return csv(location).withDelimiter('\t'); } @@ -186,7 +186,7 @@ private Builder(URL location) { * * @return the new {@code Import} instance */ - @NotNull + @NonNull public Import build() { if (built) { throw new IllegalStateException("already built"); @@ -202,7 +202,7 @@ public Import build() { * @param table the table name to import the CSV file * @return the reference to this object */ - public Builder into(@NotNull String table) { + public Builder into(@NonNull String table) { this.table = requireNonNull(table, "table must not be null"); return this; } @@ -215,7 +215,7 @@ public Builder into(@NotNull String table) { * @param charset the character encoding to read the CSV file * @return the reference to this object */ - public Builder withCharset(@NotNull Charset charset) { + public Builder withCharset(@NonNull Charset charset) { this.charset = requireNonNull(charset, "charset must not be null"); return this; } @@ -228,7 +228,7 @@ public Builder withCharset(@NotNull Charset charset) { * @param charset the character encoding to read the CSV file * @return the reference to this object */ - public Builder withCharset(@NotNull String charset) { + public Builder withCharset(@NonNull String charset) { requireNonNull(charset, "charset must not be null"); this.charset = Charset.forName(charset); return this; @@ -241,7 +241,7 @@ public Builder withCharset(@NotNull String charset) { * @param value the default value (nullable) * @return the reference to this object */ - public Builder withDefaultValue(@NotNull String column, Object value) { + public Builder withDefaultValue(@NonNull String column, Object value) { requireNonNull(column, "column must not be null"); defaultValues.put(column, value); return this; @@ -268,7 +268,7 @@ public Builder withDelimiter(char delimiter) { * @param valueGenerator the value generator to use * @return the reference to this object */ - public Builder withGeneratedValue(@NotNull String column, @NotNull ValueGenerator valueGenerator) { + public Builder withGeneratedValue(@NonNull String column, @NonNull ValueGenerator valueGenerator) { requireNonNull(column, "column must not be null"); requireNonNull(valueGenerator, "valueGenerator must not be null"); valueGenerators.put(column, valueGenerator); @@ -283,7 +283,7 @@ public Builder withGeneratedValue(@NotNull String column, @NotNull ValueGenerato * @param headers the headers of the CSV file * @return the reference to this object */ - public Builder withHeader(@NotNull Collection headers) { + public Builder withHeader(@NonNull Collection headers) { requireNonNull(headers, "headers must not be null"); this.headers = new String[headers.size()]; var i = 0; @@ -301,7 +301,7 @@ public Builder withHeader(@NotNull Collection headers) { * @param headers the headers of the CSV file * @return the reference to this object */ - public Builder withHeader(@NotNull String... headers) { + public Builder withHeader(@NonNull String... headers) { requireNonNull(headers, "headers must not be null"); this.headers = new String[headers.length]; var i = 0; @@ -319,7 +319,7 @@ public Builder withHeader(@NotNull String... headers) { * @param nullString the string to represent null values * @return the reference to this object */ - public Builder withNullAs(@NotNull String nullString) { + public Builder withNullAs(@NonNull String nullString) { this.nullString = requireNonNull(nullString, "nullString must not be null"); return this; } diff --git a/pom.xml b/pom.xml index 2586997..bd54037 100644 --- a/pom.xml +++ b/pom.xml @@ -66,7 +66,7 @@ 1.14.1 2.1.0 2.4.240 - 13.0 + 1.0.0 6.0.3 @@ -117,11 +117,6 @@ assertj-db ${assertj-db.version} - - org.jetbrains - annotations - ${jetbrains-annotations.version} - org.jetbrains.kotlin kotlin-stdlib @@ -132,6 +127,11 @@ kotlin-test-junit5 ${kotlin.version} + + org.jspecify + jspecify + ${jspecify.version} + org.junit.jupiter junit-jupiter