JVM_IR: Support @JvmSynthetic annotations.

This commit is contained in:
Mads Ager
2019-05-16 12:55:38 +02:00
committed by Georgy Bronnikov
parent 8bdc5f981e
commit 34cf5a19df
3 changed files with 39 additions and 2 deletions
@@ -17,6 +17,21 @@ class C {
@Strictfp fun str() {}
@Synchronized fun sync() {}
@JvmSynthetic val synth = "ABC"
var synth2 = 5
@JvmSynthetic public get
@JvmSynthetic public set
@field:JvmSynthetic
val synth3 = 0
@get:JvmSynthetic @set:JvmSynthetic
var synth4 = 0
@JvmSynthetic
fun synth5() {}
}
fun box(): String {
@@ -29,5 +44,21 @@ fun box(): String {
if (c.getDeclaredMethod("str").getModifiers() and Modifier.STRICT == 0) return "Fail: strict"
if (c.getDeclaredMethod("sync").getModifiers() and Modifier.SYNCHRONIZED == 0) return "Fail: synchronized"
if (!c.getDeclaredField("synth").isSynthetic()) return "Fail: synthetic"
if (c.getDeclaredMethod("getSynth").isSynthetic()) return "Fail: get synthetic"
if (c.getDeclaredField("synth2").isSynthetic()) return "Fail: synthetic 2"
if (!c.getDeclaredMethod("getSynth2").isSynthetic()) return "Fail: get synthetic 2"
if (!c.getDeclaredMethod("setSynth2", Int::class.java).isSynthetic()) return "Fail: set synthetic 2"
if (!c.getDeclaredField("synth3").isSynthetic()) return "Fail: synthetic 3"
if (c.getDeclaredMethod("getSynth3").isSynthetic()) return "Fail: get synthetic 3"
if (c.getDeclaredField("synth4").isSynthetic()) return "Fail: synthetic 4"
if (!c.getDeclaredMethod("getSynth4").isSynthetic()) return "Fail: get synthetic 4"
if (!c.getDeclaredMethod("setSynth4", Int::class.java).isSynthetic()) return "Fail: set synthetic 4"
if (!c.getDeclaredMethod("synth5").isSynthetic()) return "Fail: synthetic 5"
return "OK"
}