class Test {
private val property: Int
get() = 1 + 1
fun print() {
println(property)
}
}
fun main(args: Array<String>) {
val test = Test()
test.print()
}
Compiles file [IntelliJ 12.0.2 - Kotlin plugin 0.4.297], but if you execute you get this
Exception in thread "main" java.lang.NoSuchFieldError: property
at Test.print(Test.kt:6)
at namespace.main(Test.kt:12)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
However, it works just fine if the property is public, protected or module-internal.