I can't think of any Java APIs off the top of my head that take java.lang.Long, so can't quickly test myself. But sys::Int? (nullable) is the same as java.lang.Long, so try casting it like this:
setAmount( (Int?)val )
// or maybe this
Obj? boxed := intVal
setAmount(boxed)
It might just a that the compiler isn't auto-boxing in that case
beatfreakerThu 15 Aug 2019
setAmount( (Int?)val )
// or maybe this
Obj? boxed := intVal
setAmount(boxed)
This worked, thanks Brian
go4Thu 21 Nov 2019
It seems no java.lang.Long mapping. A fix like this
brianMon 2 Mar 2020
I pushed a fix for that allow Fantom types to be used directly for their Java counterparts:
beatfreaker Tue 13 Aug 2019
I am using thirst party java library(stripe-java), and I am using Java FFI feature of fantom to call the API of this thirst party java library
There is this class in stripe-java library https://github.com/stripe/stripe-java/blob/master/src/main/java/com/stripe/param/ChargeCreateParams.java
which allows to create object using builder pattern
Now when I try to call a method setAmount(sys::Int) which accepts an
Int
fantom is giving me compiler time error even though I am passingInt
beatfreaker Tue 13 Aug 2019
My Bad, setAmount() accepts Long
brian Tue 13 Aug 2019
What does your compiler error look like?
SlimerDude Wed 14 Aug 2019
The compiler error is as depicted in the screenshot:
I can confirm this is an issue in Fantom 1.0.73:
The signature of setAmount() is:
brian Wed 14 Aug 2019
I can't think of any Java APIs off the top of my head that take java.lang.Long, so can't quickly test myself. But
sys::Int?
(nullable) is the same asjava.lang.Long
, so try casting it like this:It might just a that the compiler isn't auto-boxing in that case
beatfreaker Thu 15 Aug 2019
This worked, thanks Brian
go4 Thu 21 Nov 2019
It seems no
java.lang.Long
mapping. A fix like thisbrian Mon 2 Mar 2020
I pushed a fix for that allow Fantom types to be used directly for their Java counterparts: