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

Another warning hunting session #4484

Merged
merged 4 commits into from
Jan 6, 2025

Conversation

clinique
Copy link
Contributor

@clinique clinique commented Dec 9, 2024

Focused on "Potential null pointer access". Minus 64 warnings

@clinique clinique requested a review from a team as a code owner December 9, 2024 09:52
Copy link
Member

@holgerfriedrich holgerfriedrich left a comment

Choose a reason for hiding this comment

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

Thanks!
I left a few comments.
For the computation of hash codes, Objects.hashCode could be helpful, as it handles the null values properly.

Copy link
Member

@holgerfriedrich holgerfriedrich left a comment

Choose a reason for hiding this comment

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

I would actually prefer Objects.hashCode() over Objects.hash()....
Using hash() will change the value, compared to what we had before:
https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/Objects.html#hash(java.lang.Object...)
(not sure if this is relevant for this class, but we might run into trouble with persisted data)

@clinique
Copy link
Contributor Author

clinique commented Jan 3, 2025

I would actually prefer Objects.hashCode() over Objects.hash().... Using hash() will change the value, compared to what we had before: https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/Objects.html#hash(java.lang.Object...) (not sure if this is relevant for this class, but we might run into trouble with persisted data)

Done @holgerfriedrich

Copy link
Member

@holgerfriedrich holgerfriedrich left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the efforts!

@holgerfriedrich holgerfriedrich merged commit 13eeea9 into openhab:main Jan 6, 2025
2 checks passed
@holgerfriedrich holgerfriedrich added this to the 5.0 milestone Jan 6, 2025
@holgerfriedrich holgerfriedrich added the enhancement An enhancement or new feature of the Core label Jan 6, 2025
@clinique clinique deleted the warning_hunt_2 branch January 7, 2025 06:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement or new feature of the Core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants