From d022bb0248a3f199ea0bc671b93dc30c5052c292 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Thu, 21 Jan 2021 17:12:46 +0100 Subject: [PATCH] Switch default JVM target to 1.8 #KT-29405 Fixed --- .../OriginCollectingClassBuilderFactory.kt | 4 +- .../arguments/K2JVMCompilerArguments.kt | 2 +- .../org/jetbrains/kotlin/config/JvmTarget.kt | 2 +- .../FirBlackBoxCodegenTestGenerated.java | 12 ++++ .../codegen/FirBytecodeTextTestGenerated.java | 12 +++- .../ultraLightClasses/typeAnnotations.java | 14 ++-- compiler/testData/cli/jvm/help.out | 2 +- .../box/annotations/typeAnnotationOnJdk6.kt | 1 + .../callWithIncorrectNumberOfArguments_1_6.kt | 71 +++++++++++++++++++ .../annotations/onTypes/arrayKClass.kt | 1 + .../codegen/box/super/interfaceHashCode.kt | 1 - .../box/super/interfaceHashCode_1_6.kt | 11 +++ .../boxingOptimization/hashCodeOnNonNull.kt | 11 +++ .../bytecodeText/boxingOptimization/kt7224.kt | 2 +- .../boxingOptimization/unsafeRemoving.kt | 5 +- .../hashCode/{hashCode.kt => hashCode_1_6.kt} | 2 + .../skipCallToUnderlyingValueOfInlineClass.kt | 6 +- .../unsignedIntCompare_before.kt | 1 + .../wrongInlineTarget/output.txt | 36 +++++----- .../wrongInlineTarget/warningsOnly_1_3.txt | 12 ++-- .../diagnostics/tests/generics/kt9203.fir.kt | 11 --- .../diagnostics/tests/generics/kt9203.kt | 4 +- .../tests/j+k/defaultMethods.fir.kt | 1 + .../diagnostics/tests/j+k/defaultMethods.kt | 1 + .../defaultMethodsIndirectInheritance.fir.kt | 1 + .../j+k/defaultMethodsIndirectInheritance.kt | 1 + .../tests/j+k/defaultMethods_warning.fir.kt | 3 +- .../tests/j+k/defaultMethods_warning.kt | 3 +- ...nheritanceStaticMethodFromInterface.fir.kt | 32 --------- .../inheritanceStaticMethodFromInterface.kt | 3 +- .../tests/j+k/traitDefaultCall.fir.kt | 1 + .../diagnostics/tests/j+k/traitDefaultCall.kt | 1 + ...gateFlexibilityFromOtherConstraints.fir.kt | 32 --------- ...ropagateFlexibilityFromOtherConstraints.kt | 5 +- .../tests/targetedBuiltIns/stream.fir.kt | 13 ---- .../tests/targetedBuiltIns/stream.kt | 4 +- .../annotations/jvmStatic/functions_LL13.kt | 2 +- .../interfaceCompanion_LL13_16.fir.kt | 2 + .../jvmStatic/interfaceCompanion_LL13_16.kt | 2 + .../targetedBuiltIns/blackListed.kt | 2 +- .../codegen/BlackBoxCodegenTestGenerated.java | 12 ++++ .../codegen/BytecodeTextTestGenerated.java | 12 +++- .../IrBlackBoxCodegenTestGenerated.java | 12 ++++ .../codegen/IrBytecodeTextTestGenerated.java | 12 +++- .../LightAnalysisModeTestGenerated.java | 10 +++ .../CompileKotlinAgainstCustomBinariesTest.kt | 4 +- .../gradle/GradleFacetImportTest.kt | 4 +- .../platform/impl/JvmIdePlatformKind.kt | 2 +- .../checker/JvmStaticUsagesRuntime.kt | 2 +- .../jdk8/overrideCollectionStream.kt.after | 1 - .../kotlin/gradle/dsl/KotlinJvmOptions.kt | 4 +- .../kotlin/gradle/dsl/KotlinJvmOptionsBase.kt | 4 +- 52 files changed, 247 insertions(+), 164 deletions(-) create mode 100644 compiler/testData/codegen/box/functions/bigArity/callWithIncorrectNumberOfArguments_1_6.kt create mode 100644 compiler/testData/codegen/box/super/interfaceHashCode_1_6.kt create mode 100644 compiler/testData/codegen/bytecodeText/boxingOptimization/hashCodeOnNonNull.kt rename compiler/testData/codegen/bytecodeText/hashCode/{hashCode.kt => hashCode_1_6.kt} (93%) delete mode 100644 compiler/testData/diagnostics/tests/generics/kt9203.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/j+k/inheritanceStaticMethodFromInterface.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/platformTypes/propagateFlexibilityFromOtherConstraints.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/targetedBuiltIns/stream.fir.kt diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/OriginCollectingClassBuilderFactory.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/OriginCollectingClassBuilderFactory.kt index d9b3869893f..238cd25f13d 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/OriginCollectingClassBuilderFactory.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/OriginCollectingClassBuilderFactory.kt @@ -58,7 +58,7 @@ class OriginCollectingClassBuilderFactory(private val builderMode: ClassBuilderM } override fun asBytes(builder: ClassBuilder): ByteArray { - val classWriter = ClassWriter(0) + val classWriter = ClassWriter(ClassWriter.COMPUTE_FRAMES or ClassWriter.COMPUTE_MAXS) (builder as OriginCollectingClassBuilder).classNode.accept(classWriter) return classWriter.toByteArray() } @@ -66,4 +66,4 @@ class OriginCollectingClassBuilderFactory(private val builderMode: ClassBuilderM override fun asText(builder: ClassBuilder) = throw UnsupportedOperationException() override fun close() {} -} \ No newline at end of file +} diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt index cd7237ce2ad..4cb5d5804ec 100644 --- a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt +++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt @@ -71,7 +71,7 @@ class K2JVMCompilerArguments : CommonCompilerArguments() { @Argument( value = "-jvm-target", valueDescription = "", - description = "Target version of the generated JVM bytecode (1.6, 1.8, 9, 10, 11, 12, 13, 14 or 15), default is 1.6" + description = "Target version of the generated JVM bytecode (1.6, 1.8, 9, 10, 11, 12, 13, 14 or 15), default is 1.8" ) var jvmTarget: String? by NullableStringFreezableVar(JvmTarget.DEFAULT.description) diff --git a/compiler/config.jvm/src/org/jetbrains/kotlin/config/JvmTarget.kt b/compiler/config.jvm/src/org/jetbrains/kotlin/config/JvmTarget.kt index 69ebe32e62b..df3a0df53f1 100644 --- a/compiler/config.jvm/src/org/jetbrains/kotlin/config/JvmTarget.kt +++ b/compiler/config.jvm/src/org/jetbrains/kotlin/config/JvmTarget.kt @@ -36,7 +36,7 @@ enum class JvmTarget( companion object { @JvmField - val DEFAULT = JVM_1_6 + val DEFAULT = JVM_1_8 @JvmStatic fun fromString(string: String) = values().find { it.description == string } diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java index 6441ede6b42..188314799ea 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java @@ -14315,6 +14315,12 @@ 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 { @@ -35848,6 +35854,12 @@ 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 { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBytecodeTextTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBytecodeTextTestGenerated.java index 115fc4cd7da..5fad7f402f5 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBytecodeTextTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBytecodeTextTestGenerated.java @@ -640,6 +640,12 @@ public class FirBytecodeTextTestGenerated extends AbstractFirBytecodeTextTest { runTest("compiler/testData/codegen/bytecodeText/boxingOptimization/fold.kt"); } + @Test + @TestMetadata("hashCodeOnNonNull.kt") + public void testHashCodeOnNonNull() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/boxingOptimization/hashCodeOnNonNull.kt"); + } + @Test @TestMetadata("inlineClassesAndInlinedLambda.kt") public void testInlineClassesAndInlinedLambda() throws Exception { @@ -3119,9 +3125,9 @@ public class FirBytecodeTextTestGenerated extends AbstractFirBytecodeTextTest { } @Test - @TestMetadata("hashCode.kt") - public void testHashCode() throws Exception { - runTest("compiler/testData/codegen/bytecodeText/hashCode/hashCode.kt"); + @TestMetadata("hashCode_1_6.kt") + public void testHashCode_1_6() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/hashCode/hashCode_1_6.kt"); } @Test diff --git a/compiler/testData/asJava/ultraLightClasses/typeAnnotations.java b/compiler/testData/asJava/ultraLightClasses/typeAnnotations.java index d10d935f4f7..d5473375e39 100644 --- a/compiler/testData/asJava/ultraLightClasses/typeAnnotations.java +++ b/compiler/testData/asJava/ultraLightClasses/typeAnnotations.java @@ -1,41 +1,41 @@ @java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME) -@java.lang.annotation.Target(value = {java.lang.annotation.ElementType.PARAMETER}) +@java.lang.annotation.Target(value = {java.lang.annotation.ElementType.PARAMETER, java.lang.annotation.ElementType.TYPE_USE}) @kotlin.annotation.Target(allowedTargets = {kotlin.annotation.AnnotationTarget.VALUE_PARAMETER, kotlin.annotation.AnnotationTarget.TYPE}) 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}) +@java.lang.annotation.Target(value = {java.lang.annotation.ElementType.PARAMETER, java.lang.annotation.ElementType.TYPE_USE}) @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}) +@java.lang.annotation.Target(value = {java.lang.annotation.ElementType.PARAMETER, java.lang.annotation.ElementType.TYPE_USE}) @kotlin.annotation.Target(allowedTargets = {kotlin.annotation.AnnotationTarget.VALUE_PARAMETER, kotlin.annotation.AnnotationTarget.TYPE}) public abstract @interface A2 /* A2*/ { } @java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME) -@java.lang.annotation.Target(value = {java.lang.annotation.ElementType.PARAMETER}) +@java.lang.annotation.Target(value = {java.lang.annotation.ElementType.PARAMETER, java.lang.annotation.ElementType.TYPE_USE}) @kotlin.annotation.Target(allowedTargets = {kotlin.annotation.AnnotationTarget.VALUE_PARAMETER, kotlin.annotation.AnnotationTarget.TYPE}) public abstract @interface A3 /* A3*/ { } @java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME) -@java.lang.annotation.Target(value = {java.lang.annotation.ElementType.PARAMETER}) +@java.lang.annotation.Target(value = {java.lang.annotation.ElementType.PARAMETER, java.lang.annotation.ElementType.TYPE_USE}) @kotlin.annotation.Target(allowedTargets = {kotlin.annotation.AnnotationTarget.VALUE_PARAMETER, kotlin.annotation.AnnotationTarget.TYPE}) public abstract @interface A4 /* A4*/ { } @java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME) -@java.lang.annotation.Target(value = {java.lang.annotation.ElementType.PARAMETER}) +@java.lang.annotation.Target(value = {java.lang.annotation.ElementType.PARAMETER, java.lang.annotation.ElementType.TYPE_USE}) @kotlin.annotation.Target(allowedTargets = {kotlin.annotation.AnnotationTarget.VALUE_PARAMETER, kotlin.annotation.AnnotationTarget.TYPE}) public abstract @interface A5 /* A5*/ { } @java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME) -@java.lang.annotation.Target(value = {java.lang.annotation.ElementType.PARAMETER}) +@java.lang.annotation.Target(value = {java.lang.annotation.ElementType.PARAMETER, java.lang.annotation.ElementType.TYPE_USE}) @kotlin.annotation.Target(allowedTargets = {kotlin.annotation.AnnotationTarget.VALUE_PARAMETER, kotlin.annotation.AnnotationTarget.TYPE}) public abstract @interface A6 /* A6*/ { } diff --git a/compiler/testData/cli/jvm/help.out b/compiler/testData/cli/jvm/help.out index cad39163ca3..e552148ed9b 100644 --- a/compiler/testData/cli/jvm/help.out +++ b/compiler/testData/cli/jvm/help.out @@ -6,7 +6,7 @@ where possible options include: -include-runtime Include Kotlin runtime into the resulting JAR -java-parameters Generate metadata for Java 1.8 reflection on method parameters -jdk-home Include a custom JDK from the specified location into the classpath instead of the default JAVA_HOME - -jvm-target Target version of the generated JVM bytecode (1.6, 1.8, 9, 10, 11, 12, 13, 14 or 15), default is 1.6 + -jvm-target Target version of the generated JVM bytecode (1.6, 1.8, 9, 10, 11, 12, 13, 14 or 15), default is 1.8 -module-name Name of the generated .kotlin_module file -no-jdk Don't automatically include the Java runtime into the classpath -no-reflect Don't automatically include Kotlin reflection into the classpath diff --git a/compiler/testData/codegen/box/annotations/typeAnnotationOnJdk6.kt b/compiler/testData/codegen/box/annotations/typeAnnotationOnJdk6.kt index 0e2d9aea7e6..b5be1dfdeb4 100644 --- a/compiler/testData/codegen/box/annotations/typeAnnotationOnJdk6.kt +++ b/compiler/testData/codegen/box/annotations/typeAnnotationOnJdk6.kt @@ -1,5 +1,6 @@ // TARGET_BACKEND: JVM // WITH_RUNTIME +// JVM_TARGET: 1.6 @Target(AnnotationTarget.TYPE) annotation class A diff --git a/compiler/testData/codegen/box/functions/bigArity/callWithIncorrectNumberOfArguments_1_6.kt b/compiler/testData/codegen/box/functions/bigArity/callWithIncorrectNumberOfArguments_1_6.kt new file mode 100644 index 00000000000..37aa0ab9500 --- /dev/null +++ b/compiler/testData/codegen/box/functions/bigArity/callWithIncorrectNumberOfArguments_1_6.kt @@ -0,0 +1,71 @@ +// !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 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) + @Suppress("DEPRECATION_ERROR") + J.test(::foo as kotlin.jvm.functions.FunctionN) + @Suppress("DEPRECATION_ERROR") + J.test(Fun() as kotlin.jvm.functions.FunctionN) + return "OK" +} diff --git a/compiler/testData/codegen/box/reflection/annotations/onTypes/arrayKClass.kt b/compiler/testData/codegen/box/reflection/annotations/onTypes/arrayKClass.kt index 0db0871261d..3ba21ac9a59 100644 --- a/compiler/testData/codegen/box/reflection/annotations/onTypes/arrayKClass.kt +++ b/compiler/testData/codegen/box/reflection/annotations/onTypes/arrayKClass.kt @@ -1,6 +1,7 @@ // IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_REFLECT +// JVM_TARGET: 1.6 import kotlin.reflect.KClass diff --git a/compiler/testData/codegen/box/super/interfaceHashCode.kt b/compiler/testData/codegen/box/super/interfaceHashCode.kt index 7a6aeff7fa3..c88e69af2cf 100644 --- a/compiler/testData/codegen/box/super/interfaceHashCode.kt +++ b/compiler/testData/codegen/box/super/interfaceHashCode.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR interface I class C : I { fun foo() = super.hashCode() } diff --git a/compiler/testData/codegen/box/super/interfaceHashCode_1_6.kt b/compiler/testData/codegen/box/super/interfaceHashCode_1_6.kt new file mode 100644 index 00000000000..87bd1e88336 --- /dev/null +++ b/compiler/testData/codegen/box/super/interfaceHashCode_1_6.kt @@ -0,0 +1,11 @@ +// TARGET_BACKEND: JVM +// IGNORE_BACKEND_FIR: JVM_IR +// JVM_TARGET: 1.6 + +interface I +class C : I { fun foo() = super.hashCode() } + +fun box(): String { + C().foo() + return "OK" +} diff --git a/compiler/testData/codegen/bytecodeText/boxingOptimization/hashCodeOnNonNull.kt b/compiler/testData/codegen/bytecodeText/boxingOptimization/hashCodeOnNonNull.kt new file mode 100644 index 00000000000..4553487d949 --- /dev/null +++ b/compiler/testData/codegen/bytecodeText/boxingOptimization/hashCodeOnNonNull.kt @@ -0,0 +1,11 @@ +// IGNORE_BACKEND: JVM_IR +// IGNORE_BACKEND_FIR: JVM_IR + +fun foo() { + val x: Int? = 6 + val hc = x!!.hashCode() +} + +// 1 java/lang/Integer.hashCode \(I\)I +// 0 java/lang/Integer.valueOf +// 0 intValue diff --git a/compiler/testData/codegen/bytecodeText/boxingOptimization/kt7224.kt b/compiler/testData/codegen/bytecodeText/boxingOptimization/kt7224.kt index ec6fa03d080..0308a417e90 100644 --- a/compiler/testData/codegen/bytecodeText/boxingOptimization/kt7224.kt +++ b/compiler/testData/codegen/bytecodeText/boxingOptimization/kt7224.kt @@ -4,4 +4,4 @@ fun box(): String { return "OK" } -// 1 INVOKESTATIC java/lang/Integer.valueOf \ No newline at end of file +// 0 INVOKESTATIC java/lang/Integer.valueOf diff --git a/compiler/testData/codegen/bytecodeText/boxingOptimization/unsafeRemoving.kt b/compiler/testData/codegen/bytecodeText/boxingOptimization/unsafeRemoving.kt index 0c211227755..7d9625025f8 100644 --- a/compiler/testData/codegen/bytecodeText/boxingOptimization/unsafeRemoving.kt +++ b/compiler/testData/codegen/bytecodeText/boxingOptimization/unsafeRemoving.kt @@ -15,9 +15,6 @@ fun foo() { val b = arrayOfNulls(4) b[100] = 5 - val x: Int? = 6 - val hc = x!!.hashCode() - val y: Int? = 7 val z: Int? = 8 val res = y === z @@ -26,5 +23,5 @@ fun foo() { val c2: Any = if (1 != one) 0 else "abc" } -// 9 java/lang/Integer.valueOf +// 8 java/lang/Integer.valueOf // 0 intValue diff --git a/compiler/testData/codegen/bytecodeText/hashCode/hashCode.kt b/compiler/testData/codegen/bytecodeText/hashCode/hashCode_1_6.kt similarity index 93% rename from compiler/testData/codegen/bytecodeText/hashCode/hashCode.kt rename to compiler/testData/codegen/bytecodeText/hashCode/hashCode_1_6.kt index 19a7de41578..6bec2e9f0b0 100644 --- a/compiler/testData/codegen/bytecodeText/hashCode/hashCode.kt +++ b/compiler/testData/codegen/bytecodeText/hashCode/hashCode_1_6.kt @@ -1,3 +1,5 @@ +// JVM_TARGET: 1.6 + fun box(): String { true.hashCode() 1.toByte().hashCode() diff --git a/compiler/testData/codegen/bytecodeText/inlineClasses/skipCallToUnderlyingValueOfInlineClass.kt b/compiler/testData/codegen/bytecodeText/inlineClasses/skipCallToUnderlyingValueOfInlineClass.kt index 644a4d128e9..bef3467606b 100644 --- a/compiler/testData/codegen/bytecodeText/inlineClasses/skipCallToUnderlyingValueOfInlineClass.kt +++ b/compiler/testData/codegen/bytecodeText/inlineClasses/skipCallToUnderlyingValueOfInlineClass.kt @@ -9,7 +9,7 @@ inline class UInt(val value: Int) fun test(u1: UInt, u2: UInt) { val a = u1.value - val b = u1.value.hashCode() // box int to call hashCode + val b = u1.value.hashCode() val c = u1.value + u2.value } @@ -18,5 +18,5 @@ fun test(u1: UInt, u2: UInt) { // 0 INVOKESTATIC UInt\$Erased.box // 0 INVOKEVIRTUAL UInt.unbox -// 1 valueOf -// 0 intValue \ No newline at end of file +// 0 valueOf +// 0 intValue diff --git a/compiler/testData/codegen/bytecodeText/unsignedTypes/unsignedIntCompare_before.kt b/compiler/testData/codegen/bytecodeText/unsignedTypes/unsignedIntCompare_before.kt index d08c93ab158..9c9f26a2f4e 100644 --- a/compiler/testData/codegen/bytecodeText/unsignedTypes/unsignedIntCompare_before.kt +++ b/compiler/testData/codegen/bytecodeText/unsignedTypes/unsignedIntCompare_before.kt @@ -1,4 +1,5 @@ // WITH_RUNTIME +// JVM_TARGET: 1.6 val ua = 1234U val ub = 5678U diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/output.txt b/compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/output.txt index f1948e7258a..e5f08789d19 100644 --- a/compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/output.txt +++ b/compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/output.txt @@ -1,55 +1,55 @@ -compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:6:5: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:6:5: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option inlineFun {} ^ -compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:7:5: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:7:5: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option inlineGetter ^ -compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:8:5: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:8:5: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option inlineGetter = 1 ^ -compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:11:5: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:11:5: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option inlineSetter = 1 ^ -compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:13:5: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:13:5: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option allInline ^ -compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:14:5: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:14:5: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option allInline = 1 ^ -compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:17:10: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:17:10: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option base.inlineFunBase {} ^ -compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:18:10: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:18:10: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option base.inlineGetterBase ^ -compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:19:10: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:19:10: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option base.inlineGetterBase = 1 ^ -compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:22:10: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:22:10: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option base.inlineSetterBase = 1 ^ -compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:24:10: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:24:10: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option base.allInlineBase ^ -compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:25:10: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:25:10: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option base.allInlineBase = 1 ^ -compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:32:9: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:32:9: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option inlineFunBase {} ^ -compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:33:9: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:33:9: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option inlineGetterBase ^ -compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:34:9: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:34:9: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option inlineGetterBase = 1 ^ -compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:37:9: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:37:9: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option inlineSetterBase = 1 ^ -compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:39:9: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:39:9: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option allInlineBase ^ -compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:40:9: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/source.kt:40:9: error: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option allInlineBase = 1 ^ COMPILATION_ERROR diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/warningsOnly_1_3.txt b/compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/warningsOnly_1_3.txt index 451f29a417b..410b9f229b7 100644 --- a/compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/warningsOnly_1_3.txt +++ b/compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/warningsOnly_1_3.txt @@ -1,20 +1,20 @@ warning: language version 1.3 is deprecated and its support will be removed in a future version of Kotlin -compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/warningsOnly_1_3.kt:8:9: warning: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/warningsOnly_1_3.kt:8:9: warning: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option inlineFunBase {} ^ -compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/warningsOnly_1_3.kt:9:9: warning: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/warningsOnly_1_3.kt:9:9: warning: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option inlineGetterBase ^ -compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/warningsOnly_1_3.kt:10:9: warning: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/warningsOnly_1_3.kt:10:9: warning: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option inlineGetterBase = 1 ^ -compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/warningsOnly_1_3.kt:13:9: warning: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/warningsOnly_1_3.kt:13:9: warning: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option inlineSetterBase = 1 ^ -compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/warningsOnly_1_3.kt:15:9: warning: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/warningsOnly_1_3.kt:15:9: warning: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option allInlineBase ^ -compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/warningsOnly_1_3.kt:16:9: warning: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option +compiler/testData/compileKotlinAgainstCustomBinaries/wrongInlineTarget/warningsOnly_1_3.kt:16:9: warning: cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option allInlineBase = 1 ^ OK diff --git a/compiler/testData/diagnostics/tests/generics/kt9203.fir.kt b/compiler/testData/diagnostics/tests/generics/kt9203.fir.kt deleted file mode 100644 index dffc4eb33e4..00000000000 --- a/compiler/testData/diagnostics/tests/generics/kt9203.fir.kt +++ /dev/null @@ -1,11 +0,0 @@ -// !WITH_NEW_INFERENCE -// FULL_JDK - -import java.util.stream.Collectors -import java.util.stream.IntStream - -fun main() { - val xs = IntStream.range(0, 10).mapToObj { it.toString() } - .collect(Collectors.toList()) - xs[0] -} diff --git a/compiler/testData/diagnostics/tests/generics/kt9203.kt b/compiler/testData/diagnostics/tests/generics/kt9203.kt index 93fcc651c8a..1ca1e4242b3 100644 --- a/compiler/testData/diagnostics/tests/generics/kt9203.kt +++ b/compiler/testData/diagnostics/tests/generics/kt9203.kt @@ -1,11 +1,11 @@ -// !WITH_NEW_INFERENCE +// FIR_IDENTICAL // FULL_JDK import java.util.stream.Collectors import java.util.stream.IntStream fun main() { - val xs = IntStream.range(0, 10).mapToObj { it.toString() } + val xs = IntStream.range(0, 10).mapToObj { it.toString() } .collect(Collectors.toList()) xs[0] } diff --git a/compiler/testData/diagnostics/tests/j+k/defaultMethods.fir.kt b/compiler/testData/diagnostics/tests/j+k/defaultMethods.fir.kt index d0eeee7ed9c..fb89c234e71 100644 --- a/compiler/testData/diagnostics/tests/j+k/defaultMethods.fir.kt +++ b/compiler/testData/diagnostics/tests/j+k/defaultMethods.fir.kt @@ -1,3 +1,4 @@ +// !JVM_TARGET: 1.6 // FILE: JavaInterface.java public interface JavaInterface { diff --git a/compiler/testData/diagnostics/tests/j+k/defaultMethods.kt b/compiler/testData/diagnostics/tests/j+k/defaultMethods.kt index 1c9e5b23dfe..dd18837b387 100644 --- a/compiler/testData/diagnostics/tests/j+k/defaultMethods.kt +++ b/compiler/testData/diagnostics/tests/j+k/defaultMethods.kt @@ -1,3 +1,4 @@ +// !JVM_TARGET: 1.6 // FILE: JavaInterface.java public interface JavaInterface { diff --git a/compiler/testData/diagnostics/tests/j+k/defaultMethodsIndirectInheritance.fir.kt b/compiler/testData/diagnostics/tests/j+k/defaultMethodsIndirectInheritance.fir.kt index 6aafef0fac0..45be799023e 100644 --- a/compiler/testData/diagnostics/tests/j+k/defaultMethodsIndirectInheritance.fir.kt +++ b/compiler/testData/diagnostics/tests/j+k/defaultMethodsIndirectInheritance.fir.kt @@ -1,3 +1,4 @@ +// !JVM_TARGET: 1.6 // FILE: JavaInterfaceBase.java public interface JavaInterfaceBase { diff --git a/compiler/testData/diagnostics/tests/j+k/defaultMethodsIndirectInheritance.kt b/compiler/testData/diagnostics/tests/j+k/defaultMethodsIndirectInheritance.kt index c4b862e0bba..d10532a2fd1 100644 --- a/compiler/testData/diagnostics/tests/j+k/defaultMethodsIndirectInheritance.kt +++ b/compiler/testData/diagnostics/tests/j+k/defaultMethodsIndirectInheritance.kt @@ -1,3 +1,4 @@ +// !JVM_TARGET: 1.6 // FILE: JavaInterfaceBase.java public interface JavaInterfaceBase { diff --git a/compiler/testData/diagnostics/tests/j+k/defaultMethods_warning.fir.kt b/compiler/testData/diagnostics/tests/j+k/defaultMethods_warning.fir.kt index 298332fb21a..00e24b30071 100644 --- a/compiler/testData/diagnostics/tests/j+k/defaultMethods_warning.fir.kt +++ b/compiler/testData/diagnostics/tests/j+k/defaultMethods_warning.fir.kt @@ -1,4 +1,5 @@ -//!LANGUAGE: -DefaultMethodsCallFromJava6TargetError +// !LANGUAGE: -DefaultMethodsCallFromJava6TargetError +// !JVM_TARGET: 1.6 // FILE: JavaInterface.java public interface JavaInterface { diff --git a/compiler/testData/diagnostics/tests/j+k/defaultMethods_warning.kt b/compiler/testData/diagnostics/tests/j+k/defaultMethods_warning.kt index 24b07f902fc..dd2e491be89 100644 --- a/compiler/testData/diagnostics/tests/j+k/defaultMethods_warning.kt +++ b/compiler/testData/diagnostics/tests/j+k/defaultMethods_warning.kt @@ -1,4 +1,5 @@ -//!LANGUAGE: -DefaultMethodsCallFromJava6TargetError +// !LANGUAGE: -DefaultMethodsCallFromJava6TargetError +// !JVM_TARGET: 1.6 // FILE: JavaInterface.java public interface JavaInterface { diff --git a/compiler/testData/diagnostics/tests/j+k/inheritanceStaticMethodFromInterface.fir.kt b/compiler/testData/diagnostics/tests/j+k/inheritanceStaticMethodFromInterface.fir.kt deleted file mode 100644 index 28d47637209..00000000000 --- a/compiler/testData/diagnostics/tests/j+k/inheritanceStaticMethodFromInterface.fir.kt +++ /dev/null @@ -1,32 +0,0 @@ -// FILE: I.java - -public interface I { - int a = 1; - static void foo() {} -} - -// FILE: C.java - -public class C implements I { - static int b = 1; - static void bar() {} -} - -// FILE: test.kt - -class K : C() - -fun main() { - I.a - I.foo() - - C.a - C.b - C.foo() - C.bar() - - K.a - K.b - K.foo() - K.bar() -} diff --git a/compiler/testData/diagnostics/tests/j+k/inheritanceStaticMethodFromInterface.kt b/compiler/testData/diagnostics/tests/j+k/inheritanceStaticMethodFromInterface.kt index 4abe3f79e7f..eeef118f7dc 100644 --- a/compiler/testData/diagnostics/tests/j+k/inheritanceStaticMethodFromInterface.kt +++ b/compiler/testData/diagnostics/tests/j+k/inheritanceStaticMethodFromInterface.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // FILE: I.java public interface I { @@ -18,7 +19,7 @@ class K : C() fun main() { I.a - I.foo() + I.foo() C.a C.b diff --git a/compiler/testData/diagnostics/tests/j+k/traitDefaultCall.fir.kt b/compiler/testData/diagnostics/tests/j+k/traitDefaultCall.fir.kt index e49d86b7fc5..0dc00cfd49a 100644 --- a/compiler/testData/diagnostics/tests/j+k/traitDefaultCall.fir.kt +++ b/compiler/testData/diagnostics/tests/j+k/traitDefaultCall.fir.kt @@ -1,3 +1,4 @@ +// !JVM_TARGET: 1.6 // FILE: Test.java public interface Test { default String test() { diff --git a/compiler/testData/diagnostics/tests/j+k/traitDefaultCall.kt b/compiler/testData/diagnostics/tests/j+k/traitDefaultCall.kt index 6531848b7c6..ebe5049641c 100644 --- a/compiler/testData/diagnostics/tests/j+k/traitDefaultCall.kt +++ b/compiler/testData/diagnostics/tests/j+k/traitDefaultCall.kt @@ -1,3 +1,4 @@ +// !JVM_TARGET: 1.6 // FILE: Test.java public interface Test { default String test() { diff --git a/compiler/testData/diagnostics/tests/platformTypes/propagateFlexibilityFromOtherConstraints.fir.kt b/compiler/testData/diagnostics/tests/platformTypes/propagateFlexibilityFromOtherConstraints.fir.kt deleted file mode 100644 index 4cbcd0abc0a..00000000000 --- a/compiler/testData/diagnostics/tests/platformTypes/propagateFlexibilityFromOtherConstraints.fir.kt +++ /dev/null @@ -1,32 +0,0 @@ -// FULL_JDK -// FILE: test.kt - -@file:Suppress("UNUSED_PARAMETER") - -import java.util.Comparator - -abstract class DataView { - abstract val presentationName: String -} - -fun comboBox( - model: SortedComboBoxModel, - graphProperty: GraphProperty, -) {} - -class GraphProperty - -fun test() { - val presentationName: (DataView) -> String = { it.presentationName } - val parentComboBoxModel/*: SortedComboBoxModel*/ = SortedComboBoxModel(Comparator.comparing(presentationName)) - comboBox(parentComboBoxModel, GraphProperty()) -} - -// FILE: SortedComboBoxModel.java - -import java.util.Comparator; - -public class SortedComboBoxModel { - public SortedComboBoxModel(Comparator comparator) { - } -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/platformTypes/propagateFlexibilityFromOtherConstraints.kt b/compiler/testData/diagnostics/tests/platformTypes/propagateFlexibilityFromOtherConstraints.kt index de37642cfb4..5f79bc7bbf8 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/propagateFlexibilityFromOtherConstraints.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/propagateFlexibilityFromOtherConstraints.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // FULL_JDK // FILE: test.kt @@ -18,7 +19,7 @@ class GraphProperty fun test() { val presentationName: (DataView) -> String = { it.presentationName } - val parentComboBoxModel/*: SortedComboBoxModel*/ = SortedComboBoxModel(Comparator.comparing(presentationName)) + val parentComboBoxModel/*: SortedComboBoxModel*/ = SortedComboBoxModel(Comparator.comparing(presentationName)) comboBox(parentComboBoxModel, GraphProperty()) } @@ -29,4 +30,4 @@ import java.util.Comparator; public class SortedComboBoxModel { public SortedComboBoxModel(Comparator comparator) { } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/targetedBuiltIns/stream.fir.kt b/compiler/testData/diagnostics/tests/targetedBuiltIns/stream.fir.kt deleted file mode 100644 index 0073efb8034..00000000000 --- a/compiler/testData/diagnostics/tests/targetedBuiltIns/stream.fir.kt +++ /dev/null @@ -1,13 +0,0 @@ -// !WITH_NEW_INFERENCE -// FULL_JDK - -import java.util.stream.* - -interface A : Collection { - override fun stream(): Stream = Stream.of() -} - -fun foo(x: List, y: A) { - x.stream().filter { it.length > 0 }.collect(Collectors.toList()) - y.stream().filter { it.length > 0 } -} diff --git a/compiler/testData/diagnostics/tests/targetedBuiltIns/stream.kt b/compiler/testData/diagnostics/tests/targetedBuiltIns/stream.kt index 678abf38109..5848f2ca42f 100644 --- a/compiler/testData/diagnostics/tests/targetedBuiltIns/stream.kt +++ b/compiler/testData/diagnostics/tests/targetedBuiltIns/stream.kt @@ -1,10 +1,10 @@ -// !WITH_NEW_INFERENCE +// FIR_IDENTICAL // FULL_JDK import java.util.stream.* interface A : Collection { - override fun stream(): Stream = Stream.of() + override fun stream(): Stream = Stream.of() } fun foo(x: List, y: A) { diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/functions_LL13.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/functions_LL13.kt index 7acdbf84d90..621f6dc93c7 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/functions_LL13.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/functions_LL13.kt @@ -28,7 +28,7 @@ class A { interface B { companion object { - @JvmStatic fun a1() { + @JvmStatic fun a1() { } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/interfaceCompanion_LL13_16.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/interfaceCompanion_LL13_16.fir.kt index 073edc66c0f..be8b42471bc 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/interfaceCompanion_LL13_16.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/interfaceCompanion_LL13_16.fir.kt @@ -1,5 +1,7 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE // !LANGUAGE: +JvmStaticInInterface +// !JVM_TARGET: 1.6 + interface B { companion object { @JvmStatic fun a1() { diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/interfaceCompanion_LL13_16.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/interfaceCompanion_LL13_16.kt index 15b17fc94ef..a0837b30a80 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/interfaceCompanion_LL13_16.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/interfaceCompanion_LL13_16.kt @@ -1,5 +1,7 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE // !LANGUAGE: +JvmStaticInInterface +// !JVM_TARGET: 1.6 + interface B { companion object { @JvmStatic fun a1() { diff --git a/compiler/testData/diagnostics/testsWithStdLib/targetedBuiltIns/blackListed.kt b/compiler/testData/diagnostics/testsWithStdLib/targetedBuiltIns/blackListed.kt index 5738db9fc65..45bb362072c 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/targetedBuiltIns/blackListed.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/targetedBuiltIns/blackListed.kt @@ -2,7 +2,7 @@ abstract class A : MutableList { override fun sort(/*0*/ p0: java.util.Comparator) { - super.sort(p0) + super.sort(p0) } } diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java index 241a846a4dd..fa8a769400f 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java @@ -14315,6 +14315,12 @@ 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 { @@ -36048,6 +36054,12 @@ 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 { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BytecodeTextTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BytecodeTextTestGenerated.java index bd3bd77533e..6c133049b2c 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BytecodeTextTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BytecodeTextTestGenerated.java @@ -640,6 +640,12 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest { runTest("compiler/testData/codegen/bytecodeText/boxingOptimization/fold.kt"); } + @Test + @TestMetadata("hashCodeOnNonNull.kt") + public void testHashCodeOnNonNull() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/boxingOptimization/hashCodeOnNonNull.kt"); + } + @Test @TestMetadata("inlineClassesAndInlinedLambda.kt") public void testInlineClassesAndInlinedLambda() throws Exception { @@ -2987,9 +2993,9 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest { } @Test - @TestMetadata("hashCode.kt") - public void testHashCode() throws Exception { - runTest("compiler/testData/codegen/bytecodeText/hashCode/hashCode.kt"); + @TestMetadata("hashCode_1_6.kt") + public void testHashCode_1_6() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/hashCode/hashCode_1_6.kt"); } @Test diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java index f89dfecb257..baa98bc5e7a 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java @@ -14315,6 +14315,12 @@ 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 { @@ -35848,6 +35854,12 @@ 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 { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBytecodeTextTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBytecodeTextTestGenerated.java index 697ca637506..22ab68493f9 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBytecodeTextTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBytecodeTextTestGenerated.java @@ -640,6 +640,12 @@ public class IrBytecodeTextTestGenerated extends AbstractIrBytecodeTextTest { runTest("compiler/testData/codegen/bytecodeText/boxingOptimization/fold.kt"); } + @Test + @TestMetadata("hashCodeOnNonNull.kt") + public void testHashCodeOnNonNull() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/boxingOptimization/hashCodeOnNonNull.kt"); + } + @Test @TestMetadata("inlineClassesAndInlinedLambda.kt") public void testInlineClassesAndInlinedLambda() throws Exception { @@ -3119,9 +3125,9 @@ public class IrBytecodeTextTestGenerated extends AbstractIrBytecodeTextTest { } @Test - @TestMetadata("hashCode.kt") - public void testHashCode() throws Exception { - runTest("compiler/testData/codegen/bytecodeText/hashCode/hashCode.kt"); + @TestMetadata("hashCode_1_6.kt") + public void testHashCode_1_6() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/hashCode/hashCode_1_6.kt"); } @Test diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 45e0b541a0d..bd4b3d744f3 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -12582,6 +12582,11 @@ 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"); @@ -29503,6 +29508,11 @@ 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"); diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt index 7e218e9c4c1..0aa78345f81 100644 --- a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt +++ b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt @@ -526,9 +526,9 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration } fun testWrongInlineTarget() { - val library = compileLibrary("library", additionalOptions = listOf("-jvm-target", "1.8")) + val library = compileLibrary("library", additionalOptions = listOf("-jvm-target", "11")) - compileKotlin("source.kt", tmpdir, listOf(library)) + compileKotlin("source.kt", tmpdir, listOf(library), additionalOptions = listOf("-jvm-target", "1.8")) compileKotlin( "warningsOnly_1_3.kt", tmpdir, listOf(library), diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleFacetImportTest.kt b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleFacetImportTest.kt index 7e318a4ba72..a043149a357 100644 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleFacetImportTest.kt +++ b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleFacetImportTest.kt @@ -104,7 +104,7 @@ class GradleFacetImportTest : GradleImportingTestCase() { Assert.assertFalse(compilerArguments!!.autoAdvanceLanguageVersion) Assert.assertFalse(compilerArguments!!.autoAdvanceApiVersion) Assert.assertEquals(JvmPlatforms.jvm16, targetPlatform) - Assert.assertEquals("1.6", (compilerArguments as K2JVMCompilerArguments).jvmTarget) + Assert.assertEquals("1.8", (compilerArguments as K2JVMCompilerArguments).jvmTarget) Assert.assertEquals( "-Xallow-no-source-files -Xdump-declarations-to=tmpTest", compilerSettings!!.additionalArguments @@ -158,7 +158,7 @@ class GradleFacetImportTest : GradleImportingTestCase() { Assert.assertEquals("1.3", languageLevel!!.versionString) Assert.assertEquals("1.0", apiLevel!!.versionString) Assert.assertEquals(JvmPlatforms.jvm16, targetPlatform) - Assert.assertEquals("1.6", (compilerArguments as K2JVMCompilerArguments).jvmTarget) + Assert.assertEquals("1.8", (compilerArguments as K2JVMCompilerArguments).jvmTarget) Assert.assertEquals( "-Xallow-no-source-files -Xdump-declarations-to=tmpTest", compilerSettings!!.additionalArguments diff --git a/idea/idea-jps-common/src/org/jetbrains/kotlin/platform/impl/JvmIdePlatformKind.kt b/idea/idea-jps-common/src/org/jetbrains/kotlin/platform/impl/JvmIdePlatformKind.kt index 125b8313cab..378d3da152d 100644 --- a/idea/idea-jps-common/src/org/jetbrains/kotlin/platform/impl/JvmIdePlatformKind.kt +++ b/idea/idea-jps-common/src/org/jetbrains/kotlin/platform/impl/JvmIdePlatformKind.kt @@ -38,7 +38,7 @@ object JvmIdePlatformKind : IdePlatformKind() { message = "IdePlatform is deprecated and will be removed soon, please, migrate to org.jetbrains.kotlin.platform.TargetPlatform", level = DeprecationLevel.ERROR ) - override fun getDefaultPlatform(): Platform = Platform(JvmTarget.JVM_1_6) + override fun getDefaultPlatform(): Platform = Platform(JvmTarget.DEFAULT) override fun createArguments(): CommonCompilerArguments { return K2JVMCompilerArguments() diff --git a/idea/testData/checker/JvmStaticUsagesRuntime.kt b/idea/testData/checker/JvmStaticUsagesRuntime.kt index b703a912be2..0232e2efcbf 100644 --- a/idea/testData/checker/JvmStaticUsagesRuntime.kt +++ b/idea/testData/checker/JvmStaticUsagesRuntime.kt @@ -31,7 +31,7 @@ class A { @JvmStatic interface B { companion object { - @JvmStatic fun a1() { + @JvmStatic fun a1() { } } diff --git a/idea/testData/codeInsight/overrideImplement/jdk8/overrideCollectionStream.kt.after b/idea/testData/codeInsight/overrideImplement/jdk8/overrideCollectionStream.kt.after index 40ba4e99cd2..0a11604d3fa 100644 --- a/idea/testData/codeInsight/overrideImplement/jdk8/overrideCollectionStream.kt.after +++ b/idea/testData/codeInsight/overrideImplement/jdk8/overrideCollectionStream.kt.after @@ -1,4 +1,3 @@ -// ERROR: Super calls to Java default methods are prohibited in JVM target 1.6. Recompile with '-jvm-target 1.8' import java.util.stream.Stream abstract class A : List { diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinJvmOptions.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinJvmOptions.kt index 2cb72665d13..700199bfcbd 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinJvmOptions.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinJvmOptions.kt @@ -23,9 +23,9 @@ interface KotlinJvmOptions : org.jetbrains.kotlin.gradle.dsl.KotlinCommonOption var jdkHome: kotlin.String? /** - * Target version of the generated JVM bytecode (1.6, 1.8, 9, 10, 11, 12, 13, 14 or 15), default is 1.6 + * Target version of the generated JVM bytecode (1.6, 1.8, 9, 10, 11, 12, 13, 14 or 15), default is 1.8 * Possible values: "1.6", "1.8", "9", "10", "11", "12", "13", "14", "15" - * Default value: "1.6" + * Default value: "1.8" */ var jvmTarget: kotlin.String diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinJvmOptionsBase.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinJvmOptionsBase.kt index db21b3735dc..b0d0f1263d2 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinJvmOptionsBase.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinJvmOptionsBase.kt @@ -62,7 +62,7 @@ internal abstract class KotlinJvmOptionsBase : org.jetbrains.kotlin.gradle.dsl.K private var jvmTargetField: kotlin.String? = null override var jvmTarget: kotlin.String - get() = jvmTargetField ?: "1.6" + get() = jvmTargetField ?: "1.8" set(value) { jvmTargetField = value } @@ -137,7 +137,7 @@ internal fun org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments.fi includeRuntime = false javaParameters = false jdkHome = null - jvmTarget = "1.6" + jvmTarget = "1.8" moduleName = null noJdk = false noReflect = true