java.math.BigInteger caster

Description

In the docs there is this example (I’ve cut it down slightly to just show the issue)

import java.math.BigInteger a = BigInteger.valueOf( 54 ) result = a.add( 444 )

https://boxlang.ortusbooks.com/boxlang-language/program-structure#simple-imports

Which errors with Error getting method add for class java.math.BigInteger

This is not surprising as 444 is an Integer datatype and the add method of BigInteger expects a BigInteger

Raising the ticket as it’s in the docs as:

  • Maybe it did work once and has regressed?

  • Could it be made to work?

  • The docs are wrong and should be updated?

Activity

Show:

Brad WoodAugust 16, 2024 at 6:29 AM

Needed to add a BigIntegerCaster, but this is still not working due to related issue. There is a private add( long ) method on the Big int class which is getting found instead, but we can’t access it so we just give up. The access checks need to be performed when filtering over the valid methods and finding a match.

Brad WoodAugust 15, 2024 at 8:15 PM

We need to add logic to coerce any Number to BigDecimal or BigInteger in our Java interop when searching for matching method signatures. Note, we have a BigDecimal caster already, but I haven’t made a BigIntegerCaster yet.

Fixed
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Priority

Sentry

Created August 15, 2024 at 7:58 PM
Updated August 23, 2024 at 12:49 PM
Resolved August 16, 2024 at 3:06 PM