Files
kotlin-fork/compiler/testData/codegen/boxWithStdlib/fullJdk/jvmAnnotationFlags.kt
T
Alexander Udalov 72aa3d1465 Use mock JDK in compiler tests where full JDK is not needed
- move some of boxWithStdlib tests under fullJdk/ directory, where they will be
  compiled against the full JDK
- introduce FULL_JDK in-text directive for the reflection test as only 4 tests
  out of 654 needed the full JDK
2015-04-02 21:57:48 +03:00

22 lines
638 B
Kotlin
Vendored

import java.lang.reflect.Modifier
class C {
volatile var vol = 1
transient val tra = 1
strictfp fun str() {}
synchronized fun sync() {}
}
fun box(): String {
val c = javaClass<C>()
if (c.getDeclaredField("vol").getModifiers() and Modifier.VOLATILE == 0) return "Fail: volatile"
if (c.getDeclaredField("tra").getModifiers() and Modifier.TRANSIENT == 0) return "Fail: transient"
if (c.getDeclaredMethod("str").getModifiers() and Modifier.STRICT == 0) return "Fail: strict"
if (c.getDeclaredMethod("sync").getModifiers() and Modifier.SYNCHRONIZED == 0) return "Fail: synchronized"
return "OK"
}