From de1266d041f43dfa83991ed6778e52eacac3a09a Mon Sep 17 00:00:00 2001 From: vil02 Date: Sat, 14 Oct 2023 17:39:43 +0200 Subject: [PATCH 1/4] [Automated] Update the native jar versions --- ballerina-tests/Ballerina.toml | 4 ++-- ballerina-tests/Dependencies.toml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ballerina-tests/Ballerina.toml b/ballerina-tests/Ballerina.toml index c459b6c5..5672b49e 100644 --- a/ballerina-tests/Ballerina.toml +++ b/ballerina-tests/Ballerina.toml @@ -1,10 +1,10 @@ [package] org = "ballerina" name = "websub_tests" -version = "2.10.0" +version = "2.10.1" [platform.java17] graalvmCompatible = true [[platform.java17.dependency]] -path = "../native/build/libs/websub-native-2.10.0.jar" +path = "../native/build/libs/websub-native-2.10.1-SNAPSHOT.jar" diff --git a/ballerina-tests/Dependencies.toml b/ballerina-tests/Dependencies.toml index f6d05ec7..a00ec0e4 100644 --- a/ballerina-tests/Dependencies.toml +++ b/ballerina-tests/Dependencies.toml @@ -66,7 +66,7 @@ dependencies = [ [[package]] org = "ballerina" name = "http" -version = "2.10.0" +version = "2.10.3" scope = "testOnly" dependencies = [ {org = "ballerina", name = "auth"}, @@ -315,7 +315,7 @@ dependencies = [ [[package]] org = "ballerina" name = "websub" -version = "2.10.0" +version = "2.10.1" scope = "testOnly" dependencies = [ {org = "ballerina", name = "crypto"}, @@ -336,7 +336,7 @@ modules = [ [[package]] org = "ballerina" name = "websub_tests" -version = "2.10.0" +version = "2.10.1" dependencies = [ {org = "ballerina", name = "test"}, {org = "ballerina", name = "websub"} From ce0b523a31d68cc0cdf4baa7415e01df77571d38 Mon Sep 17 00:00:00 2001 From: vil02 Date: Sat, 14 Oct 2023 17:41:27 +0200 Subject: [PATCH 2/4] [Automated] Update the native jar versions --- ballerina/Ballerina.toml | 6 +++--- ballerina/CompilerPlugin.toml | 2 +- ballerina/Dependencies.toml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ballerina/Ballerina.toml b/ballerina/Ballerina.toml index d067f279..8a680a1b 100644 --- a/ballerina/Ballerina.toml +++ b/ballerina/Ballerina.toml @@ -1,7 +1,7 @@ [package] org = "ballerina" name = "websub" -version = "2.10.0" +version = "2.10.1" authors = ["Ballerina"] keywords = ["websub", "subscriber", "service", "listener"] repository = "https://github.com/ballerina-platform/module-ballerina-websub" @@ -15,5 +15,5 @@ graalvmCompatible = true [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" artifactId = "websub-native" -version = "2.10.0" -path = "../native/build/libs/websub-native-2.10.0.jar" +version = "2.10.1" +path = "../native/build/libs/websub-native-2.10.1-SNAPSHOT.jar" diff --git a/ballerina/CompilerPlugin.toml b/ballerina/CompilerPlugin.toml index c52f82c5..bf70174e 100644 --- a/ballerina/CompilerPlugin.toml +++ b/ballerina/CompilerPlugin.toml @@ -3,4 +3,4 @@ id = "websub-compiler-plugin" class = "io.ballerina.stdlib.websub.WebSubCompilerPlugin" [[dependency]] -path = "../compiler-plugin/build/libs/websub-compiler-plugin-2.10.0.jar" +path = "../compiler-plugin/build/libs/websub-compiler-plugin-2.10.1-SNAPSHOT.jar" diff --git a/ballerina/Dependencies.toml b/ballerina/Dependencies.toml index 21a0e6f9..5a1c3226 100644 --- a/ballerina/Dependencies.toml +++ b/ballerina/Dependencies.toml @@ -64,7 +64,7 @@ dependencies = [ [[package]] org = "ballerina" name = "http" -version = "2.10.0" +version = "2.10.2" dependencies = [ {org = "ballerina", name = "auth"}, {org = "ballerina", name = "cache"}, @@ -335,7 +335,7 @@ modules = [ [[package]] org = "ballerina" name = "websub" -version = "2.10.0" +version = "2.10.1" dependencies = [ {org = "ballerina", name = "crypto"}, {org = "ballerina", name = "http"}, From d686e95835b064546c60b7a62a31f1c55907cb5c Mon Sep 17 00:00:00 2001 From: vil02 Date: Sat, 14 Oct 2023 17:43:24 +0200 Subject: [PATCH 3/4] [Automated] Update the native jar versions --- ballerina/Dependencies.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ballerina/Dependencies.toml b/ballerina/Dependencies.toml index 5a1c3226..fc33e18e 100644 --- a/ballerina/Dependencies.toml +++ b/ballerina/Dependencies.toml @@ -64,7 +64,7 @@ dependencies = [ [[package]] org = "ballerina" name = "http" -version = "2.10.2" +version = "2.10.3" dependencies = [ {org = "ballerina", name = "auth"}, {org = "ballerina", name = "cache"}, From a61d9239814f0b6406bbc5458c6e0f320fc51b20 Mon Sep 17 00:00:00 2001 From: vil02 Date: Sat, 14 Oct 2023 17:54:56 +0200 Subject: [PATCH 4/4] 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 #4927. --- changelog.md | 3 +++ .../src/test/java/io/ballerina/stdlib/websub/TestUtils.java | 2 ++ .../src/main/java/io/ballerina/stdlib/websub/CommonUtil.java | 2 ++ .../io/ballerina/stdlib/websub/action/CodeActionUtil.java | 2 ++ .../java/io/ballerina/stdlib/websub/task/AnalyserUtils.java | 2 ++ .../io/ballerina/stdlib/websub/NativeHttpToWebsubAdaptor.java | 4 +++- .../ballerina/stdlib/websub/NativeWebSubListenerAdaptor.java | 4 +++- 7 files changed, 17 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index c818e067..629a8f3d 100644 --- a/changelog.md +++ b/changelog.md @@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - [Introduce new `ClientConfiguration` record to be used for `websub:SubscriptionClient` and `websub:DiscoveryService`](https://github.com/ballerina-platform/ballerina-standard-library/issues/4706) +### Changed +- [Make some of the Java classes proper utility classes](https://github.com/ballerina-platform/ballerina-standard-library/issues/4927) + ## [2.9.1] - 2023-09-14 ### Added diff --git a/compiler-plugin-tests/src/test/java/io/ballerina/stdlib/websub/TestUtils.java b/compiler-plugin-tests/src/test/java/io/ballerina/stdlib/websub/TestUtils.java index 0dd5dff7..bf230b50 100644 --- a/compiler-plugin-tests/src/test/java/io/ballerina/stdlib/websub/TestUtils.java +++ b/compiler-plugin-tests/src/test/java/io/ballerina/stdlib/websub/TestUtils.java @@ -33,6 +33,8 @@ * {@code TestUtils} contains the utility methods for compiler plugin tests. */ public final class TestUtils { + private TestUtils() {} + private static final Path RESOURCE_PATH = Paths.get("src", "test", "resources"); private static final Path DISTRIBUTION_PATH = Paths .get("../", "target", "ballerina-runtime").toAbsolutePath(); diff --git a/compiler-plugin/src/main/java/io/ballerina/stdlib/websub/CommonUtil.java b/compiler-plugin/src/main/java/io/ballerina/stdlib/websub/CommonUtil.java index c92123d9..78ce4e1e 100644 --- a/compiler-plugin/src/main/java/io/ballerina/stdlib/websub/CommonUtil.java +++ b/compiler-plugin/src/main/java/io/ballerina/stdlib/websub/CommonUtil.java @@ -30,6 +30,8 @@ * {@code CommonUtil} contains common utility functions related to compiler-plugin. */ public final class CommonUtil { + private CommonUtil() {} + public static Optional extractSubscriberServiceConfig(ServiceDeclarationSymbol service) { return service.annotations() .stream() diff --git a/compiler-plugin/src/main/java/io/ballerina/stdlib/websub/action/CodeActionUtil.java b/compiler-plugin/src/main/java/io/ballerina/stdlib/websub/action/CodeActionUtil.java index 542295b2..405fe4e3 100644 --- a/compiler-plugin/src/main/java/io/ballerina/stdlib/websub/action/CodeActionUtil.java +++ b/compiler-plugin/src/main/java/io/ballerina/stdlib/websub/action/CodeActionUtil.java @@ -34,6 +34,8 @@ * {@code CodeActionUtil} contains utility functions related to code-actions. */ public final class CodeActionUtil { + private CodeActionUtil() {} + /** * Finds a node in syntax-tree by line-range. * diff --git a/compiler-plugin/src/main/java/io/ballerina/stdlib/websub/task/AnalyserUtils.java b/compiler-plugin/src/main/java/io/ballerina/stdlib/websub/task/AnalyserUtils.java index 9f4b609f..60681a4d 100644 --- a/compiler-plugin/src/main/java/io/ballerina/stdlib/websub/task/AnalyserUtils.java +++ b/compiler-plugin/src/main/java/io/ballerina/stdlib/websub/task/AnalyserUtils.java @@ -47,6 +47,8 @@ * {@code AnalyserUtils} contains utility functions required for {@code websub:SubscriberService} validation. */ public final class AnalyserUtils { + private AnalyserUtils() {} + public static void updateContext(SyntaxNodeAnalysisContext context, WebSubDiagnosticCodes errorCode, NodeLocation location, Object... args) { DiagnosticInfo diagnosticInfo = new DiagnosticInfo( diff --git a/native/src/main/java/io/ballerina/stdlib/websub/NativeHttpToWebsubAdaptor.java b/native/src/main/java/io/ballerina/stdlib/websub/NativeHttpToWebsubAdaptor.java index f18d61da..ab2df15e 100644 --- a/native/src/main/java/io/ballerina/stdlib/websub/NativeHttpToWebsubAdaptor.java +++ b/native/src/main/java/io/ballerina/stdlib/websub/NativeHttpToWebsubAdaptor.java @@ -53,7 +53,9 @@ /** * {@code NativeHttpToWebsubAdaptor} is a wrapper object used for service method execution. */ -public class NativeHttpToWebsubAdaptor { +public final class NativeHttpToWebsubAdaptor { + private NativeHttpToWebsubAdaptor() {} + public static void externInit(BObject adaptor, BObject service) { adaptor.addNativeData(SERVICE_OBJECT, service); } diff --git a/native/src/main/java/io/ballerina/stdlib/websub/NativeWebSubListenerAdaptor.java b/native/src/main/java/io/ballerina/stdlib/websub/NativeWebSubListenerAdaptor.java index 696eb803..4c16fa24 100644 --- a/native/src/main/java/io/ballerina/stdlib/websub/NativeWebSubListenerAdaptor.java +++ b/native/src/main/java/io/ballerina/stdlib/websub/NativeWebSubListenerAdaptor.java @@ -36,7 +36,9 @@ /** * {@code NativeWebSubListenerAdaptor} is a wrapper object used to save/retrieve native data related to WebSub Listener. */ -public class NativeWebSubListenerAdaptor { +public final class NativeWebSubListenerAdaptor { + private NativeWebSubListenerAdaptor() {} + public static void externAttach(BObject websubListener, BString servicePath, BObject subscriberService, BObject httpService, BMap subscriberConfig) {