fun main(args: Array<String>) {
println(A.a)}
class A{
class object{
val a: Int
{
a = 0
}
}
}
It compiles but throws
Exception in thread “main” java.lang.NoSuchFieldError: a
at net.unitcraft.content.A.<clinit>(Main.kt:19)
at net.unitcraft.content.ContentPackage-Main-c1ee52f.main(Main.kt:11)
at net.unitcraft.content.ContentPackage.main(Main.kt:1)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
I use Idea 138.1503.3.