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

More instanceof pattern matching #4191

Merged
merged 5 commits into from
Apr 21, 2024
Merged

Conversation

holgerfriedrich
Copy link
Member

@holgerfriedrich holgerfriedrich commented Apr 19, 2024

Some clean-up.

Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
@holgerfriedrich holgerfriedrich requested a review from a team as a code owner April 19, 2024 17:39
Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
Copy link
Member

@J-N-K J-N-K left a comment

Choose a reason for hiding this comment

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

Otherwise LGTM

@@ -589,7 +589,7 @@ private boolean checkType(Type type, Object configValue) {
return configValue instanceof Boolean;
case INTEGER:
return configValue instanceof BigDecimal || configValue instanceof Integer
|| configValue instanceof Double && ((Double) configValue).intValue() == (Double) configValue;
|| configValue instanceof Double doubleValue && doubleValue.intValue() == (Double) configValue;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
|| configValue instanceof Double doubleValue && doubleValue.intValue() == (Double) configValue;
|| configValue instanceof Double doubleValue && doubleValue.intValue() == doubleValue;

Copy link
Member Author

Choose a reason for hiding this comment

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

done

Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
Copy link
Member

@J-N-K J-N-K left a comment

Choose a reason for hiding this comment

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

Thanks!

@J-N-K J-N-K added the enhancement An enhancement or new feature of the Core label Apr 21, 2024
@J-N-K J-N-K added this to the 4.2 milestone Apr 21, 2024
@J-N-K J-N-K merged commit b563f15 into openhab:main Apr 21, 2024
3 checks passed
@holgerfriedrich holgerfriedrich deleted the pr-instanceof branch April 21, 2024 20:01
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