Added tests with type parameter of class in SAM adapter.
This commit is contained in:
@@ -0,0 +1,13 @@
|
|||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
class WeirdComparator<T> {
|
||||||
|
public Inner createInner() {
|
||||||
|
return new Inner();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Inner {
|
||||||
|
public T max(Comparator<T> comparator, T value1, T value2) {
|
||||||
|
return comparator.compare(value1, value2) > 0 ? value1 : value2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
fun box(): String {
|
||||||
|
val wc = WeirdComparator<String>().createInner()!!
|
||||||
|
val result = wc.max({ a, b -> a.length - b.length }, "java", "kotlin")
|
||||||
|
if (result != "kotlin") return "Wrong: $result"
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
package test;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class TypeParameterOfOuterClass<T> {
|
||||||
|
public class Inner {
|
||||||
|
public void foo(Comparator<T> comparator) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
public open class TypeParameterOfOuterClass</*0*/ T> : java.lang.Object {
|
||||||
|
public constructor TypeParameterOfOuterClass</*0*/ T>()
|
||||||
|
|
||||||
|
public open inner class Inner : java.lang.Object {
|
||||||
|
public constructor Inner()
|
||||||
|
public open /*synthesized*/ fun foo(/*0*/ p0 : ((T?, T?) -> jet.Int)?) : jet.Unit
|
||||||
|
public open fun foo(/*0*/ p0 : java.util.Comparator<T>?) : jet.Unit
|
||||||
|
}
|
||||||
|
}
|
||||||
+5
@@ -147,6 +147,11 @@ public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodege
|
|||||||
doTestWithJava("compiler/testData/codegen/boxWithJava/samAdapters/typeParameterOfMethod.kt");
|
doTestWithJava("compiler/testData/codegen/boxWithJava/samAdapters/typeParameterOfMethod.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("typeParameterOfOuterClass.kt")
|
||||||
|
public void testTypeParameterOfOuterClass() throws Exception {
|
||||||
|
doTestWithJava("compiler/testData/codegen/boxWithJava/samAdapters/typeParameterOfOuterClass.kt");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/boxWithJava/staticFun")
|
@TestMetadata("compiler/testData/codegen/boxWithJava/staticFun")
|
||||||
|
|||||||
@@ -1249,6 +1249,11 @@ public class LoadJavaTestGenerated extends AbstractLoadJavaTest {
|
|||||||
doTestCompiledJava("compiler/testData/loadJava/compiledJava/singleAbstractMethod/adapter/TypeParameterOfMethod.java");
|
doTestCompiledJava("compiler/testData/loadJava/compiledJava/singleAbstractMethod/adapter/TypeParameterOfMethod.java");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("TypeParameterOfOuterClass.java")
|
||||||
|
public void testTypeParameterOfOuterClass() throws Exception {
|
||||||
|
doTestCompiledJava("compiler/testData/loadJava/compiledJava/singleAbstractMethod/adapter/TypeParameterOfOuterClass.java");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Test innerSuite() {
|
public static Test innerSuite() {
|
||||||
|
|||||||
Reference in New Issue
Block a user