Added tests with type parameter of class in SAM adapter.
This commit is contained in:
@@ -0,0 +1,7 @@
|
|||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
class WeirdComparator<T> {
|
||||||
|
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>()
|
||||||
|
val result = wc.max({ a, b -> a.length - b.length }, "java", "kotlin")
|
||||||
|
if (result != "kotlin") return "Wrong: $result"
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
package test;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class TypeParameterOfClass<T> {
|
||||||
|
public void foo(Comparator<T> comparator) {
|
||||||
|
}
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
public open class TypeParameterOfClass</*0*/ T> : java.lang.Object {
|
||||||
|
public constructor TypeParameterOfClass</*0*/ T>()
|
||||||
|
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
@@ -137,6 +137,11 @@ public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodege
|
|||||||
doTestWithJava("compiler/testData/codegen/boxWithJava/samAdapters/simplest.kt");
|
doTestWithJava("compiler/testData/codegen/boxWithJava/samAdapters/simplest.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("typeParameterOfClass.kt")
|
||||||
|
public void testTypeParameterOfClass() throws Exception {
|
||||||
|
doTestWithJava("compiler/testData/codegen/boxWithJava/samAdapters/typeParameterOfClass.kt");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/boxWithJava/staticFun")
|
@TestMetadata("compiler/testData/codegen/boxWithJava/staticFun")
|
||||||
|
|||||||
@@ -1239,6 +1239,11 @@ public class LoadJavaTestGenerated extends AbstractLoadJavaTest {
|
|||||||
doTestCompiledJava("compiler/testData/loadJava/compiledJava/singleAbstractMethod/adapter/SeveralSamParameters.java");
|
doTestCompiledJava("compiler/testData/loadJava/compiledJava/singleAbstractMethod/adapter/SeveralSamParameters.java");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("TypeParameterOfClass.java")
|
||||||
|
public void testTypeParameterOfClass() throws Exception {
|
||||||
|
doTestCompiledJava("compiler/testData/loadJava/compiledJava/singleAbstractMethod/adapter/TypeParameterOfClass.java");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Test innerSuite() {
|
public static Test innerSuite() {
|
||||||
|
|||||||
Reference in New Issue
Block a user