Add ANDROID target

This commit is contained in:
Mikhail Bogdanov
2020-04-13 20:06:50 +02:00
parent 9d68db1668
commit dec93c8b49
32 changed files with 115 additions and 123 deletions
@@ -5,6 +5,7 @@
// Therefore, do not attemp to dex this file as it will fail.
// See: https://source.android.com/devices/tech/dalvik/dex-format#simplename
// IGNORE_DEXING
// IGNORE_BACKEND: ANDROID
class `A!u00A0`() {
val ok = "OK"
@@ -1,5 +1,6 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// IGNORE_BACKEND: ANDROID
// WITH_RUNTIME
// FULL_JDK
@@ -1,5 +1,6 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// IGNORE_BACKEND: ANDROID
// WITH_RUNTIME
// FULL_JDK
@@ -1,4 +1,5 @@
// TARGET_BACKEND: JVM
// IGNORE_BACKEND: ANDROID
// WITH_RUNTIME
// FULL_JDK
@@ -1,5 +1,6 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// IGNORE_BACKEND: ANDROID
// FULL_JDK
@@ -1,4 +1,5 @@
// TARGET_BACKEND: JVM
// IGNORE_BACKEND: ANDROID
// FULL_JDK
@@ -1,4 +1,5 @@
// TARGET_BACKEND: JVM
// IGNORE_BACKEND: ANDROID
// FULL_JDK
+3
View File
@@ -1,5 +1,8 @@
// TARGET_BACKEND: JVM
// Out of memory on Android 4.4
// IGNORE_BACKEND: ANDROID
// WITH_REFLECT
import java.util.*
@@ -8,6 +8,7 @@
//
// See: https://source.android.com/devices/tech/dalvik/dex-format#simplename
// IGNORE_DEXING
// IGNORE_BACKEND: ANDROID
fun `method with spaces`(): String {
data class C(val s: String = "OK")
@@ -4,6 +4,9 @@
// WITH_RUNTIME
// WITH_COROUTINES
// some classes are moved from stdlib to compatibility package
// IGNORE_BACKEND: ANDROID
import helpers.*
import kotlin.coroutines.*
@@ -1,5 +1,8 @@
// TARGET_BACKEND: JVM
// l[0] === 1000 is true on Android
// IGNORE_BACKEND: ANDROID
fun box(): String {
val l = java.util.ArrayList<Int>()
l.add(1000)
+3
View File
@@ -2,6 +2,9 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
// StackOverflow with StringBuilder (escape()) on Android 4.4
// IGNORE_BACKEND: ANDROID
fun escapeChar(c : Char) : String? = when (c) {
'\\' -> "\\\\"
'\n' -> "\\n"
@@ -2,6 +2,9 @@
// WITH_REFLECT
// IGNORE_BACKEND: JS_IR, JS, NATIVE
// different annotation order
// IGNORE_BACKEND: ANDROID
package test
import kotlin.test.assertEquals
@@ -1,9 +1,10 @@
// IGNORE_BACKEND: NATIVE
// WITH_REFLECT
package test
class A
fun box(): String {
val klass = A::class
return if (klass.toString() == "class A") "OK" else "Fail: $klass"
return if (klass.toString() == "class test.A") "OK" else "Fail: $klass"
}
@@ -1,5 +1,8 @@
// TARGET_BACKEND: JVM
// has declaring class on Android 4.4
// IGNORE_BACKEND: ANDROID
// WITH_REFLECT
val property = fun () {}
@@ -1,6 +1,7 @@
// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
// TARGET_BACKEND: JVM
package test
interface Z {
private fun privateFun() = { "OK" }
@@ -58,7 +59,7 @@ fun box(): String {
val nested = Z.Nested::class.java
val enclosingClass = nested.enclosingClass!!
if (enclosingClass.name != "Z") return "fail 9: ${enclosingClass.name}"
if (enclosingClass.name != "test.Z") return "fail 9: ${enclosingClass.name}"
return "OK"
}
@@ -2,6 +2,7 @@
// TARGET_BACKEND: JVM
// WITH_REFLECT
package test
var lambda = {}
@@ -20,7 +21,7 @@ fun box(): String {
if (enclosingMethod?.getName() != "run") return "method: $enclosingMethod"
val enclosingClass = javaClass.getEnclosingClass()!!.getName()
if (enclosingClass != "A\$prop\$1") return "enclosing class: $enclosingClass"
if (enclosingClass != "test.A\$prop\$1") return "enclosing class: $enclosingClass"
val declaringClass = javaClass.getDeclaringClass()
if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass"
@@ -1,7 +1,9 @@
// TARGET_BACKEND: JVM
// WITH_REFLECT
// has declaring class on Android 4.4
// IGNORE_BACKEND: ANDROID
// WITH_REFLECT
class O {
companion object {
// Currently we consider <clinit> in class O as the enclosing method of this lambda,
@@ -1,6 +1,7 @@
// TARGET_BACKEND: JVM
// WITH_REFLECT
package test
class C {
val l: Any = {}
@@ -9,10 +10,10 @@ class C {
fun box(): String {
val javaClass = C().l.javaClass
val enclosingConstructor = javaClass.getEnclosingConstructor()
if (enclosingConstructor?.getDeclaringClass()?.getName() != "C") return "ctor: $enclosingConstructor"
if (enclosingConstructor?.getDeclaringClass()?.getName() != "test.C") return "ctor: $enclosingConstructor"
val enclosingClass = javaClass.getEnclosingClass()
if (enclosingClass?.getName() != "C") return "enclosing class: $enclosingClass"
if (enclosingClass?.getName() != "test.C") return "enclosing class: $enclosingClass"
val declaringClass = javaClass.getDeclaringClass()
if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass"
@@ -1,6 +1,7 @@
// TARGET_BACKEND: JVM
// WITH_REFLECT
package test
class C {
fun foo(): Any {
@@ -15,7 +16,7 @@ fun box(): String {
if (enclosingMethod?.getName() != "foo") return "method: $enclosingMethod"
val enclosingClass = javaClass.getEnclosingClass()
if (enclosingClass?.getName() != "C") return "enclosing class: $enclosingClass"
if (enclosingClass?.getName() != "test.C") return "enclosing class: $enclosingClass"
val declaringClass = javaClass.getDeclaringClass()
if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass"
@@ -1,5 +1,8 @@
// TARGET_BACKEND: JVM
// has declaring class on Android 4.4
// IGNORE_BACKEND: ANDROID
// WITH_REFLECT
object O {
@@ -1,5 +1,8 @@
// TARGET_BACKEND: JVM
// has declaring class on Android 4.4
// IGNORE_BACKEND: ANDROID
// WITH_REFLECT
val l: Any = {}
@@ -1,5 +1,6 @@
// TARGET_BACKEND: JVM
// WITH_RUNTIME
package test
class C {
val f by foo {
@@ -19,7 +20,7 @@ fun box(): String {
if (emInner?.getName() != "invoke") return "Fail: incorrect enclosing method for inner lambda: $emInner"
val ecInner = innerLambda.getEnclosingClass()
if (ecInner?.getName() != "C\$f\$2") return "Fail: incorrect enclosing class for inner lambda: $ecInner"
if (ecInner?.getName() != "test.C\$f\$2") return "Fail: incorrect enclosing class for inner lambda: $ecInner"
val ectorInner = innerLambda.getEnclosingConstructor()
if (ectorInner != null) return "Fail: inner lambda should not have enclosing constructor: $ectorInner"
@@ -35,7 +36,7 @@ fun box(): String {
if (emOuter != null) return "Fail: outer lambda should not have enclosing method: $emOuter"
val ecOuter = outerLambda.getEnclosingClass()
if (ecOuter?.getName() != "C") return "Fail: incorrect enclosing class for outer lambda: $ecOuter"
if (ecOuter?.getName() != "test.C") return "Fail: incorrect enclosing class for outer lambda: $ecOuter"
val ectorOuter = outerLambda.getEnclosingConstructor()
if (ectorOuter == null) return "Fail: outer lambda _should_ have enclosing constructor"
@@ -1,6 +1,9 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// "IOOBE: Invalid index 4, size is 4" for java.lang.reflect.ParameterizedType on Android
// IGNORE_BACKEND: ANDROID
// WITH_REFLECT
import kotlin.reflect.jvm.javaType
@@ -1,6 +1,10 @@
// !JVM_DEFAULT_MODE: disable
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// First item on Android is `java.lang.Thread.getStackTrace`
// IGNORE_BACKEND: ANDROID
// WITH_RUNTIME
// FULL_JDK
@@ -1,4 +1,8 @@
// TARGET_BACKEND: JVM
// Wrong function resolution after package renaming
// IGNORE_BACKEND: ANDROID
// FILE: 1.kt
package kotlin.internal
+2
View File
@@ -1,4 +1,6 @@
// TARGET_BACKEND: JVM
// IGNORE_BACKEND: ANDROID
// FILE: 1.kt
// WITH_REFLECT
package test