diff --git a/README.md b/README.md index 4236cc1..8ea0566 100644 --- a/README.md +++ b/README.md @@ -162,7 +162,7 @@ This repository only contains the source code for the package. ### Set up the prerequisites -1. Download and install Java SE Development Kit (JDK) version 17 (from one of the following locations). +1. Download and install Java SE Development Kit (JDK) version 21 (from one of the following locations). * [Oracle](https://www.oracle.com/java/technologies/downloads/) * [OpenJDK](https://adoptium.net/) diff --git a/ballerina-tests/constraint-validation-tests/Ballerina.toml b/ballerina-tests/constraint-validation-tests/Ballerina.toml index 84093d9..c0150e4 100644 --- a/ballerina-tests/constraint-validation-tests/Ballerina.toml +++ b/ballerina-tests/constraint-validation-tests/Ballerina.toml @@ -1,15 +1,15 @@ [package] org = "ballerina" name = "constraint_validation_tests" -version = "0.1.0" +version = "0.1.1" [[dependency]] org = "ballerina" name = "csv_commons" repository = "local" -version = "0.1.0" +version = "0.1.1" -[platform.java17] +[platform.java21] graalvmCompatible = true [build-options] diff --git a/ballerina-tests/constraint-validation-tests/Dependencies.toml b/ballerina-tests/constraint-validation-tests/Dependencies.toml index 8c8f80d..ecb2d49 100644 --- a/ballerina-tests/constraint-validation-tests/Dependencies.toml +++ b/ballerina-tests/constraint-validation-tests/Dependencies.toml @@ -5,12 +5,12 @@ [ballerina] dependencies-toml-version = "2" -distribution-version = "2201.10.0" +distribution-version = "2201.11.0-20241117-133400-a3054b77" [[package]] org = "ballerina" name = "constraint" -version = "1.5.0" +version = "1.6.0" scope = "testOnly" dependencies = [ {org = "ballerina", name = "jballerina.java"} @@ -22,7 +22,7 @@ modules = [ [[package]] org = "ballerina" name = "constraint_validation_tests" -version = "0.1.0" +version = "0.1.1" dependencies = [ {org = "ballerina", name = "constraint"}, {org = "ballerina", name = "data.csv"}, @@ -35,7 +35,7 @@ modules = [ [[package]] org = "ballerina" name = "data.csv" -version = "0.1.0" +version = "0.1.1" scope = "testOnly" dependencies = [ {org = "ballerina", name = "jballerina.java"} diff --git a/ballerina-tests/csv-commons/Ballerina.toml b/ballerina-tests/csv-commons/Ballerina.toml index 13c0bc8..eab175e 100644 --- a/ballerina-tests/csv-commons/Ballerina.toml +++ b/ballerina-tests/csv-commons/Ballerina.toml @@ -1,7 +1,7 @@ [package] org = "ballerina" name = "csv_commons" -version = "0.1.0" +version = "0.1.1" [platform.java17] graalvmCompatible = true diff --git a/ballerina-tests/csv-commons/Dependencies.toml b/ballerina-tests/csv-commons/Dependencies.toml index 590645d..3e05d30 100644 --- a/ballerina-tests/csv-commons/Dependencies.toml +++ b/ballerina-tests/csv-commons/Dependencies.toml @@ -5,12 +5,12 @@ [ballerina] dependencies-toml-version = "2" -distribution-version = "2201.10.0" +distribution-version = "2201.11.0-20241117-133400-a3054b77" [[package]] org = "ballerina" name = "csv_commons" -version = "0.1.0" +version = "0.1.1" modules = [ {org = "ballerina", packageName = "csv_commons", moduleName = "csv_commons"} ] diff --git a/ballerina-tests/parse-list-types-tests/Ballerina.toml b/ballerina-tests/parse-list-types-tests/Ballerina.toml index 258e9ff..052ec8b 100644 --- a/ballerina-tests/parse-list-types-tests/Ballerina.toml +++ b/ballerina-tests/parse-list-types-tests/Ballerina.toml @@ -1,15 +1,15 @@ [package] org = "ballerina" name = "parse_list_types_tests" -version = "0.1.0" +version = "0.1.1" [[dependency]] org = "ballerina" name = "csv_commons" repository = "local" -version = "0.1.0" +version = "0.1.1" -[platform.java17] +[platform.java21] graalvmCompatible = true [build-options] diff --git a/ballerina-tests/parse-list-types-tests/Dependencies.toml b/ballerina-tests/parse-list-types-tests/Dependencies.toml index 64cbd67..c032f90 100644 --- a/ballerina-tests/parse-list-types-tests/Dependencies.toml +++ b/ballerina-tests/parse-list-types-tests/Dependencies.toml @@ -5,12 +5,12 @@ [ballerina] dependencies-toml-version = "2" -distribution-version = "2201.10.0" +distribution-version = "2201.11.0-20241117-133400-a3054b77" [[package]] org = "ballerina" name = "csv_commons" -version = "0.1.0" +version = "0.1.1" scope = "testOnly" modules = [ {org = "ballerina", packageName = "csv_commons", moduleName = "csv_commons"} @@ -19,7 +19,7 @@ modules = [ [[package]] org = "ballerina" name = "data.csv" -version = "0.1.0" +version = "0.1.1" scope = "testOnly" dependencies = [ {org = "ballerina", name = "jballerina.java"} @@ -72,7 +72,7 @@ scope = "testOnly" [[package]] org = "ballerina" name = "parse_list_types_tests" -version = "0.1.0" +version = "0.1.1" dependencies = [ {org = "ballerina", name = "csv_commons"}, {org = "ballerina", name = "data.csv"}, diff --git a/ballerina-tests/parse-record-types-tests/Ballerina.toml b/ballerina-tests/parse-record-types-tests/Ballerina.toml index 7cdb2d4..638105b 100644 --- a/ballerina-tests/parse-record-types-tests/Ballerina.toml +++ b/ballerina-tests/parse-record-types-tests/Ballerina.toml @@ -1,15 +1,15 @@ [package] org = "ballerina" name = "parse_record_types_tests" -version = "0.1.0" +version = "0.1.1" [[dependency]] org = "ballerina" name = "csv_commons" repository = "local" -version = "0.1.0" +version = "0.1.1" -[platform.java17] +[platform.java21] graalvmCompatible = true [build-options] diff --git a/ballerina-tests/parse-record-types-tests/Dependencies.toml b/ballerina-tests/parse-record-types-tests/Dependencies.toml index 1b805c0..e109db0 100644 --- a/ballerina-tests/parse-record-types-tests/Dependencies.toml +++ b/ballerina-tests/parse-record-types-tests/Dependencies.toml @@ -5,12 +5,12 @@ [ballerina] dependencies-toml-version = "2" -distribution-version = "2201.10.0" +distribution-version = "2201.11.0-20241117-133400-a3054b77" [[package]] org = "ballerina" name = "csv_commons" -version = "0.1.0" +version = "0.1.1" scope = "testOnly" modules = [ {org = "ballerina", packageName = "csv_commons", moduleName = "csv_commons"} @@ -19,7 +19,7 @@ modules = [ [[package]] org = "ballerina" name = "data.csv" -version = "0.1.0" +version = "0.1.1" scope = "testOnly" dependencies = [ {org = "ballerina", name = "jballerina.java"} @@ -72,7 +72,7 @@ scope = "testOnly" [[package]] org = "ballerina" name = "parse_record_types_tests" -version = "0.1.0" +version = "0.1.1" dependencies = [ {org = "ballerina", name = "csv_commons"}, {org = "ballerina", name = "data.csv"}, diff --git a/ballerina-tests/parse-string-array-types-tests/Ballerina.toml b/ballerina-tests/parse-string-array-types-tests/Ballerina.toml index d1d42fe..3cc8a31 100644 --- a/ballerina-tests/parse-string-array-types-tests/Ballerina.toml +++ b/ballerina-tests/parse-string-array-types-tests/Ballerina.toml @@ -1,15 +1,15 @@ [package] org = "ballerina" name = "parse_string_array_types_tests" -version = "0.1.0" +version = "0.1.1" [[dependency]] org = "ballerina" name = "csv_commons" repository = "local" -version = "0.1.0" +version = "0.1.1" -[platform.java17] +[platform.java21] graalvmCompatible = true [build-options] diff --git a/ballerina-tests/parse-string-array-types-tests/Dependencies.toml b/ballerina-tests/parse-string-array-types-tests/Dependencies.toml index 7e6f6c6..162bb19 100644 --- a/ballerina-tests/parse-string-array-types-tests/Dependencies.toml +++ b/ballerina-tests/parse-string-array-types-tests/Dependencies.toml @@ -5,12 +5,12 @@ [ballerina] dependencies-toml-version = "2" -distribution-version = "2201.10.0" +distribution-version = "2201.11.0-20241117-133400-a3054b77" [[package]] org = "ballerina" name = "csv_commons" -version = "0.1.0" +version = "0.1.1" scope = "testOnly" modules = [ {org = "ballerina", packageName = "csv_commons", moduleName = "csv_commons"} @@ -19,7 +19,7 @@ modules = [ [[package]] org = "ballerina" name = "data.csv" -version = "0.1.0" +version = "0.1.1" scope = "testOnly" dependencies = [ {org = "ballerina", name = "jballerina.java"} @@ -72,7 +72,7 @@ scope = "testOnly" [[package]] org = "ballerina" name = "parse_string_array_types_tests" -version = "0.1.0" +version = "0.1.1" dependencies = [ {org = "ballerina", name = "csv_commons"}, {org = "ballerina", name = "data.csv"}, diff --git a/ballerina-tests/parse-string-record-types-tests/Ballerina.toml b/ballerina-tests/parse-string-record-types-tests/Ballerina.toml index 795eb35..a037a40 100644 --- a/ballerina-tests/parse-string-record-types-tests/Ballerina.toml +++ b/ballerina-tests/parse-string-record-types-tests/Ballerina.toml @@ -1,15 +1,15 @@ [package] org = "ballerina" name = "parse_string_record_types_tests" -version = "0.1.0" +version = "0.1.1" [[dependency]] org = "ballerina" name = "csv_commons" repository = "local" -version = "0.1.0" +version = "0.1.1" -[platform.java17] +[platform.java21] graalvmCompatible = true [build-options] diff --git a/ballerina-tests/parse-string-record-types-tests/Dependencies.toml b/ballerina-tests/parse-string-record-types-tests/Dependencies.toml index 0714f9a..a407418 100644 --- a/ballerina-tests/parse-string-record-types-tests/Dependencies.toml +++ b/ballerina-tests/parse-string-record-types-tests/Dependencies.toml @@ -5,12 +5,12 @@ [ballerina] dependencies-toml-version = "2" -distribution-version = "2201.10.0" +distribution-version = "2201.11.0-20241117-133400-a3054b77" [[package]] org = "ballerina" name = "csv_commons" -version = "0.1.0" +version = "0.1.1" scope = "testOnly" modules = [ {org = "ballerina", packageName = "csv_commons", moduleName = "csv_commons"} @@ -19,7 +19,7 @@ modules = [ [[package]] org = "ballerina" name = "data.csv" -version = "0.1.0" +version = "0.1.1" scope = "testOnly" dependencies = [ {org = "ballerina", name = "jballerina.java"} @@ -72,7 +72,7 @@ scope = "testOnly" [[package]] org = "ballerina" name = "parse_string_record_types_tests" -version = "0.1.0" +version = "0.1.1" dependencies = [ {org = "ballerina", name = "csv_commons"}, {org = "ballerina", name = "data.csv"}, diff --git a/ballerina-tests/type-compatible-tests/Ballerina.toml b/ballerina-tests/type-compatible-tests/Ballerina.toml index d7661d9..73958e2 100644 --- a/ballerina-tests/type-compatible-tests/Ballerina.toml +++ b/ballerina-tests/type-compatible-tests/Ballerina.toml @@ -1,15 +1,15 @@ [package] org = "ballerina" name = "type_compatible_tests" -version = "0.1.0" +version = "0.1.1" [[dependency]] org = "ballerina" name = "csv_commons" repository = "local" -version = "0.1.0" +version = "0.1.1" -[platform.java17] +[platform.java21] graalvmCompatible = true [build-options] diff --git a/ballerina-tests/type-compatible-tests/Dependencies.toml b/ballerina-tests/type-compatible-tests/Dependencies.toml index adb9d3a..cb7c1e6 100644 --- a/ballerina-tests/type-compatible-tests/Dependencies.toml +++ b/ballerina-tests/type-compatible-tests/Dependencies.toml @@ -5,12 +5,12 @@ [ballerina] dependencies-toml-version = "2" -distribution-version = "2201.10.0" +distribution-version = "2201.11.0-20241117-133400-a3054b77" [[package]] org = "ballerina" name = "csv_commons" -version = "0.1.0" +version = "0.1.1" scope = "testOnly" modules = [ {org = "ballerina", packageName = "csv_commons", moduleName = "csv_commons"} @@ -19,7 +19,7 @@ modules = [ [[package]] org = "ballerina" name = "data.csv" -version = "0.1.0" +version = "0.1.1" scope = "testOnly" dependencies = [ {org = "ballerina", name = "jballerina.java"} @@ -31,7 +31,7 @@ modules = [ [[package]] org = "ballerina" name = "io" -version = "1.6.1" +version = "1.6.2" scope = "testOnly" dependencies = [ {org = "ballerina", name = "jballerina.java"}, @@ -108,7 +108,7 @@ modules = [ [[package]] org = "ballerina" name = "type_compatible_tests" -version = "0.1.0" +version = "0.1.1" dependencies = [ {org = "ballerina", name = "csv_commons"}, {org = "ballerina", name = "data.csv"}, diff --git a/ballerina-tests/unicode-tests/Ballerina.toml b/ballerina-tests/unicode-tests/Ballerina.toml index a2cadc0..a83df77 100644 --- a/ballerina-tests/unicode-tests/Ballerina.toml +++ b/ballerina-tests/unicode-tests/Ballerina.toml @@ -1,15 +1,15 @@ [package] org = "ballerina" name = "unicode_tests" -version = "0.1.0" +version = "0.1.1" [[dependency]] org = "ballerina" name = "csv_commons" repository = "local" -version = "0.1.0" +version = "0.1.1" -[platform.java17] +[platform.java21] graalvmCompatible = true [build-options] diff --git a/ballerina-tests/unicode-tests/Dependencies.toml b/ballerina-tests/unicode-tests/Dependencies.toml index 9d8e82b..7409c61 100644 --- a/ballerina-tests/unicode-tests/Dependencies.toml +++ b/ballerina-tests/unicode-tests/Dependencies.toml @@ -5,12 +5,12 @@ [ballerina] dependencies-toml-version = "2" -distribution-version = "2201.10.0" +distribution-version = "2201.11.0-20241117-133400-a3054b77" [[package]] org = "ballerina" name = "data.csv" -version = "0.1.0" +version = "0.1.1" scope = "testOnly" dependencies = [ {org = "ballerina", name = "jballerina.java"} @@ -77,7 +77,7 @@ modules = [ [[package]] org = "ballerina" name = "unicode_tests" -version = "0.1.0" +version = "0.1.1" dependencies = [ {org = "ballerina", name = "data.csv"}, {org = "ballerina", name = "test"} diff --git a/ballerina-tests/union-type-tests/Ballerina.toml b/ballerina-tests/union-type-tests/Ballerina.toml index 66da3f7..78d9cc8 100644 --- a/ballerina-tests/union-type-tests/Ballerina.toml +++ b/ballerina-tests/union-type-tests/Ballerina.toml @@ -1,15 +1,15 @@ [package] org = "ballerina" name = "union_type_tests" -version = "0.1.0" +version = "0.1.1" [[dependency]] org = "ballerina" name = "csv_commons" repository = "local" -version = "0.1.0" +version = "0.1.1" -[platform.java17] +[platform.java21] graalvmCompatible = true [build-options] diff --git a/ballerina-tests/union-type-tests/Dependencies.toml b/ballerina-tests/union-type-tests/Dependencies.toml index 8ab953e..067af5f 100644 --- a/ballerina-tests/union-type-tests/Dependencies.toml +++ b/ballerina-tests/union-type-tests/Dependencies.toml @@ -5,12 +5,12 @@ [ballerina] dependencies-toml-version = "2" -distribution-version = "2201.10.0" +distribution-version = "2201.11.0-20241117-133400-a3054b77" [[package]] org = "ballerina" name = "csv_commons" -version = "0.1.0" +version = "0.1.1" scope = "testOnly" modules = [ {org = "ballerina", packageName = "csv_commons", moduleName = "csv_commons"} @@ -19,7 +19,7 @@ modules = [ [[package]] org = "ballerina" name = "data.csv" -version = "0.1.0" +version = "0.1.1" scope = "testOnly" dependencies = [ {org = "ballerina", name = "jballerina.java"} @@ -86,7 +86,7 @@ modules = [ [[package]] org = "ballerina" name = "union_type_tests" -version = "0.1.0" +version = "0.1.1" dependencies = [ {org = "ballerina", name = "csv_commons"}, {org = "ballerina", name = "data.csv"}, diff --git a/ballerina-tests/user-config-tests/Ballerina.toml b/ballerina-tests/user-config-tests/Ballerina.toml index 7810c0a..2c89a7e 100644 --- a/ballerina-tests/user-config-tests/Ballerina.toml +++ b/ballerina-tests/user-config-tests/Ballerina.toml @@ -1,15 +1,15 @@ [package] org = "ballerina" name = "user_config_tests" -version = "0.1.0" +version = "0.1.1" [[dependency]] org = "ballerina" name = "csv_commons" repository = "local" -version = "0.1.0" +version = "0.1.1" -[platform.java17] +[platform.java21] graalvmCompatible = true [build-options] diff --git a/ballerina-tests/user-config-tests/Dependencies.toml b/ballerina-tests/user-config-tests/Dependencies.toml index 590aef2..979691d 100644 --- a/ballerina-tests/user-config-tests/Dependencies.toml +++ b/ballerina-tests/user-config-tests/Dependencies.toml @@ -5,12 +5,12 @@ [ballerina] dependencies-toml-version = "2" -distribution-version = "2201.10.0" +distribution-version = "2201.11.0-20241117-133400-a3054b77" [[package]] org = "ballerina" name = "csv_commons" -version = "0.1.0" +version = "0.1.1" scope = "testOnly" modules = [ {org = "ballerina", packageName = "csv_commons", moduleName = "csv_commons"} @@ -19,7 +19,7 @@ modules = [ [[package]] org = "ballerina" name = "data.csv" -version = "0.1.0" +version = "0.1.1" scope = "testOnly" dependencies = [ {org = "ballerina", name = "jballerina.java"} @@ -86,7 +86,7 @@ modules = [ [[package]] org = "ballerina" name = "user_config_tests" -version = "0.1.0" +version = "0.1.1" dependencies = [ {org = "ballerina", name = "csv_commons"}, {org = "ballerina", name = "data.csv"}, diff --git a/ballerina/Ballerina.toml b/ballerina/Ballerina.toml index 1aa9516..1c0c8f9 100644 --- a/ballerina/Ballerina.toml +++ b/ballerina/Ballerina.toml @@ -1,26 +1,26 @@ [package] org = "ballerina" name = "data.csv" -version = "0.1.0" +version = "0.1.1" authors = ["Ballerina"] keywords = ["csv"] repository = "https://github.com/ballerina-platform/module-ballerina-data.csv" license = ["Apache-2.0"] -distribution = "2201.9.0" +distribution = "2201.11.0-20241117-133400-a3054b77" export = ["data.csv"] readme = "Package.md" -[platform.java17] +[platform.java21] graalvmCompatible = true -[[platform.java17.dependency]] +[[platform.java21.dependency]] groupId = "io.ballerina.lib" artifactId = "data.csv-native" -version = "0.1.0" -path = "../native/build/libs/data.csv-native-0.1.0.jar" +version = "0.1.1" +path = "../native/build/libs/data.csv-native-0.1.1-SNAPSHOT.jar" -[[platform.java17.dependency]] +[[platform.java21.dependency]] groupId = "io.ballerina.stdlib" artifactId = "constraint-native" -version = "1.5.0" -path = "./lib/constraint-native-1.5.0.jar" +version = "1.6.0" +path = "./lib/constraint-native-1.6.0-20241113-090900-d276ad5.jar" diff --git a/ballerina/CompilerPlugin.toml b/ballerina/CompilerPlugin.toml index beabd70..ed30d28 100644 --- a/ballerina/CompilerPlugin.toml +++ b/ballerina/CompilerPlugin.toml @@ -3,4 +3,4 @@ id = "data.csv-compiler-plugin" class = "io.ballerina.lib.data.csvdata.compiler.CsvDataCompilerPlugin" [[dependency]] -path = "../compiler-plugin/build/libs/data.csv-compiler-plugin-0.1.0.jar" +path = "../compiler-plugin/build/libs/data.csv-compiler-plugin-0.1.1-SNAPSHOT.jar" diff --git a/ballerina/Dependencies.toml b/ballerina/Dependencies.toml index 61e4fbe..343d070 100644 --- a/ballerina/Dependencies.toml +++ b/ballerina/Dependencies.toml @@ -5,12 +5,12 @@ [ballerina] dependencies-toml-version = "2" -distribution-version = "2201.10.0" +distribution-version = "2201.11.0-20241117-133400-a3054b77" [[package]] org = "ballerina" name = "data.csv" -version = "0.1.0" +version = "0.1.1" dependencies = [ {org = "ballerina", name = "jballerina.java"} ] diff --git a/build-config/resources/Ballerina.toml b/build-config/resources/Ballerina.toml index d846308..919f4b6 100644 --- a/build-config/resources/Ballerina.toml +++ b/build-config/resources/Ballerina.toml @@ -6,20 +6,20 @@ authors = ["Ballerina"] keywords = ["csv"] repository = "https://github.com/ballerina-platform/module-ballerina-data.csv" license = ["Apache-2.0"] -distribution = "2201.9.0" +distribution = "2201.11.0-20241117-133400-a3054b77" export = ["data.csv"] readme = "Package.md" -[platform.java17] +[platform.java21] graalvmCompatible = true -[[platform.java17.dependency]] +[[platform.java21.dependency]] groupId = "io.ballerina.lib" artifactId = "data.csv-native" version = "@toml.version@" path = "../native/build/libs/data.csv-native-@project.version@.jar" -[[platform.java17.dependency]] +[[platform.java21.dependency]] groupId = "io.ballerina.stdlib" artifactId = "constraint-native" version = "@constraint.version@" diff --git a/build-config/resources/BallerinaTest.toml b/build-config/resources/BallerinaTest.toml index 5b44930..9234a3b 100644 --- a/build-config/resources/BallerinaTest.toml +++ b/build-config/resources/BallerinaTest.toml @@ -9,7 +9,7 @@ name = "@test.common@" repository = "local" version = "@toml.version@" -[platform.java17] +[platform.java21] graalvmCompatible = true [build-options] diff --git a/compiler-plugin-test/build.gradle b/compiler-plugin-test/build.gradle index 1ad7000..4c76cd2 100644 --- a/compiler-plugin-test/build.gradle +++ b/compiler-plugin-test/build.gradle @@ -49,8 +49,11 @@ checkstyle { checkstyleTest.dependsOn(":checkstyle:downloadCheckstyleRuleFiles") spotbugsTest { - effort "max" - reportLevel "low" + def classLoader = plugins["com.github.spotbugs"].class.classLoader + def SpotBugsConfidence = classLoader.findLoadedClass("com.github.spotbugs.snom.Confidence") + def SpotBugsEffort = classLoader.findLoadedClass("com.github.spotbugs.snom.Effort") + effort = SpotBugsEffort.MAX + reportLevel = SpotBugsConfidence.LOW reportsDir = file("$project.buildDir/reports/spotbugs") reports { html.enabled true diff --git a/compiler-plugin/build.gradle b/compiler-plugin/build.gradle index f30d515..fc3c673 100644 --- a/compiler-plugin/build.gradle +++ b/compiler-plugin/build.gradle @@ -47,8 +47,11 @@ checkstyle { checkstyleMain.dependsOn(":checkstyle:downloadCheckstyleRuleFiles") spotbugsMain { - effort "max" - reportLevel "low" + def classLoader = plugins["com.github.spotbugs"].class.classLoader + def SpotBugsConfidence = classLoader.findLoadedClass("com.github.spotbugs.snom.Confidence") + def SpotBugsEffort = classLoader.findLoadedClass("com.github.spotbugs.snom.Effort") + effort = SpotBugsEffort.MAX + reportLevel = SpotBugsConfidence.LOW reportsDir = file("$project.buildDir/reports/spotbugs") reports { html.enabled true diff --git a/gradle.properties b/gradle.properties index 76ad3b0..18f6d14 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,14 +1,14 @@ org.gradle.caching=true group=io.ballerina.lib version=0.1.1-SNAPSHOT -ballerinaLangVersion=2201.10.0 +ballerinaLangVersion=2201.11.0-20241117-133400-a3054b77 ballerinaTomlParserVersion=1.2.2 checkstyleToolVersion=10.12.0 puppycrawlCheckstyleVersion=10.12.0 testngVersion=7.6.1 slf4jVersion=2.0.7 -spotbugsVersion=5.0.14 +spotbugsVersion=6.0.18 shadowJarPluginVersion=8.1.1 downloadPluginVersion=4.0.4 releasePluginVersion=2.8.0 @@ -17,8 +17,8 @@ javaJsonPathVersion=2.9.0 javaJsonSmartVersion=2.4.11 javaAccessorsSmartVersion=2.4.7 -stdlibFileVersion=1.9.0 -stdlibIoVersion=1.6.0 -stdlibOsVersion=1.8.0 -stdlibTimeVersion=2.4.0 -stdlibConstraintVersion=1.5.0 +stdlibFileVersion=1.10.1-20241113-151700-e1a2e38 +stdlibIoVersion=1.6.2-20241112-233100-995cf5f +stdlibOsVersion=1.8.1-20241113-122000-cca973b +stdlibTimeVersion=2.6.0-20241113-073800-201b904 +stdlibConstraintVersion=1.6.0-20241113-090900-d276ad5 diff --git a/native/build.gradle b/native/build.gradle index 2fef0f3..1cb0ec1 100644 --- a/native/build.gradle +++ b/native/build.gradle @@ -50,9 +50,12 @@ tasks.withType(Checkstyle) { } spotbugsMain { + def classLoader = plugins["com.github.spotbugs"].class.classLoader + def SpotBugsConfidence = classLoader.findLoadedClass("com.github.spotbugs.snom.Confidence") + def SpotBugsEffort = classLoader.findLoadedClass("com.github.spotbugs.snom.Effort") + effort = SpotBugsEffort.MAX + reportLevel = SpotBugsConfidence.LOW enabled=false - effort "max" - reportLevel "low" reportsDir = file("$project.buildDir/reports/spotbugs") reports { html.enabled true diff --git a/native/src/main/java/io/ballerina/lib/data/csvdata/FromString.java b/native/src/main/java/io/ballerina/lib/data/csvdata/FromString.java index c831bf9..9fb6fb4 100644 --- a/native/src/main/java/io/ballerina/lib/data/csvdata/FromString.java +++ b/native/src/main/java/io/ballerina/lib/data/csvdata/FromString.java @@ -21,15 +21,15 @@ import io.ballerina.lib.data.csvdata.utils.Constants; import io.ballerina.lib.data.csvdata.utils.CsvConfig; import io.ballerina.lib.data.csvdata.utils.CsvUtils; -import io.ballerina.runtime.api.PredefinedTypes; -import io.ballerina.runtime.api.TypeTags; import io.ballerina.runtime.api.creators.ErrorCreator; import io.ballerina.runtime.api.creators.TypeCreator; import io.ballerina.runtime.api.creators.ValueCreator; import io.ballerina.runtime.api.types.FiniteType; import io.ballerina.runtime.api.types.IntersectionType; +import io.ballerina.runtime.api.types.PredefinedTypes; import io.ballerina.runtime.api.types.ReferenceType; import io.ballerina.runtime.api.types.Type; +import io.ballerina.runtime.api.types.TypeTags; import io.ballerina.runtime.api.types.UnionType; import io.ballerina.runtime.api.utils.StringUtils; import io.ballerina.runtime.api.utils.TypeUtils; diff --git a/native/src/main/java/io/ballerina/lib/data/csvdata/csv/CsvCreator.java b/native/src/main/java/io/ballerina/lib/data/csvdata/csv/CsvCreator.java index 7411e3e..23e35aa 100644 --- a/native/src/main/java/io/ballerina/lib/data/csvdata/csv/CsvCreator.java +++ b/native/src/main/java/io/ballerina/lib/data/csvdata/csv/CsvCreator.java @@ -23,15 +23,15 @@ import io.ballerina.lib.data.csvdata.utils.CsvUtils; import io.ballerina.lib.data.csvdata.utils.DiagnosticErrorCode; import io.ballerina.lib.data.csvdata.utils.DiagnosticLog; -import io.ballerina.runtime.api.PredefinedTypes; -import io.ballerina.runtime.api.TypeTags; import io.ballerina.runtime.api.creators.ValueCreator; import io.ballerina.runtime.api.flags.SymbolFlags; import io.ballerina.runtime.api.types.ArrayType; import io.ballerina.runtime.api.types.Field; import io.ballerina.runtime.api.types.MapType; +import io.ballerina.runtime.api.types.PredefinedTypes; import io.ballerina.runtime.api.types.TupleType; import io.ballerina.runtime.api.types.Type; +import io.ballerina.runtime.api.types.TypeTags; import io.ballerina.runtime.api.utils.StringUtils; import io.ballerina.runtime.api.utils.TypeUtils; import io.ballerina.runtime.api.values.BArray; diff --git a/native/src/main/java/io/ballerina/lib/data/csvdata/csv/CsvParser.java b/native/src/main/java/io/ballerina/lib/data/csvdata/csv/CsvParser.java index 1f9f650..0566cbc 100644 --- a/native/src/main/java/io/ballerina/lib/data/csvdata/csv/CsvParser.java +++ b/native/src/main/java/io/ballerina/lib/data/csvdata/csv/CsvParser.java @@ -24,8 +24,6 @@ import io.ballerina.lib.data.csvdata.utils.DataUtils; import io.ballerina.lib.data.csvdata.utils.DiagnosticErrorCode; import io.ballerina.lib.data.csvdata.utils.DiagnosticLog; -import io.ballerina.runtime.api.PredefinedTypes; -import io.ballerina.runtime.api.TypeTags; import io.ballerina.runtime.api.creators.TypeCreator; import io.ballerina.runtime.api.creators.ValueCreator; import io.ballerina.runtime.api.flags.SymbolFlags; @@ -33,9 +31,11 @@ import io.ballerina.runtime.api.types.Field; import io.ballerina.runtime.api.types.IntersectionType; import io.ballerina.runtime.api.types.MapType; +import io.ballerina.runtime.api.types.PredefinedTypes; import io.ballerina.runtime.api.types.RecordType; import io.ballerina.runtime.api.types.TupleType; import io.ballerina.runtime.api.types.Type; +import io.ballerina.runtime.api.types.TypeTags; import io.ballerina.runtime.api.utils.TypeUtils; import io.ballerina.runtime.api.values.BArray; import io.ballerina.runtime.api.values.BError; diff --git a/native/src/main/java/io/ballerina/lib/data/csvdata/csv/CsvTraversal.java b/native/src/main/java/io/ballerina/lib/data/csvdata/csv/CsvTraversal.java index cc80b24..b60c016 100644 --- a/native/src/main/java/io/ballerina/lib/data/csvdata/csv/CsvTraversal.java +++ b/native/src/main/java/io/ballerina/lib/data/csvdata/csv/CsvTraversal.java @@ -23,8 +23,6 @@ import io.ballerina.lib.data.csvdata.utils.DataUtils; import io.ballerina.lib.data.csvdata.utils.DiagnosticErrorCode; import io.ballerina.lib.data.csvdata.utils.DiagnosticLog; -import io.ballerina.runtime.api.PredefinedTypes; -import io.ballerina.runtime.api.TypeTags; import io.ballerina.runtime.api.creators.TypeCreator; import io.ballerina.runtime.api.creators.ValueCreator; import io.ballerina.runtime.api.flags.SymbolFlags; @@ -32,9 +30,11 @@ import io.ballerina.runtime.api.types.Field; import io.ballerina.runtime.api.types.IntersectionType; import io.ballerina.runtime.api.types.MapType; +import io.ballerina.runtime.api.types.PredefinedTypes; import io.ballerina.runtime.api.types.RecordType; import io.ballerina.runtime.api.types.TupleType; import io.ballerina.runtime.api.types.Type; +import io.ballerina.runtime.api.types.TypeTags; import io.ballerina.runtime.api.types.UnionType; import io.ballerina.runtime.api.utils.StringUtils; import io.ballerina.runtime.api.utils.TypeUtils; diff --git a/native/src/main/java/io/ballerina/lib/data/csvdata/csv/Native.java b/native/src/main/java/io/ballerina/lib/data/csvdata/csv/Native.java index 619e01d..0144e11 100644 --- a/native/src/main/java/io/ballerina/lib/data/csvdata/csv/Native.java +++ b/native/src/main/java/io/ballerina/lib/data/csvdata/csv/Native.java @@ -19,13 +19,11 @@ package io.ballerina.lib.data.csvdata.csv; import io.ballerina.lib.data.csvdata.io.DataReaderTask; -import io.ballerina.lib.data.csvdata.io.DataReaderThreadPool; import io.ballerina.lib.data.csvdata.utils.Constants; import io.ballerina.lib.data.csvdata.utils.CsvConfig; import io.ballerina.lib.data.csvdata.utils.DiagnosticErrorCode; import io.ballerina.lib.data.csvdata.utils.DiagnosticLog; import io.ballerina.runtime.api.Environment; -import io.ballerina.runtime.api.Future; import io.ballerina.runtime.api.values.BArray; import io.ballerina.runtime.api.values.BError; import io.ballerina.runtime.api.values.BMap; @@ -38,6 +36,8 @@ import java.io.InputStreamReader; import java.io.StringReader; import java.nio.charset.Charset; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; /** * Csv conversion. @@ -76,12 +76,18 @@ public static Object parseStream(Environment env, BStream csv, BMap options, BTypedesc type) { try { final BObject iteratorObj = csv.getIteratorObj(); - final Future future = env.markAsync(); - DataReaderTask task = new DataReaderTask(env, iteratorObj, future, type, - CsvConfig.createParseOptions(options), - options.getStringValue(Constants.ConfigConstants.ENCODING)); - DataReaderThreadPool.EXECUTOR_SERVICE.submit(task); - return null; + return env.yieldAndRun(() -> { + CompletableFuture future = new CompletableFuture<>(); + DataReaderTask task = new DataReaderTask(env, iteratorObj, future, type, + CsvConfig.createParseOptions(options), + options.getStringValue(Constants.ConfigConstants.ENCODING)); + Thread.startVirtualThread(task); + try { + return future.get(); + } catch (BError | InterruptedException | ExecutionException bError) { + return bError; + } + }); } catch (BError e) { return e; } catch (Exception e) { diff --git a/native/src/main/java/io/ballerina/lib/data/csvdata/io/BallerinaByteBlockInputStream.java b/native/src/main/java/io/ballerina/lib/data/csvdata/io/BallerinaByteBlockInputStream.java index 63c3945..eb86722 100644 --- a/native/src/main/java/io/ballerina/lib/data/csvdata/io/BallerinaByteBlockInputStream.java +++ b/native/src/main/java/io/ballerina/lib/data/csvdata/io/BallerinaByteBlockInputStream.java @@ -20,10 +20,7 @@ import io.ballerina.lib.data.csvdata.utils.DiagnosticLog; import io.ballerina.runtime.api.Environment; -import io.ballerina.runtime.api.async.Callback; -import io.ballerina.runtime.api.async.StrandMetadata; import io.ballerina.runtime.api.types.MethodType; -import io.ballerina.runtime.api.types.Type; import io.ballerina.runtime.api.values.BArray; import io.ballerina.runtime.api.values.BError; import io.ballerina.runtime.api.values.BMap; @@ -33,8 +30,6 @@ import java.io.IOException; import java.io.InputStream; import java.util.Arrays; -import java.util.Map; -import java.util.concurrent.Semaphore; import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Consumer; @@ -48,10 +43,6 @@ public class BallerinaByteBlockInputStream extends InputStream { private final BObject iterator; private final Environment env; private final String nextMethodName; - private final Type returnType; - private final String strandName; - private final StrandMetadata metadata; - private final Map properties; private final AtomicBoolean done = new AtomicBoolean(false); private final MethodType closeMethod; private final Consumer futureResultConsumer; @@ -64,11 +55,7 @@ public BallerinaByteBlockInputStream(Environment env, BObject iterator, MethodTy this.env = env; this.iterator = iterator; this.nextMethodName = nextMethod.getName(); - this.returnType = nextMethod.getReturnType(); this.closeMethod = closeMethod; - this.strandName = env.getStrandName().orElse(""); - this.metadata = env.getStrandMetadata(); - this.properties = Map.of(); this.futureResultConsumer = futureResultConsumer; } @@ -97,25 +84,8 @@ public int read() { @Override public void close() throws IOException { super.close(); - Semaphore semaphore = new Semaphore(0); if (closeMethod != null) { - env.getRuntime().invokeMethodAsyncSequentially(iterator, closeMethod.getName(), strandName, metadata, - new Callback() { - @Override - public void notifyFailure(BError bError) { - semaphore.release(); - } - - @Override - public void notifySuccess(Object result) { - semaphore.release(); - } - }, properties, returnType); - } - try { - semaphore.acquire(); - } catch (InterruptedException e) { - throw new IOException("Error while closing the stream", e); + env.getRuntime().callMethod(iterator, closeMethod.getName(), null); } } @@ -124,43 +94,28 @@ private boolean hasBytesInCurrentChunk() { } private boolean readNextChunk() throws InterruptedException { - Semaphore semaphore = new Semaphore(0); - Callback callback = new Callback() { - - @Override - public void notifyFailure(BError bError) { - // Panic with an error + try { + Object result = env.getRuntime().callMethod(iterator, nextMethodName, null); + if (result == null) { done.set(true); - futureResultConsumer.accept(bError); currentChunk = new byte[0]; - semaphore.release(); + return !done.get(); } - - @Override - public void notifySuccess(Object result) { - if (result == null) { - done.set(true); - currentChunk = new byte[0]; - semaphore.release(); - return; - } - if (result instanceof BMap) { - BMap valueRecord = (BMap) result; - final BString value = Arrays.stream(valueRecord.getKeys()).findFirst().get(); - final BArray arrayValue = valueRecord.getArrayValue(value); - currentChunk = arrayValue.getByteArray(); - semaphore.release(); - } else { - // Case where Completes with an error - done.set(true); - semaphore.release(); - } + if (result instanceof BMap) { + BMap valueRecord = (BMap) result; + final BString value = Arrays.stream(valueRecord.getKeys()).findFirst().get(); + final BArray arrayValue = valueRecord.getArrayValue(value); + currentChunk = arrayValue.getByteArray(); + } else { + // Case where Completes with an error + done.set(true); } - - }; - env.getRuntime().invokeMethodAsyncSequentially(iterator, nextMethodName, strandName, metadata, callback, - properties, returnType); - semaphore.acquire(); + } catch (BError bError) { + // Panic with an error + done.set(true); + futureResultConsumer.accept(bError); + currentChunk = new byte[0]; + } return !done.get(); } } diff --git a/native/src/main/java/io/ballerina/lib/data/csvdata/io/DataReaderTask.java b/native/src/main/java/io/ballerina/lib/data/csvdata/io/DataReaderTask.java index b4186bf..45741c3 100644 --- a/native/src/main/java/io/ballerina/lib/data/csvdata/io/DataReaderTask.java +++ b/native/src/main/java/io/ballerina/lib/data/csvdata/io/DataReaderTask.java @@ -21,7 +21,6 @@ import io.ballerina.lib.data.csvdata.utils.CsvConfig; import io.ballerina.lib.data.csvdata.utils.DiagnosticLog; import io.ballerina.runtime.api.Environment; -import io.ballerina.runtime.api.Future; import io.ballerina.runtime.api.types.MethodType; import io.ballerina.runtime.api.types.ObjectType; import io.ballerina.runtime.api.utils.TypeUtils; @@ -31,6 +30,7 @@ import java.io.InputStreamReader; import java.nio.charset.Charset; +import java.util.concurrent.CompletableFuture; import java.util.function.Consumer; /** @@ -45,12 +45,12 @@ public class DataReaderTask implements Runnable { private final Environment env; private final BObject iteratorObj; - private final Future future; + private final CompletableFuture future; private final BTypedesc typed; private final CsvConfig config; private final BString encoding; - public DataReaderTask(Environment env, BObject iteratorObj, Future future, BTypedesc typed, + public DataReaderTask(Environment env, BObject iteratorObj, CompletableFuture future, BTypedesc typed, CsvConfig config, BString encoding) { this.env = env; this.iteratorObj = iteratorObj; @@ -105,7 +105,7 @@ public void run() { * @param future The future to complete * @since 0.1.0 */ - public record ResultConsumer(Future future) implements Consumer { + public record ResultConsumer(CompletableFuture future) implements Consumer { @Override public void accept(T t) { diff --git a/native/src/main/java/io/ballerina/lib/data/csvdata/io/DataReaderThreadPool.java b/native/src/main/java/io/ballerina/lib/data/csvdata/io/DataReaderThreadPool.java deleted file mode 100644 index 379a6e3..0000000 --- a/native/src/main/java/io/ballerina/lib/data/csvdata/io/DataReaderThreadPool.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package io.ballerina.lib.data.csvdata.io; - -import java.util.concurrent.ExecutorService; -import java.util.concurrent.SynchronousQueue; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicLong; - -/** - * Thread pool for data reader. - * - * @since 0.1.0 - */ -public final class DataReaderThreadPool { - private static final int CORE_POOL_SIZE = 0; - private static final int MAX_POOL_SIZE = 50; - private static final long KEEP_ALIVE_TIME = 60L; - private static final String THREAD_NAME = "bal-data-csv-thread"; - private static final AtomicLong THREAD_ID = new AtomicLong(1); - public static final ExecutorService EXECUTOR_SERVICE = new ThreadPoolExecutor(CORE_POOL_SIZE, - MAX_POOL_SIZE, KEEP_ALIVE_TIME, TimeUnit.SECONDS, new SynchronousQueue<>(), new DataThreadFactory()); - - private DataReaderThreadPool() { - } - - /** - * Thread factory for data reader. - */ - static class DataThreadFactory implements ThreadFactory { - - @Override - public Thread newThread(Runnable runnable) { - Thread ballerinaData = new Thread(runnable); - ballerinaData.setName(THREAD_NAME + "-" + THREAD_ID.getAndIncrement()); - return ballerinaData; - } - } -} diff --git a/native/src/main/java/io/ballerina/lib/data/csvdata/utils/CsvUtils.java b/native/src/main/java/io/ballerina/lib/data/csvdata/utils/CsvUtils.java index 73f8dc1..06b3240 100644 --- a/native/src/main/java/io/ballerina/lib/data/csvdata/utils/CsvUtils.java +++ b/native/src/main/java/io/ballerina/lib/data/csvdata/utils/CsvUtils.java @@ -1,6 +1,5 @@ package io.ballerina.lib.data.csvdata.utils; -import io.ballerina.runtime.api.TypeTags; import io.ballerina.runtime.api.flags.SymbolFlags; import io.ballerina.runtime.api.types.ArrayType; import io.ballerina.runtime.api.types.Field; @@ -8,6 +7,7 @@ import io.ballerina.runtime.api.types.RecordType; import io.ballerina.runtime.api.types.TupleType; import io.ballerina.runtime.api.types.Type; +import io.ballerina.runtime.api.types.TypeTags; import io.ballerina.runtime.api.utils.StringUtils; import io.ballerina.runtime.api.utils.TypeUtils; import io.ballerina.runtime.api.utils.ValueUtils;