Skip to content

Conversation

@LEEJaeHyeok97
Copy link
Contributor

Summary

This PR refines the @SuppressWarnings usage in KafkaEvent by introducing a constant for the "unchecked" warning name:

  • Adds a private static constant UNCHECKED in KafkaEvent.
  • Reuses the constant in @SuppressWarnings(UNCHECKED) for both getContainer(...) and getSource(...).

Motivation

This is a small polish to avoid repeating the same warning name string literal and centralize it as a constant.
The behavior of KafkaEvent remains unchanged.

Testing

  • No new tests added, behavior is unchanged.

Copy link
Member

@artembilan artembilan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!
We can accept your change since you have already dedicated some effort to do this, however my concern is that this is not necessary since we have those only two times in the class. As far as I remember SonarQube starts complaining when we have four repetitions of the same string constant.
At the same time I'm not sure why would one complain about Java's built-in unchecked word. It could be expressed as Java's built-in constant itself, or a respective optimization could be done by compiler. Don't know what is going on in Java internals, but I don't see a reason to worry about @SuppressWarnings values optimizations.

At the same time I'd suggest to look into this article for better commit message: https://cbea.ms/git-commit/.

You said already enough in the PR descriptions, but that one has nothing to do with the commit that going to be merged. There is just not PR in the commit history.
At the same time GH is smart enough to turn the first commit message into a PR description. This way we got a gain: we write what was changed and why only once in the commit message. Then we won't need to add PR description and commit history will be happy.

Thank you!

@LEEJaeHyeok97
Copy link
Contributor Author

Thanks for the feedback and for pointing me to the git commit message guide!

I’ve amended the commit message to better describe what changed and why,
following that article. The change itself is still just a small polish to
avoid repeating the "unchecked" warning name literal.

Thank you for taking the time to think through this from my perspective
and to share such thoughtful guidance – I really appreciate it.

Replace repeated "unchecked" string literals in @SuppressWarnings with
a private static UNCHECKED constant. This is a cosmetic refactoring and
does not change KafkaEvent behavior.

Signed-off-by: LeeJaeHyeok97 <hazardous10@naver.com>
@artembilan
Copy link
Member

Will be merged when build is green.
Thank you!

@artembilan artembilan added this to the 4.0.1 milestone Nov 25, 2025
@artembilan artembilan merged commit 9c3718d into spring-projects:main Nov 25, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants