"Optional int parameter 'p' is present but cannot be translated into a null value due to being declared as a primitive type. Consider declaring it as object wrapper for the corresponding primitive type."
Any way I can force Kotlin to use the wrapper class Integer instead of the primitive type?
c
Czar
11/14/2017, 11:04 AM
if it's optional it should be
Int?
š 2
o
oskarh
11/14/2017, 11:06 AM
Yeah, that works. I tried having a default value for it
oskarh
11/14/2017, 11:06 AM
But changed to elvis operator now
oskarh
11/14/2017, 11:06 AM
Thanks!
simple smile 1
c
Czar
11/14/2017, 11:11 AM
here problem is that if you mark @RequestParam as optional Spring will pass null, so default value is ignored. You can have it as
Int
to avoid elvis, but instead of Kotlin default value you have to use