fabianterhorst
07/25/2017, 10:13 AMrafal
07/25/2017, 10:25 AM@JvmField
to prevent from generating both setters and getter - property will then be plain old java fieldfabianterhorst
07/25/2017, 10:27 AMkingsley
07/25/2017, 10:32 AMprivate var
, there are no setters generatedfabianterhorst
07/25/2017, 10:33 AMkingsley
07/25/2017, 10:36 AMprivate var age = 5
for example. It wouldn’t
However, if your var is via delegation, then it will generate get/set
Also, if you try to access the var from an inner class, then synthetic get/set will be generatedfabianterhorst
07/25/2017, 10:37 AMkingsley
07/25/2017, 10:41 AMclass Me {
private var id: String = ""
}
And Decompiled:
public final class Me {
private String id = "";
}
fabianterhorst
07/25/2017, 10:46 AMkingsley
07/25/2017, 10:50 AMinner
, object
) accessing the variablefabianterhorst
07/25/2017, 11:01 AMkingsley
07/25/2017, 11:01 AMfabianterhorst
07/25/2017, 11:01 AMkingsley
07/25/2017, 11:03 AM@JvmField
on a private property. So no need to generate synthetic assessorsfabianterhorst
07/25/2017, 11:07 AMrafal
07/25/2017, 11:13 AMfabianterhorst
07/25/2017, 11:14 AMrafal
07/25/2017, 11:16 AMprivate var
compiler shouldn't generate accessors - that's why @JvmField
has not effect on private property