00de5dae32
This way we're making sure that the copied field has some associated property, where we can get the value of isConst flag from. That flag is later used in StaticInitializersLowering to determine whether we need to erase initializer of a field. The tests are unmuted because now the initializer is correctly _not_ erased. (They were passing before switching master to 1.4 because without NoConstantValueAttributeForNonConstVals, we treated all static fields with primitive/string values as const, and never erased initializers because of that.)
36 lines
787 B
Kotlin
Vendored
36 lines
787 B
Kotlin
Vendored
// IGNORE_BACKEND_FIR: JVM_IR
|
|
// TARGET_BACKEND: JVM
|
|
|
|
// FILE: JavaClass.java
|
|
|
|
import java.lang.annotation.Retention;
|
|
import java.lang.annotation.RetentionPolicy;
|
|
|
|
public class JavaClass {
|
|
|
|
@Retention(RetentionPolicy.RUNTIME)
|
|
@interface Foo {
|
|
int value();
|
|
}
|
|
|
|
@Foo(KotlinInterface.FOO_INT)
|
|
public String test() throws NoSuchMethodException {
|
|
return KotlinInterface.FOO_STRING +
|
|
JavaClass.class.getMethod("test").getAnnotation(Foo.class).value();
|
|
}
|
|
}
|
|
|
|
// FILE: KotlinInterface.kt
|
|
|
|
interface KotlinInterface {
|
|
companion object {
|
|
const val FOO_INT: Int = 10
|
|
const val FOO_STRING: String = "OK"
|
|
}
|
|
}
|
|
|
|
fun box(): String {
|
|
val test = JavaClass().test()
|
|
return if (test == "OK10") "OK" else "fail : $test"
|
|
}
|