Fix for KT-10881 Declaring constant in a mutlifile class causes an IllegalAccessError on its usage.

Generate fields for 'const' properties in facade class.

NB reading annotations for 'const' vals in multifile class doesn't work, KT-10892.
This commit is contained in:
Dmitry Petrov
2016-02-02 12:06:43 +03:00
parent 970d6f6834
commit bad8320038
8 changed files with 85 additions and 2 deletions
@@ -0,0 +1,3 @@
import a.OK
fun box(): String = OK
@@ -0,0 +1,4 @@
@file:[JvmName("MultifileClass") JvmMultifileClass]
package a
const val OK: String = "OK"
@@ -0,0 +1,14 @@
import a.OK
fun box(): String {
val okRef = ::OK
// TODO
// val annotations = okRef.annotations
// val numAnnotations = annotations.size
// if (numAnnotations != 1) {
// return "Failed, annotations: $annotations"
// }
return okRef.get()
}
@@ -0,0 +1,7 @@
@file:[JvmName("MultifileClass") JvmMultifileClass]
package a
annotation class A
@A
const val OK: String = "OK"