Select primitive or object type to use


#1

How can I select where my value should be compiled (JVM) as primitive type or as object type? I really need it.


#2

Could you please explain you case? There are some discussion going on about that.


#3
val bar: Int = 123

is always compiled like

private static int bar = 123
//get
//set

I need to compile it like Integer bar.

By the way, I would not want something like compiler plugin.


#4

Make it val bar: Int? = 123

Out of curiosity. Why do you need it that way? Usually one wants to use primitives wherever it is possible.


#5

I need to drop the object into recursion function


#6

And? It will be boxed on-demand. Could you present the whole code?


#7

No, I’m sorry


#8
import java.lang.Integer

val bar: Integer = Integer(123)