Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HHH-19321: Improve inline documentation for @SuppressWarnings in multiple methods #9966

Closed
wants to merge 3 commits into from

Conversation

plan11plan
Copy link

@plan11plan plan11plan commented Apr 6, 2025

Hello!

This PR enhances inline documentation for methods using @SuppressWarnings("unchecked") to address concerns highlighted in Effective Java: Item 27 – "Eliminate unchecked warnings."

  • registerStoredProcedureParameter: Added comments explaining the unchecked conversion from raw Class to a generic type.
  • getResultList: Documented the reason behind casting Collections.EMPTY_LIST as List and casting ResultSetOutput to List.
  • unwrap: Clarified that runtime type checks (cls.isInstance()) ensure the safety of casting 'this', parameterMetadata, etc.

These changes help maintainers understand why the warnings are suppressed and prevent accidental removal or modification that might compromise type safety.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.


https://hibernate.atlassian.net/browse/HHH-19321

@gavinking
Copy link
Member

I don't think there's much value to commenting this sort of "obvious" stuff. Much better to actually fix the typing issues and remove the @SuppressWarnings. I did some of that in #9968.

@gavinking gavinking closed this Apr 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants