Allow to annotate generated code as jvm-only.

This commit is contained in:
Ilya Gorbunov
2015-09-22 15:20:45 +03:00
parent 1deb8b9dda
commit d40bbf6acb
2 changed files with 7 additions and 0 deletions
@@ -105,6 +105,7 @@ class GenericFunction(val signature: String, val keyword: String = "fun") {
val doc = FamilyProperty<String>()
val platformName = PrimitiveProperty<String>()
val inline = FamilyProperty<Boolean>()
val jvmOnly = FamilyProperty<Boolean>()
val typeParams = ArrayList<String>()
val returns = FamilyProperty<String>()
val operator = FamilyProperty<Boolean>()
@@ -364,6 +365,10 @@ class GenericFunction(val signature: String, val keyword: String = "fun") {
?.let { platformName -> builder.append("@kotlin.jvm.JvmName(\"${platformName}\")\n")}
}
if (jvmOnly[f] ?: false) {
builder.append("@kotlin.jvm.JvmVersion\n")
}
annotations[f]?.let { builder.append(it).append('\n') }
builder.append("public ")
@@ -258,5 +258,7 @@ fun specialJVM(): List<GenericFunction> {
}
}
templates.forEach { it.jvmOnly(true) }
return templates
}