Skip to content

Eliminate the safeCast method#130

Merged
FredrikTaquist merged 1 commit intomainfrom
no-safeCast
Feb 2, 2026
Merged

Eliminate the safeCast method#130
FredrikTaquist merged 1 commit intomainfrom
no-safeCast

Conversation

@kostis
Copy link
Collaborator

@kostis kostis commented Jan 22, 2026

The code of safeCast read:

       protected DataValue safeCast(DataValue dv) {
               if (dv.getValue() instanceof BigDecimal) {
                       return new DataValue(dv.getDataType(), (BigDecimal) dv.getValue());
               }
               return null;
       }

and, given that the value field has type BigDecimal, the code (just) makes an unnecessary copy of the object, not a cast of any form.

This PR removes this confusing code (and all its uses) from the code base.

The code of `safeCast` read:
```
       protected DataValue safeCast(DataValue dv) {
               if (dv.getValue() instanceof BigDecimal) {
                       return new DataValue(dv.getDataType(), (BigDecimal) dv.getValue());
               }
               return null;
       }
```
and, given that the `value` field has type `BigDecimal`, the code (just)
makes an unnecessary copy of the object, not a cast of any form.

This PR removes this confusing code (and all its uses) from the code base.
@kostis kostis requested a review from fhowar January 22, 2026 15:17
@FredrikTaquist
Copy link
Collaborator

Looks good to me

@FredrikTaquist FredrikTaquist merged commit a13a040 into main Feb 2, 2026
4 checks passed
@FredrikTaquist FredrikTaquist deleted the no-safeCast branch February 2, 2026 10:56
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

Comments