Fix android test with type annotations. Remove obsolete JVM 8 flavors
Remove some new test cause their originals would be executed on JvmTarget6OnJvm8
This commit is contained in:
@@ -80,14 +80,6 @@ android {
|
||||
reflect0 {
|
||||
dimension "box"
|
||||
}
|
||||
|
||||
jvm80 {
|
||||
dimension "box"
|
||||
}
|
||||
|
||||
reflectjvm80 {
|
||||
dimension "box"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+10
-15
@@ -44,10 +44,8 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
//keep it globally to avoid test grouping on TC
|
||||
private val generatedTestNames = hashSetOf<String>()
|
||||
|
||||
private val COMMON = FlavorConfig("common", 3);
|
||||
private val REFLECT = FlavorConfig("reflect", 1);
|
||||
private val JVM8 = FlavorConfig("jvm8", 1);
|
||||
private val JVM8REFLECT = FlavorConfig("reflectjvm8", 1);
|
||||
private val COMMON = FlavorConfig("common", 3)
|
||||
private val REFLECT = FlavorConfig("reflect", 1)
|
||||
|
||||
class FlavorConfig(private val prefix: String, val limit: Int) {
|
||||
|
||||
@@ -100,7 +98,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
it.setExecutable(true)
|
||||
}
|
||||
}
|
||||
File("./gradlew.bat").copyTo(File(projectRoot, "gradlew.bat"));
|
||||
File("./gradlew.bat").copyTo(File(projectRoot, "gradlew.bat"))
|
||||
val file = File(target, "gradle-wrapper.properties")
|
||||
file.readLines().map {
|
||||
when {
|
||||
@@ -156,8 +154,6 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
|
||||
COMMON.printStatistics()
|
||||
REFLECT.printStatistics()
|
||||
JVM8.printStatistics()
|
||||
JVM8REFLECT.printStatistics()
|
||||
}
|
||||
|
||||
internal inner class FilesWriter(
|
||||
@@ -282,12 +278,13 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
if (fullFileText.contains("// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm")) continue
|
||||
if (fullFileText.contains("// ASSERTIONS_MODE: jvm")) continue
|
||||
val targets = InTextDirectivesUtils.findLinesWithPrefixesRemoved(fullFileText, "// JVM_TARGET:")
|
||||
.also { it.remove(JvmTarget.JVM_1_6.description) }
|
||||
|
||||
val isJvm8Target =
|
||||
if (targets.isEmpty()) false
|
||||
else if (targets.contains(JvmTarget.JVM_1_8.description) && targets.size == 1) true
|
||||
else continue //TODO: support other targets on Android
|
||||
val isAtLeastJvm8Target = !targets.contains(JvmTarget.JVM_1_6.description)
|
||||
|
||||
if (isAtLeastJvm8Target && fullFileText.contains("@Target(AnnotationTarget.TYPE)")) {
|
||||
//TODO: type annotations supported on sdk 26 emulator
|
||||
continue
|
||||
}
|
||||
|
||||
// TODO: support SKIP_JDK6 on new platforms
|
||||
if (fullFileText.contains("// SKIP_JDK6")) continue
|
||||
@@ -300,9 +297,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
KotlinBaseTest.updateConfigurationByDirectivesInTestFiles(testFiles, keyConfiguration)
|
||||
|
||||
val key = ConfigurationKey(kind, jdkKind, keyConfiguration.toString())
|
||||
val compiler = if (isJvm8Target) {
|
||||
if (kind.withReflection) JVM8REFLECT else JVM8
|
||||
} else if (kind.withReflection) REFLECT else COMMON
|
||||
val compiler = if (kind.withReflection) REFLECT else COMMON
|
||||
val filesHolder = holders.getOrPut(key) {
|
||||
FilesWriter(compiler, KotlinTestUtils.newConfiguration(kind, jdkKind,
|
||||
KtTestUtil.getAnnotationsJar()
|
||||
|
||||
-12
@@ -14339,12 +14339,6 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/functions/bigArity/callWithIncorrectNumberOfArguments.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callWithIncorrectNumberOfArguments_1_6.kt")
|
||||
public void testCallWithIncorrectNumberOfArguments_1_6() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/functions/bigArity/callWithIncorrectNumberOfArguments_1_6.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("function255.kt")
|
||||
public void testFunction255() throws Exception {
|
||||
@@ -35924,12 +35918,6 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/super/interfaceHashCode.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("interfaceHashCode_1_6.kt")
|
||||
public void testInterfaceHashCode_1_6() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/super/interfaceHashCode_1_6.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt14243.kt")
|
||||
public void testKt14243() throws Exception {
|
||||
|
||||
-71
@@ -1,71 +0,0 @@
|
||||
// !LANGUAGE: +FunctionTypesWithBigArity
|
||||
// WITH_RUNTIME
|
||||
// TARGET_BACKEND: JVM
|
||||
// JVM_TARGET: 1.6
|
||||
// FILE: J.java
|
||||
|
||||
// import kotlin.jvm.functions.Arity;
|
||||
import kotlin.jvm.functions.FunctionN;
|
||||
import kotlin.Unit;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class J {
|
||||
// TODO: uncomment arity as soon as Arity is introduced
|
||||
public static void test(/* @Arity(30) */ FunctionN<Unit> f) {
|
||||
Object o = new Object();
|
||||
for (int i = 0; i < 42; i++) {
|
||||
if (i == 30) continue;
|
||||
|
||||
Object[] args = new Object[i];
|
||||
Arrays.fill(args, o);
|
||||
try {
|
||||
f.invoke(args);
|
||||
} catch (IllegalArgumentException e) {
|
||||
// OK
|
||||
|
||||
if (!e.getMessage().contains("30")) {
|
||||
throw new AssertionError("Exception must specify the expected number of arguments: " + e.getMessage(), e);
|
||||
}
|
||||
|
||||
continue;
|
||||
} catch (Throwable e) {
|
||||
throw new AssertionError(
|
||||
"Incorrect exception (IllegalArgumentException expected): " + e.getClass().getName() + ", i = " + i, e
|
||||
);
|
||||
}
|
||||
throw new AssertionError("IllegalArgumentException expected, but nothing was thrown, i = " + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: K.kt
|
||||
|
||||
fun foo(
|
||||
p00: Any?, p01: Any?, p02: Any?, p03: Any?, p04: Any?, p05: Any?, p06: Any?, p07: Any?, p08: Any?, p09: Any?,
|
||||
p10: Any?, p11: Any?, p12: Any?, p13: Any?, p14: Any?, p15: Any?, p16: Any?, p17: Any?, p18: Any?, p19: Any?,
|
||||
p20: Any?, p21: Any?, p22: Any?, p23: Any?, p24: Any?, p25: Any?, p26: Any?, p27: Any?, p28: Any?, p29: Any?
|
||||
) {}
|
||||
|
||||
class Fun : (Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?,
|
||||
Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?) -> Unit {
|
||||
override fun invoke(
|
||||
p00: Any?, p01: Any?, p02: Any?, p03: Any?, p04: Any?, p05: Any?, p06: Any?, p07: Any?, p08: Any?, p09: Any?,
|
||||
p10: Any?, p11: Any?, p12: Any?, p13: Any?, p14: Any?, p15: Any?, p16: Any?, p17: Any?, p18: Any?, p19: Any?,
|
||||
p20: Any?, p21: Any?, p22: Any?, p23: Any?, p24: Any?, p25: Any?, p26: Any?, p27: Any?, p28: Any?, p29: Any?
|
||||
) {}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val lambda: Function30<
|
||||
Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?,
|
||||
Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?,
|
||||
Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?,
|
||||
Unit> = { _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ -> }
|
||||
@Suppress("DEPRECATION_ERROR")
|
||||
J.test(lambda as kotlin.jvm.functions.FunctionN<Unit>)
|
||||
@Suppress("DEPRECATION_ERROR")
|
||||
J.test(::foo as kotlin.jvm.functions.FunctionN<Unit>)
|
||||
@Suppress("DEPRECATION_ERROR")
|
||||
J.test(Fun() as kotlin.jvm.functions.FunctionN<Unit>)
|
||||
return "OK"
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_REFLECT
|
||||
// JVM_TARGET: 1.6
|
||||
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
|
||||
Vendored
-1
@@ -1,7 +1,6 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_REFLECT
|
||||
// JVM_TARGET: 1.6
|
||||
|
||||
package test
|
||||
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// JVM_TARGET: 1.6
|
||||
|
||||
interface I
|
||||
class C : I { fun foo() = super<I>.hashCode() }
|
||||
|
||||
fun box(): String {
|
||||
C().foo()
|
||||
return "OK"
|
||||
}
|
||||
-12
@@ -14339,12 +14339,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/functions/bigArity/callWithIncorrectNumberOfArguments.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callWithIncorrectNumberOfArguments_1_6.kt")
|
||||
public void testCallWithIncorrectNumberOfArguments_1_6() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/functions/bigArity/callWithIncorrectNumberOfArguments_1_6.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("function255.kt")
|
||||
public void testFunction255() throws Exception {
|
||||
@@ -36124,12 +36118,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/super/interfaceHashCode.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("interfaceHashCode_1_6.kt")
|
||||
public void testInterfaceHashCode_1_6() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/super/interfaceHashCode_1_6.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt14243.kt")
|
||||
public void testKt14243() throws Exception {
|
||||
|
||||
-12
@@ -14339,12 +14339,6 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/functions/bigArity/callWithIncorrectNumberOfArguments.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callWithIncorrectNumberOfArguments_1_6.kt")
|
||||
public void testCallWithIncorrectNumberOfArguments_1_6() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/functions/bigArity/callWithIncorrectNumberOfArguments_1_6.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("function255.kt")
|
||||
public void testFunction255() throws Exception {
|
||||
@@ -35924,12 +35918,6 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/super/interfaceHashCode.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("interfaceHashCode_1_6.kt")
|
||||
public void testInterfaceHashCode_1_6() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/super/interfaceHashCode_1_6.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt14243.kt")
|
||||
public void testKt14243() throws Exception {
|
||||
|
||||
-10
@@ -12602,11 +12602,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/functions/bigArity/callWithIncorrectNumberOfArguments.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("callWithIncorrectNumberOfArguments_1_6.kt")
|
||||
public void testCallWithIncorrectNumberOfArguments_1_6() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/functions/bigArity/callWithIncorrectNumberOfArguments_1_6.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("function255.kt")
|
||||
public void testFunction255() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/functions/bigArity/function255.kt");
|
||||
@@ -29571,11 +29566,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/super/interfaceHashCode.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("interfaceHashCode_1_6.kt")
|
||||
public void testInterfaceHashCode_1_6() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/super/interfaceHashCode_1_6.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt14243.kt")
|
||||
public void testKt14243() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/super/kt14243.kt");
|
||||
|
||||
Reference in New Issue
Block a user