Switch default JVM target to 1.8

#KT-29405 Fixed
This commit is contained in:
Alexander Udalov
2021-01-21 17:12:46 +01:00
parent 509ed64917
commit d022bb0248
52 changed files with 247 additions and 164 deletions
@@ -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*/ {
}
+1 -1
View File
@@ -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 <path> Include a custom JDK from the specified location into the classpath instead of the default JAVA_HOME
-jvm-target <version> 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 <version> 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> 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
@@ -1,5 +1,6 @@
// TARGET_BACKEND: JVM
// WITH_RUNTIME
// JVM_TARGET: 1.6
@Target(AnnotationTarget.TYPE)
annotation class A
@@ -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<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,6 +1,7 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_REFLECT
// JVM_TARGET: 1.6
import kotlin.reflect.KClass
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
interface I
class C : I { fun foo() = super<I>.hashCode() }
@@ -0,0 +1,11 @@
// 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"
}
@@ -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
@@ -4,4 +4,4 @@ fun box(): String {
return "OK"
}
// 1 INVOKESTATIC java/lang/Integer.valueOf
// 0 INVOKESTATIC java/lang/Integer.valueOf
@@ -15,9 +15,6 @@ fun foo() {
val b = arrayOfNulls<Int>(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
@@ -1,3 +1,5 @@
// JVM_TARGET: 1.6
fun box(): String {
true.hashCode()
1.toByte().hashCode()
@@ -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
// 0 valueOf
// 0 intValue
@@ -1,4 +1,5 @@
// WITH_RUNTIME
// JVM_TARGET: 1.6
val ua = 1234U
val ub = 5678U
@@ -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
@@ -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
@@ -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]
}
+2 -2
View File
@@ -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.<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>range<!>(0, 10).mapToObj { it.toString() }
val xs = IntStream.range(0, 10).mapToObj { it.toString() }
.collect(Collectors.toList())
xs[0]
}
@@ -1,3 +1,4 @@
// !JVM_TARGET: 1.6
// FILE: JavaInterface.java
public interface JavaInterface {
@@ -1,3 +1,4 @@
// !JVM_TARGET: 1.6
// FILE: JavaInterface.java
public interface JavaInterface {
@@ -1,3 +1,4 @@
// !JVM_TARGET: 1.6
// FILE: JavaInterfaceBase.java
public interface JavaInterfaceBase {
@@ -1,3 +1,4 @@
// !JVM_TARGET: 1.6
// FILE: JavaInterfaceBase.java
public interface JavaInterfaceBase {
@@ -1,4 +1,5 @@
//!LANGUAGE: -DefaultMethodsCallFromJava6TargetError
// !LANGUAGE: -DefaultMethodsCallFromJava6TargetError
// !JVM_TARGET: 1.6
// FILE: JavaInterface.java
public interface JavaInterface {
@@ -1,4 +1,5 @@
//!LANGUAGE: -DefaultMethodsCallFromJava6TargetError
// !LANGUAGE: -DefaultMethodsCallFromJava6TargetError
// !JVM_TARGET: 1.6
// FILE: JavaInterface.java
public interface JavaInterface {
@@ -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.<!UNRESOLVED_REFERENCE!>foo<!>()
C.bar()
K.<!UNRESOLVED_REFERENCE!>a<!>
K.<!UNRESOLVED_REFERENCE!>b<!>
K.<!UNRESOLVED_REFERENCE!>foo<!>()
K.<!UNRESOLVED_REFERENCE!>bar<!>()
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// FILE: I.java
public interface I {
@@ -18,7 +19,7 @@ class K : C()
fun main() {
I.a
I.<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>foo<!>()
I.foo()
C.a
C.b
@@ -1,3 +1,4 @@
// !JVM_TARGET: 1.6
// FILE: Test.java
public interface Test {
default String test() {
@@ -1,3 +1,4 @@
// !JVM_TARGET: 1.6
// FILE: Test.java
public interface Test {
default String test() {
@@ -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 <A> comboBox(
model: SortedComboBoxModel<A>,
graphProperty: GraphProperty<A>,
) {}
class GraphProperty<B>
fun test() {
val presentationName: (DataView) -> String = { it.presentationName }
val parentComboBoxModel/*: SortedComboBoxModel<DataView>*/ = SortedComboBoxModel(Comparator.comparing(presentationName))
comboBox(parentComboBoxModel, GraphProperty<DataView>())
}
// FILE: SortedComboBoxModel.java
import java.util.Comparator;
public class SortedComboBoxModel<C> {
public SortedComboBoxModel(Comparator<? super C> comparator) {
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// FULL_JDK
// FILE: test.kt
@@ -18,7 +19,7 @@ class GraphProperty<B>
fun test() {
val presentationName: (DataView) -> String = { it.presentationName }
val parentComboBoxModel/*: SortedComboBoxModel<DataView>*/ = SortedComboBoxModel(Comparator.<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>comparing<!>(presentationName))
val parentComboBoxModel/*: SortedComboBoxModel<DataView>*/ = SortedComboBoxModel(Comparator.comparing(presentationName))
comboBox(parentComboBoxModel, GraphProperty<DataView>())
}
@@ -29,4 +30,4 @@ import java.util.Comparator;
public class SortedComboBoxModel<C> {
public SortedComboBoxModel(Comparator<? super C> comparator) {
}
}
}
@@ -1,13 +0,0 @@
// !WITH_NEW_INFERENCE
// FULL_JDK
import java.util.stream.*
interface A : Collection<String> {
override fun stream(): Stream<String> = Stream.of()
}
fun foo(x: List<String>, y: A) {
x.stream().filter { it.length > 0 }.collect(Collectors.toList())
y.stream().filter { it.length > 0 }
}
@@ -1,10 +1,10 @@
// !WITH_NEW_INFERENCE
// FIR_IDENTICAL
// FULL_JDK
import java.util.stream.*
interface A : Collection<String> {
override fun stream(): Stream<String> = Stream.<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>of<!>()
override fun stream(): Stream<String> = Stream.of()
}
fun foo(x: List<String>, y: A) {
@@ -28,7 +28,7 @@ class A {
interface B {
companion object {
<!JVM_STATIC_IN_INTERFACE_1_6!>@JvmStatic fun a1()<!> {
@JvmStatic fun a1() {
}
}
@@ -1,5 +1,7 @@
// !DIAGNOSTICS: -UNUSED_VARIABLE
// !LANGUAGE: +JvmStaticInInterface
// !JVM_TARGET: 1.6
interface B {
companion object {
@JvmStatic fun a1() {
@@ -1,5 +1,7 @@
// !DIAGNOSTICS: -UNUSED_VARIABLE
// !LANGUAGE: +JvmStaticInInterface
// !JVM_TARGET: 1.6
interface B {
companion object {
<!JVM_STATIC_IN_INTERFACE_1_6!>@JvmStatic fun a1()<!> {
@@ -2,7 +2,7 @@
abstract class A : MutableList<String> {
override fun sort(/*0*/ p0: java.util.Comparator<in String>) {
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>sort<!>(p0)
super.sort(p0)
}
}