Remove usages of JVM target 1.6 from compiler tests
#KT-45165
This commit is contained in:
-6
@@ -198,12 +198,6 @@ public class SymbolLightClassesForLibraryTestGenerated extends AbstractSymbolLig
|
|||||||
runTest("compiler/testData/asJava/lightClasses/SpecialAnnotationsOnAnnotationClass.kt");
|
runTest("compiler/testData/asJava/lightClasses/SpecialAnnotationsOnAnnotationClass.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestMetadata("SpecialAnnotationsOnAnnotationClass_1_6.kt")
|
|
||||||
public void testSpecialAnnotationsOnAnnotationClass_1_6() throws Exception {
|
|
||||||
runTest("compiler/testData/asJava/lightClasses/SpecialAnnotationsOnAnnotationClass_1_6.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("StubOrderForOverloads.kt")
|
@TestMetadata("StubOrderForOverloads.kt")
|
||||||
public void testStubOrderForOverloads() throws Exception {
|
public void testStubOrderForOverloads() throws Exception {
|
||||||
|
|||||||
-6
@@ -24,12 +24,6 @@ public class SymbolLightClassesLoadingForLibraryTestGenerated extends AbstractSy
|
|||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/asJava/ultraLightClasses"), Pattern.compile("^(.+)\\.(kt)$"), null, true);
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/asJava/ultraLightClasses"), Pattern.compile("^(.+)\\.(kt)$"), null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestMetadata("annotationTargets_1_6.kt")
|
|
||||||
public void testAnnotationTargets_1_6() throws Exception {
|
|
||||||
runTest("compiler/testData/asJava/ultraLightClasses/annotationTargets_1_6.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("annotationWithSetParamPropertyModifier.kt")
|
@TestMetadata("annotationWithSetParamPropertyModifier.kt")
|
||||||
public void testAnnotationWithSetParamPropertyModifier() throws Exception {
|
public void testAnnotationWithSetParamPropertyModifier() throws Exception {
|
||||||
|
|||||||
-6
@@ -198,12 +198,6 @@ public class SymbolLightClassesForSourceTestGenerated extends AbstractSymbolLigh
|
|||||||
runTest("compiler/testData/asJava/lightClasses/SpecialAnnotationsOnAnnotationClass.kt");
|
runTest("compiler/testData/asJava/lightClasses/SpecialAnnotationsOnAnnotationClass.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestMetadata("SpecialAnnotationsOnAnnotationClass_1_6.kt")
|
|
||||||
public void testSpecialAnnotationsOnAnnotationClass_1_6() throws Exception {
|
|
||||||
runTest("compiler/testData/asJava/lightClasses/SpecialAnnotationsOnAnnotationClass_1_6.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("StubOrderForOverloads.kt")
|
@TestMetadata("StubOrderForOverloads.kt")
|
||||||
public void testStubOrderForOverloads() throws Exception {
|
public void testStubOrderForOverloads() throws Exception {
|
||||||
|
|||||||
-6
@@ -24,12 +24,6 @@ public class SymbolLightClassesLoadingForSourceTestGenerated extends AbstractSym
|
|||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/asJava/ultraLightClasses"), Pattern.compile("^(.+)\\.(kt)$"), null, true);
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/asJava/ultraLightClasses"), Pattern.compile("^(.+)\\.(kt)$"), null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestMetadata("annotationTargets_1_6.kt")
|
|
||||||
public void testAnnotationTargets_1_6() throws Exception {
|
|
||||||
runTest("compiler/testData/asJava/ultraLightClasses/annotationTargets_1_6.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("annotationWithSetParamPropertyModifier.kt")
|
@TestMetadata("annotationWithSetParamPropertyModifier.kt")
|
||||||
public void testAnnotationWithSetParamPropertyModifier() throws Exception {
|
public void testAnnotationWithSetParamPropertyModifier() throws Exception {
|
||||||
|
|||||||
-8
@@ -1,8 +0,0 @@
|
|||||||
@kotlin.annotation.MustBeDocumented()
|
|
||||||
@kotlin.annotation.Repeatable()
|
|
||||||
@kotlin.annotation.Retention(value = kotlin.annotation.AnnotationRetention.SOURCE)
|
|
||||||
@kotlin.annotation.Target(allowedTargets = kotlin.annotation.AnnotationTarget.TYPE_PARAMETER)
|
|
||||||
public abstract @interface Anno /* Anno*/ {
|
|
||||||
public abstract int i();// i()
|
|
||||||
|
|
||||||
}
|
|
||||||
-21
@@ -1,21 +0,0 @@
|
|||||||
@java.lang.annotation.Documented()
|
|
||||||
@java.lang.annotation.Repeatable(value = Anno.Container.class)
|
|
||||||
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.SOURCE)
|
|
||||||
@java.lang.annotation.Target(value = {})
|
|
||||||
@kotlin.annotation.MustBeDocumented()
|
|
||||||
@kotlin.annotation.Repeatable()
|
|
||||||
@kotlin.annotation.Retention(value = kotlin.annotation.AnnotationRetention.SOURCE)
|
|
||||||
@kotlin.annotation.Target(allowedTargets = {kotlin.annotation.AnnotationTarget.TYPE_PARAMETER, kotlin.annotation.AnnotationTarget.TYPE})
|
|
||||||
public abstract @interface Anno /* Anno*/ {
|
|
||||||
public abstract int i();// i()
|
|
||||||
|
|
||||||
|
|
||||||
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.SOURCE)
|
|
||||||
@java.lang.annotation.Target(value = {})
|
|
||||||
@kotlin.annotation.Retention(value = kotlin.annotation.AnnotationRetention.SOURCE)
|
|
||||||
@kotlin.annotation.Target(allowedTargets = {kotlin.annotation.AnnotationTarget.TYPE_PARAMETER, kotlin.annotation.AnnotationTarget.TYPE})
|
|
||||||
@kotlin.jvm.internal.RepeatableContainer()
|
|
||||||
public static abstract @interface Container /* Anno.Container*/ {
|
|
||||||
public abstract Anno[] value();// value()
|
|
||||||
|
|
||||||
}}
|
|
||||||
-11
@@ -1,11 +0,0 @@
|
|||||||
// Anno
|
|
||||||
// JVM_TARGET: 1.6
|
|
||||||
// FULL_JDK
|
|
||||||
// SKIP_SANITY_TEST
|
|
||||||
// SKIP_IDE_TEST
|
|
||||||
|
|
||||||
@Retention(AnnotationRetention.SOURCE)
|
|
||||||
@Target(AnnotationTarget.TYPE_PARAMETER, AnnotationTarget.TYPE)
|
|
||||||
@MustBeDocumented
|
|
||||||
@Repeatable
|
|
||||||
annotation class Anno(val i: Int)
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
@kotlin.annotation.Target()
|
|
||||||
public abstract @interface A0 /* A0*/ {
|
|
||||||
}
|
|
||||||
|
|
||||||
@kotlin.annotation.Target(allowedTargets = kotlin.annotation.AnnotationTarget.VALUE_PARAMETER)
|
|
||||||
public abstract @interface A1 /* A1*/ {
|
|
||||||
}
|
|
||||||
|
|
||||||
@kotlin.annotation.Target(allowedTargets = kotlin.annotation.AnnotationTarget.VALUE_PARAMETER)
|
|
||||||
public abstract @interface A2 /* A2*/ {
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
|
||||||
@kotlin.annotation.Target()
|
|
||||||
public abstract @interface A0 /* A0*/ {
|
|
||||||
}
|
|
||||||
|
|
||||||
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
|
||||||
@java.lang.annotation.Target(value = {java.lang.annotation.ElementType.PARAMETER})
|
|
||||||
@kotlin.annotation.Target(allowedTargets = {kotlin.annotation.AnnotationTarget.VALUE_PARAMETER, kotlin.annotation.AnnotationTarget.TYPE})
|
|
||||||
public abstract @interface A1 /* A1*/ {
|
|
||||||
}
|
|
||||||
|
|
||||||
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
|
||||||
@java.lang.annotation.Target(value = {java.lang.annotation.ElementType.PARAMETER})
|
|
||||||
@kotlin.annotation.Target(allowedTargets = {kotlin.annotation.AnnotationTarget.VALUE_PARAMETER, kotlin.annotation.AnnotationTarget.TYPE, kotlin.annotation.AnnotationTarget.TYPE_PARAMETER})
|
|
||||||
public abstract @interface A2 /* A2*/ {
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
// CHECK_BY_JAVA_FILE
|
|
||||||
// JVM_TARGET: 1.6
|
|
||||||
|
|
||||||
@Target()
|
|
||||||
annotation class A0
|
|
||||||
@Target(AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.TYPE)
|
|
||||||
annotation class A1
|
|
||||||
@Target(AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.TYPE, AnnotationTarget.TYPE_PARAMETER)
|
|
||||||
annotation class A2
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
|
||||||
@java.lang.annotation.Target(value = {java.lang.annotation.ElementType.PARAMETER})
|
|
||||||
@kotlin.annotation.Target(allowedTargets = {kotlin.annotation.AnnotationTarget.VALUE_PARAMETER, kotlin.annotation.AnnotationTarget.TYPE, kotlin.annotation.AnnotationTarget.TYPE_PARAMETER})
|
|
||||||
public abstract @interface A2 /* A2*/ {
|
|
||||||
}
|
|
||||||
-5
@@ -174,11 +174,6 @@ public class CompilerLightClassTestGenerated extends AbstractCompilerLightClassT
|
|||||||
runTest("compiler/testData/asJava/lightClasses/SpecialAnnotationsOnAnnotationClass.kt");
|
runTest("compiler/testData/asJava/lightClasses/SpecialAnnotationsOnAnnotationClass.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("SpecialAnnotationsOnAnnotationClass_1_6.kt")
|
|
||||||
public void testSpecialAnnotationsOnAnnotationClass_1_6() throws Exception {
|
|
||||||
runTest("compiler/testData/asJava/lightClasses/SpecialAnnotationsOnAnnotationClass_1_6.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("StubOrderForOverloads.kt")
|
@TestMetadata("StubOrderForOverloads.kt")
|
||||||
public void testStubOrderForOverloads() throws Exception {
|
public void testStubOrderForOverloads() throws Exception {
|
||||||
runTest("compiler/testData/asJava/lightClasses/StubOrderForOverloads.kt");
|
runTest("compiler/testData/asJava/lightClasses/StubOrderForOverloads.kt");
|
||||||
|
|||||||
+1
-1
@@ -412,9 +412,9 @@ class ScriptingHostTest : TestCase() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testJvmTarget() {
|
fun testJvmTarget() {
|
||||||
jvmTargetTestImpl("1.6", 50)
|
|
||||||
jvmTargetTestImpl("1.8", 52)
|
jvmTargetTestImpl("1.8", 52)
|
||||||
jvmTargetTestImpl("9", 53)
|
jvmTargetTestImpl("9", 53)
|
||||||
|
jvmTargetTestImpl("17", 61)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
+10
-19
@@ -148,14 +148,20 @@ class MainKtsTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testCompilerOptions() {
|
fun testCompilerOptions() {
|
||||||
|
|
||||||
val out = captureOut {
|
val out = captureOut {
|
||||||
val res = evalFile(File("$TEST_DATA_ROOT/compile-java6.main.kts"))
|
val res = evalFile(File("$TEST_DATA_ROOT/compiler-options.main.kts"))
|
||||||
assertSucceeded(res)
|
assertSucceeded(res)
|
||||||
assertIsJava6Bytecode(res)
|
|
||||||
|
// `-Xabi-stability=unstable` unsets 5th bit in `Metadata.extraInt` (see kdoc). Let's check that it had effect.
|
||||||
|
val scriptClass = res.valueOrThrow().returnValue.scriptClass!!.java
|
||||||
|
val metadata = scriptClass.declaredAnnotations.single { it.annotationClass.java.name == "kotlin.Metadata" }
|
||||||
|
val extraInt = metadata.javaClass.getDeclaredMethod("xi").invoke(metadata) as Int
|
||||||
|
assertTrue(extraInt and (1 shl 5) == 0) {
|
||||||
|
"Incorrect value of Metadata.extraInt; probably the compiler flag -Xabi-stability=unstable wasn't recognized: $extraInt"
|
||||||
|
}
|
||||||
}.lines()
|
}.lines()
|
||||||
|
|
||||||
Assert.assertEquals(listOf("Hi from sub", "Hi from super", "Hi from random"), out)
|
assertEquals(listOf("Hi from sub", "Hi from super", "Hi from random"), out)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -217,21 +223,6 @@ class MainKtsTest {
|
|||||||
assertEquals("success", value)
|
assertEquals("success", value)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun assertIsJava6Bytecode(res: ResultWithDiagnostics<EvaluationResult>) {
|
|
||||||
val scriptClassResource = res.valueOrThrow().returnValue.scriptClass!!.java.run {
|
|
||||||
getResource("$simpleName.class")
|
|
||||||
}
|
|
||||||
|
|
||||||
DataInputStream(ByteArrayInputStream(scriptClassResource.readBytes())).use { stream ->
|
|
||||||
val header = stream.readInt()
|
|
||||||
if (0xCAFEBABE.toInt() != header) throw IOException("Invalid header class header: $header")
|
|
||||||
@Suppress("UNUSED_VARIABLE")
|
|
||||||
val minor = stream.readUnsignedShort()
|
|
||||||
val major = stream.readUnsignedShort()
|
|
||||||
Assert.assertTrue(major == 50)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun assertSucceeded(res: ResultWithDiagnostics<EvaluationResult>) {
|
private fun assertSucceeded(res: ResultWithDiagnostics<EvaluationResult>) {
|
||||||
Assert.assertTrue(
|
Assert.assertTrue(
|
||||||
"test failed:\n ${res.reports.joinToString("\n ") { it.message + if (it.exception == null) "" else ": ${it.exception}" }}",
|
"test failed:\n ${res.reports.joinToString("\n ") { it.message + if (it.exception == null) "" else ": ${it.exception}" }}",
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
@file:CompilerOptions("-jvm-target", "1.6")
|
@file:CompilerOptions("-jvm-target", "1.8", "-Xabi-stability=unstable")
|
||||||
|
|
||||||
interface Test {
|
interface Test {
|
||||||
fun print()
|
fun print()
|
||||||
Reference in New Issue
Block a user