Skip to content

Extend ScaledBigDecimal class with Number - #64

Merged
ThoSap merged 3 commits into
mainfrom
scaledbigdecimal-extends-number
Apr 21, 2026
Merged

Extend ScaledBigDecimal class with Number#64
ThoSap merged 3 commits into
mainfrom
scaledbigdecimal-extends-number

Conversation

@ThoSap

@ThoSap ThoSap commented Apr 20, 2026

Copy link
Copy Markdown
Member

Note

I will backport this to v1 once this is approved.

The abstract class java.lang.Number requires the following methods to be implemented, which we already implemented in ScaledBigDecimal, so the contract is already in place.

I hope that strictly using records for custom types, which cannot extends other classes, was not the reason that we did not extend Number for ScaledBigDecimal.

image

@ThoSap ThoSap self-assigned this Apr 20, 2026
@ThoSap
ThoSap requested review from Piiit and SirCotare April 20, 2026 14:37

@Piiit Piiit left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, but I would create a ticket to clean stuff up later on

Class<?> type
) {
if (!recordClass.isRecord()) {
if (!recordClass.isRecord() && !ScaledBigDecimal.class.isAssignableFrom(recordClass)) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

OK for now, but I think we should create a ticket to clean this up. It seems strange to have a specific implementation inside this generic utility.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I agree. We should have a ticket to clean up the ultility. And another ticket to look for other tools that use this to see if they can be improved. I am sure there are other places what will be happy about ScaledBigDecimal finally implementing Number.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done 💪🏼
AB-490 Spring Boot Toolbox: Clean up RecordReflectionUtil
AB-491 Spring Boot Toolbox: Check for ScaledBigDecimal extends Number refactoring possibilities in projects

@SirCotare SirCotare left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍

@ThoSap
ThoSap merged commit 8bfa329 into main Apr 21, 2026
1 check passed
@ThoSap
ThoSap deleted the scaledbigdecimal-extends-number branch April 21, 2026 08:48
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.

3 participants