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) {