KT-8575 Add tests and disable reflection for Java synthetic property references
This commit is contained in:
committed by
teamcity
parent
5116bbc440
commit
f8fd23e373
@@ -0,0 +1,34 @@
|
||||
// TARGET_BACKEND: JVM_IR
|
||||
// !LANGUAGE: +ReferencesToSyntheticJavaProperties
|
||||
// WITH_REFLECT
|
||||
|
||||
// FILE: J.java
|
||||
|
||||
public class J {
|
||||
private String stringProperty;
|
||||
|
||||
public String getStringProperty() {
|
||||
return stringProperty;
|
||||
}
|
||||
|
||||
public void setStringProperty(String value) {
|
||||
stringProperty = value;
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
import kotlin.reflect.*
|
||||
import kotlin.test.*
|
||||
|
||||
fun box(): String {
|
||||
val stringProperty = J::stringProperty
|
||||
assertEquals("property stringProperty (Kotlin reflection is not available)", stringProperty.toString())
|
||||
try {
|
||||
stringProperty.visibility
|
||||
return "Fail"
|
||||
} catch (e: UnsupportedOperationException) {
|
||||
assertEquals("Kotlin reflection is not yet supported for synthetic Java properties", e.message)
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user