[ISSUE 4254] Every utility class should be annotated with @UtilityClass as we are using lombok#5230
[ISSUE 4254] Every utility class should be annotated with @UtilityClass as we are using lombok#5230makarandg2510-a11y wants to merge 2 commits into
Conversation
…e redundant static modifiers (fixes apache#4254) - Added Lombok's @UtilityClass annotation to all eligible utility classes across the codebase - Removed explicit static keyword from all member methods and fields, since @UtilityClass promotes them automatically - Removed manual private constructors and abstract/final class qualifiers replaced by @UtilityClass - Affected 31 files across eventmesh-common, eventmesh-runtime, eventmesh-runtime-v2, eventmesh-openconnect, eventmesh-connectors, and eventmesh-admin-server modules
…class-annotation refactor: apply @UtilityClass annotation to all eligible utility classes (fixes apache#4254)
There was a problem hiding this comment.
Welcome to the Apache EventMesh community!!
This is your first PR in our project. We're very excited to have you onboard contributing. Your contributions are greatly appreciated!
Please make sure that the changes are covered by tests.
We will be here shortly.
Let us know if you need any help!
Want to get closer to the community?
| WeChat Assistant | WeChat Public Account | Slack |
|---|---|---|
![]() |
![]() |
Join Slack Chat |
Mailing Lists:
| Name | Description | Subscribe | Unsubscribe | Archive |
|---|---|---|---|---|
| Users | User support and questions mailing list | Subscribe | Unsubscribe | Mail Archives |
| Development | Development related discussions | Subscribe | Unsubscribe | Mail Archives |
| Commits | All commits to repositories | Subscribe | Unsubscribe | Mail Archives |
| Issues | Issues or PRs comments and reviews | Subscribe | Unsubscribe | Mail Archives |
|
It has been 60 days since the last activity on this pull request. I am reaching out here to gently remind you that the Apache EventMesh community values every pull request, and please feel free to get in touch with the reviewers at any time. They are available to assist you in advancing the progress of your pull request and offering the latest feedback. If you encounter any challenges during development, seeking support within the community is encouraged. We sincerely appreciate your contributions to Apache EventMesh. |


Closes #4254
Motivation
This fixes the issue#4254.
Modifications
This PR refactors all eligible utility classes across the EventMesh codebase to use Lombok's @UtilityClass annotation.
What does
@UtilityClassdo?Lombok's
@UtilityClassannotation automatically:UnsupportedOperationException(preventing instantiation)This replaces the ad-hoc manual patterns found across the codebase (
public final class,public abstract class, explicit private constructors) with a single idiomatic annotation.Files Changed (31 files)
eventmesh-common
utils/: AssertUtils, JsonUtils (+ removed duplicate import), JsonPathUtils, NetUtils, PropertiesUtils, RandomStringUtils, ConfigurationContextUtil, ThreadUtils, LogUtil (removed redundantpublic final)remote/payload/: PayloadUtilprotocol/grpc/common/: EventMeshCloudEventUtils (abstract→@UtilityClass)eventmesh-runtime
util/: BannerUtil, EventMeshUtil, HttpRequestUtil, HttpResponseUtils, RemotingHelper (abstract→@UtilityClass)core/protocol/grpc/service/: ServiceUtilseventmesh-runtime-v2
util/: BannerUtil, RuntimeUtilseventmesh-openconnect
util/: CloudEventUtil, ConfigUtileventmesh-connectors
connector-http/util/: HttpUtilsconnector-jdbc/utils/: Antlr4Utils, ByteArrayUtils, JdbcStringUtils, MysqlUtilsconnector-rabbitmq/utils/: ByteArrayUtilsconnector-mongodb/utils/: MongodbCloudEventUtilconnector-lark/: ConfigUtilseventmesh-admin-server
web/utils/: Base64Utils, EncryptUtil, JdbcUtils, RSAUtils (explicit private constructor removed)Skipped (not eligible)
Class | Reason -- | -- SystemUtils | Uses static initializer blocks; @UtilityClass conflicts with its class-load initialisation IPUtils | Has mutable static field (localAddress) initialised via init(); not a pure utility HttpConvertsUtils | References non-static inner class constructsTesting
./gradlew :eventmesh-common:compileJava✅ — zero errors./gradlew :eventmesh-runtime:compileJava✅ — zero errors./gradlew :eventmesh-admin-server:compileJava✅ — zero errors./gradlew :eventmesh-openconnect:eventmesh-openconnect-java:compileJava✅ — zero errorsDocumentation