Make top-level property backing field private in bytecode

This commit is contained in:
Michael Bogdanov
2015-10-19 14:20:05 +03:00
parent 376c188cf7
commit c8c3e88c82
17 changed files with 112 additions and 41 deletions
@@ -0,0 +1,18 @@
// FULL_JDK
package test
import java.lang.reflect.Modifier
import kotlin.test.assertTrue
private val prop = "O"
private fun test() = "K"
fun box(): String {
val clazz = Class.forName("test.PrivateVisibilityKt")
assertTrue(Modifier.isPrivate(clazz.getDeclaredMethod("test").modifiers), "Private top level function should be private")
assertTrue(Modifier.isPrivate(clazz.getDeclaredField("prop").modifiers), "Backing field for private top level property should be private")
return "OK"
}
@@ -23,7 +23,7 @@
@kotlin.annotation.Target @java.lang.annotation.Retention @java.lang.annotation.Target @kotlin.jvm.internal.KotlinClass Anno
@kotlin.jvm.internal.KotlinFileFacade DefaultTargetsKt {
final @Anno field p2: int
private final @Anno field p2: int
method <clinit>(): void
public final method getP(): int
public final method getP2(): int