From 737b0fe9bbaadc07655b9129604dea8d1dc1a02f Mon Sep 17 00:00:00 2001 From: vil02 Date: Sun, 15 Oct 2023 19:49:01 +0200 Subject: [PATCH 1/2] [Automated] Update the native jar versions --- ballerina/Ballerina.toml | 6 +++--- ballerina/CompilerPlugin.toml | 2 +- ballerina/Dependencies.toml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ballerina/Ballerina.toml b/ballerina/Ballerina.toml index 5aeaea1..2da792d 100644 --- a/ballerina/Ballerina.toml +++ b/ballerina/Ballerina.toml @@ -1,7 +1,7 @@ [package] org = "ballerina" name = "constraint" -version = "1.4.0" +version = "1.4.1" authors = ["Ballerina"] keywords = ["constraint", "validation"] repository = "https://github.com/ballerina-platform/module-ballerina-constraint" @@ -15,5 +15,5 @@ graalvmCompatible = true [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" artifactId = "constraint-native" -version = "1.4.0" -path = "../native/build/libs/constraint-native-1.4.0.jar" +version = "1.4.1" +path = "../native/build/libs/constraint-native-1.4.1-SNAPSHOT.jar" diff --git a/ballerina/CompilerPlugin.toml b/ballerina/CompilerPlugin.toml index 680437f..5d3e693 100644 --- a/ballerina/CompilerPlugin.toml +++ b/ballerina/CompilerPlugin.toml @@ -3,4 +3,4 @@ id = "constraint-compiler-plugin" class = "io.ballerina.stdlib.constraint.compiler.ConstraintCompilerPlugin" [[dependency]] -path = "../compiler-plugin/build/libs/constraint-compiler-plugin-1.4.0.jar" +path = "../compiler-plugin/build/libs/constraint-compiler-plugin-1.4.1-SNAPSHOT.jar" diff --git a/ballerina/Dependencies.toml b/ballerina/Dependencies.toml index b731daf..eb323ed 100644 --- a/ballerina/Dependencies.toml +++ b/ballerina/Dependencies.toml @@ -10,7 +10,7 @@ distribution-version = "2201.8.0" [[package]] org = "ballerina" name = "constraint" -version = "1.4.0" +version = "1.4.1" dependencies = [ {org = "ballerina", name = "jballerina.java"}, {org = "ballerina", name = "test"}, From 3439afd122d09053b9acb6c5728e5990d7d1e93c Mon Sep 17 00:00:00 2001 From: vil02 Date: Sun, 15 Oct 2023 19:52:27 +0200 Subject: [PATCH 2/2] Make some Java classes proper utilities Made the design cleaner by marking Java classes as `final` and explicitly declaring their default constructors as `private`. This change makes the code coverage reports more accurate. Closes #4929. --- changelog.md | 5 +++++ .../constraint/compiler/CompilerPluginTestConstants.java | 4 +++- .../stdlib/constraint/compiler/CompilerPluginTestUtils.java | 4 +++- .../io/ballerina/stdlib/constraint/compiler/Constants.java | 4 +++- .../constraint/compiler/ConstraintCompilerPluginUtils.java | 4 +++- .../main/java/io/ballerina/stdlib/constraint/Constants.java | 4 +++- .../main/java/io/ballerina/stdlib/constraint/ErrorUtils.java | 4 +++- 7 files changed, 23 insertions(+), 6 deletions(-) diff --git a/changelog.md b/changelog.md index 1d5521a..8cf4eb4 100644 --- a/changelog.md +++ b/changelog.md @@ -3,6 +3,11 @@ This file contains all the notable changes done to the Ballerina Constraint pack The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Changed +- [Make some of the Java classes proper utility classes](https://github.com/ballerina-platform/ballerina-standard-library/issues/4929) + ## [1.2.0] - 2023-06-01 ### Added diff --git a/compiler-plugin-tests/src/test/java/io/ballerina/stdlib/constraint/compiler/CompilerPluginTestConstants.java b/compiler-plugin-tests/src/test/java/io/ballerina/stdlib/constraint/compiler/CompilerPluginTestConstants.java index c214e8a..6b56048 100644 --- a/compiler-plugin-tests/src/test/java/io/ballerina/stdlib/constraint/compiler/CompilerPluginTestConstants.java +++ b/compiler-plugin-tests/src/test/java/io/ballerina/stdlib/constraint/compiler/CompilerPluginTestConstants.java @@ -21,7 +21,9 @@ /** * The constants related to compiler plugin tests. */ -public class CompilerPluginTestConstants { +public final class CompilerPluginTestConstants { + + private CompilerPluginTestConstants() {} static final String ANNOTATION_TAG_INT = "Int"; static final String ANNOTATION_TAG_FLOAT = "Float"; diff --git a/compiler-plugin-tests/src/test/java/io/ballerina/stdlib/constraint/compiler/CompilerPluginTestUtils.java b/compiler-plugin-tests/src/test/java/io/ballerina/stdlib/constraint/compiler/CompilerPluginTestUtils.java index 3cdc58a..0c509a6 100644 --- a/compiler-plugin-tests/src/test/java/io/ballerina/stdlib/constraint/compiler/CompilerPluginTestUtils.java +++ b/compiler-plugin-tests/src/test/java/io/ballerina/stdlib/constraint/compiler/CompilerPluginTestUtils.java @@ -38,7 +38,9 @@ /** * Utility functions related to compiler plugins tests. */ -public class CompilerPluginTestUtils { +public final class CompilerPluginTestUtils { + + private CompilerPluginTestUtils() {} private static final Path RESOURCE_DIRECTORY = Paths.get("src", "test", "resources", "ballerina_sources") .toAbsolutePath(); diff --git a/compiler-plugin/src/main/java/io/ballerina/stdlib/constraint/compiler/Constants.java b/compiler-plugin/src/main/java/io/ballerina/stdlib/constraint/compiler/Constants.java index e451441..b450ac6 100644 --- a/compiler-plugin/src/main/java/io/ballerina/stdlib/constraint/compiler/Constants.java +++ b/compiler-plugin/src/main/java/io/ballerina/stdlib/constraint/compiler/Constants.java @@ -21,7 +21,9 @@ /** * The constants related to compiler plugin. */ -public class Constants { +public final class Constants { + + private Constants() {} public static final String PACKAGE_NAME = "ballerina"; public static final String MODULE_NAME = "constraint"; diff --git a/compiler-plugin/src/main/java/io/ballerina/stdlib/constraint/compiler/ConstraintCompilerPluginUtils.java b/compiler-plugin/src/main/java/io/ballerina/stdlib/constraint/compiler/ConstraintCompilerPluginUtils.java index c3bf7d8..6364c7e 100644 --- a/compiler-plugin/src/main/java/io/ballerina/stdlib/constraint/compiler/ConstraintCompilerPluginUtils.java +++ b/compiler-plugin/src/main/java/io/ballerina/stdlib/constraint/compiler/ConstraintCompilerPluginUtils.java @@ -51,7 +51,9 @@ /** * The compiler plugin utility functions. */ -public class ConstraintCompilerPluginUtils { +public final class ConstraintCompilerPluginUtils { + + private ConstraintCompilerPluginUtils() {} private static final ConstraintCompatibilityMatrix matrix = new ConstraintCompatibilityMatrix(); diff --git a/native/src/main/java/io/ballerina/stdlib/constraint/Constants.java b/native/src/main/java/io/ballerina/stdlib/constraint/Constants.java index 89407c5..dbfad47 100644 --- a/native/src/main/java/io/ballerina/stdlib/constraint/Constants.java +++ b/native/src/main/java/io/ballerina/stdlib/constraint/Constants.java @@ -24,7 +24,9 @@ /** * Constants related to constraint module. */ -public class Constants { +public final class Constants { + + private Constants() {} public static final String PREFIX_RECORD_FIELD = "$field$"; public static final String ANNOTATION_RECORD_REGEX = "^ballerina/constraint:[0-9]+:.+"; diff --git a/native/src/main/java/io/ballerina/stdlib/constraint/ErrorUtils.java b/native/src/main/java/io/ballerina/stdlib/constraint/ErrorUtils.java index ecff359..fd427c7 100644 --- a/native/src/main/java/io/ballerina/stdlib/constraint/ErrorUtils.java +++ b/native/src/main/java/io/ballerina/stdlib/constraint/ErrorUtils.java @@ -35,7 +35,9 @@ /** * Utility functions related to errors. */ -public class ErrorUtils { +public final class ErrorUtils { + + private ErrorUtils() {} private static final String UNEXPECTED_ERROR_MESSAGE = "Unexpected error found due to typedesc and value mismatch."; private static final String TYPE_CONVERSION_ERROR_MESSAGE = "Type conversion failed due to typedesc and value " +