Migrate boxWithJava tests to multi-file framework
This commit is contained in:
+40
-42
@@ -27,88 +27,86 @@ import java.util.regex.Pattern;
|
|||||||
|
|
||||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
||||||
@SuppressWarnings("all")
|
@SuppressWarnings("all")
|
||||||
@TestMetadata("compiler/testData/codegen/java8/boxWithJava")
|
@TestMetadata("compiler/testData/codegen/java8/box")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
public class BlackBoxWithJava8CodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
public class BlackBoxWithJava8CodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||||
public void testAllFilesPresentInBoxWithJava() throws Exception {
|
public void testAllFilesPresentInBox() throws Exception {
|
||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/java8/boxWithJava"), Pattern.compile("^([^\\.]+)$"), true);
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/java8/box"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("defaultMethodCallFromTrait")
|
@TestMetadata("defaultMethodCallFromInterface.kt")
|
||||||
public void testDefaultMethodCallFromTrait() throws Exception {
|
public void testDefaultMethodCallFromInterface() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/boxWithJava/defaultMethodCallFromTrait/");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/box/defaultMethodCallFromInterface.kt");
|
||||||
doTestWithJava(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("defaultMethodCallViaClass")
|
@TestMetadata("defaultMethodCallViaClass.kt")
|
||||||
public void testDefaultMethodCallViaClass() throws Exception {
|
public void testDefaultMethodCallViaClass() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/boxWithJava/defaultMethodCallViaClass/");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/box/defaultMethodCallViaClass.kt");
|
||||||
doTestWithJava(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("defaultMethodCallViaTrait")
|
@TestMetadata("defaultMethodCallViaInterface.kt")
|
||||||
public void testDefaultMethodCallViaTrait() throws Exception {
|
public void testDefaultMethodCallViaInterface() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/boxWithJava/defaultMethodCallViaTrait/");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/box/defaultMethodCallViaInterface.kt");
|
||||||
doTestWithJava(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("defaultMethodOverride")
|
@TestMetadata("defaultMethodOverride.kt")
|
||||||
public void testDefaultMethodOverride() throws Exception {
|
public void testDefaultMethodOverride() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/boxWithJava/defaultMethodOverride/");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/box/defaultMethodOverride.kt");
|
||||||
doTestWithJava(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("dontDelegateToDefaultMethods")
|
@TestMetadata("dontDelegateToDefaultMethods.kt")
|
||||||
public void testDontDelegateToDefaultMethods() throws Exception {
|
public void testDontDelegateToDefaultMethods() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/boxWithJava/dontDelegateToDefaultMethods/");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/box/dontDelegateToDefaultMethods.kt");
|
||||||
doTestWithJava(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("inheritKotlin")
|
@TestMetadata("inheritKotlin.kt")
|
||||||
public void testInheritKotlin() throws Exception {
|
public void testInheritKotlin() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/boxWithJava/inheritKotlin/");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/box/inheritKotlin.kt");
|
||||||
doTestWithJava(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("invokeDefaultViaSuper")
|
@TestMetadata("invokeDefaultViaSuper.kt")
|
||||||
public void testInvokeDefaultViaSuper() throws Exception {
|
public void testInvokeDefaultViaSuper() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/boxWithJava/invokeDefaultViaSuper/");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/box/invokeDefaultViaSuper.kt");
|
||||||
doTestWithJava(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("longChainOfKotlinExtendsFromJavaWithDefault")
|
@TestMetadata("longChainOfKotlinExtendsFromJavaWithDefault.kt")
|
||||||
public void testLongChainOfKotlinExtendsFromJavaWithDefault() throws Exception {
|
public void testLongChainOfKotlinExtendsFromJavaWithDefault() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/boxWithJava/longChainOfKotlinExtendsFromJavaWithDefault/");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/box/longChainOfKotlinExtendsFromJavaWithDefault.kt");
|
||||||
doTestWithJava(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("samOnInterfaceWithDefaultMethod")
|
@TestMetadata("samOnInterfaceWithDefaultMethod.kt")
|
||||||
public void testSamOnInterfaceWithDefaultMethod() throws Exception {
|
public void testSamOnInterfaceWithDefaultMethod() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/boxWithJava/samOnInterfaceWithDefaultMethod/");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/box/samOnInterfaceWithDefaultMethod.kt");
|
||||||
doTestWithJava(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/java8/boxWithJava/reflection")
|
@TestMetadata("compiler/testData/codegen/java8/box/reflection")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
public static class Reflection extends AbstractBlackBoxCodegenTest {
|
public static class Reflection extends AbstractBlackBoxCodegenTest {
|
||||||
public void testAllFilesPresentInReflection() throws Exception {
|
public void testAllFilesPresentInReflection() throws Exception {
|
||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/java8/boxWithJava/reflection"), Pattern.compile("^([^\\.]+)$"), true);
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/java8/box/reflection"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("realParameterNames")
|
@TestMetadata("realParameterNames.kt")
|
||||||
public void testRealParameterNames() throws Exception {
|
public void testRealParameterNames() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/boxWithJava/reflection/realParameterNames/");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/box/reflection/realParameterNames.kt");
|
||||||
doTestWithJava(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("synthesizedParameterNames")
|
@TestMetadata("synthesizedParameterNames.kt")
|
||||||
public void testSynthesizedParameterNames() throws Exception {
|
public void testSynthesizedParameterNames() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/boxWithJava/reflection/synthesizedParameterNames/");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/box/reflection/synthesizedParameterNames.kt");
|
||||||
doTestWithJava(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+24
@@ -1,3 +1,5 @@
|
|||||||
|
// FILE: JavaClass.java
|
||||||
|
|
||||||
public class JavaClass {
|
public class JavaClass {
|
||||||
|
|
||||||
public static class C extends B {
|
public static class C extends B {
|
||||||
@@ -21,3 +23,25 @@ public class JavaClass {
|
|||||||
return "OK";
|
return "OK";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FILE: main.kt
|
||||||
|
|
||||||
|
class OutPair<out X, out Y>(val x: X, val y: Y)
|
||||||
|
class In<in Z> {
|
||||||
|
fun make(x: Z): String = x.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
@JvmSuppressWildcards(suppress = false)
|
||||||
|
interface A {
|
||||||
|
fun foo(): OutPair<CharSequence, Number>
|
||||||
|
fun bar(): In<String>
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class B : A {
|
||||||
|
override fun foo(): OutPair<String, Int> = OutPair("OK", 123)
|
||||||
|
override fun bar(): In<Any> = In()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
return JavaClass.test();
|
||||||
|
}
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
class OutPair<out X, out Y>(val x: X, val y: Y)
|
|
||||||
class In<in Z> {
|
|
||||||
fun make(x: Z): String = x.toString()
|
|
||||||
}
|
|
||||||
|
|
||||||
@JvmSuppressWildcards(suppress = false)
|
|
||||||
interface A {
|
|
||||||
fun foo(): OutPair<CharSequence, Number>
|
|
||||||
fun bar(): In<String>
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class B : A {
|
|
||||||
override fun foo(): OutPair<String, Int> = OutPair("OK", 123)
|
|
||||||
override fun bar(): In<Any> = In()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun box(): String {
|
|
||||||
return JavaClass.test();
|
|
||||||
}
|
|
||||||
Vendored
-4
@@ -1,4 +0,0 @@
|
|||||||
@file:StringHolder("OK")
|
|
||||||
|
|
||||||
fun box(): String =
|
|
||||||
Class.forName("FileFacadeKt").getAnnotation(StringHolder::class.java)?.value ?: "null"
|
|
||||||
+18
@@ -1,3 +1,21 @@
|
|||||||
|
// FILE: Test.java
|
||||||
|
|
||||||
|
class Test {
|
||||||
|
public static Class<?> apply(Runnable x) {
|
||||||
|
return x.getClass();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static interface ABC {
|
||||||
|
void apply(String x1, String x2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Class<?> applyABC(ABC x) {
|
||||||
|
return x.getClass();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: test.kt
|
||||||
|
|
||||||
import java.lang.reflect.Method
|
import java.lang.reflect.Method
|
||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
import java.lang.Runnable;
|
|
||||||
|
|
||||||
class Test {
|
|
||||||
public static Class<?> apply(Runnable x) {
|
|
||||||
return x.getClass();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static interface ABC {
|
|
||||||
void apply(String x1, String x2);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Class<?> applyABC(ABC x) {
|
|
||||||
return x.getClass();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+10
@@ -1,3 +1,13 @@
|
|||||||
|
// FILE: Test.java
|
||||||
|
|
||||||
|
class Test {
|
||||||
|
public static Class<?> apply(Runnable x) {
|
||||||
|
return x.getClass();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: test.kt
|
||||||
|
|
||||||
import java.lang.reflect.Method
|
import java.lang.reflect.Method
|
||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
import java.lang.Runnable;
|
|
||||||
|
|
||||||
class Test {
|
|
||||||
public static Class<?> apply(Runnable x) {
|
|
||||||
return x.getClass();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+11
@@ -1,3 +1,14 @@
|
|||||||
|
// FILE: Test.java
|
||||||
|
|
||||||
|
class O {}
|
||||||
|
class K {}
|
||||||
|
|
||||||
|
@Ann(args={O.class, K.class})
|
||||||
|
class Test {
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: array.kt
|
||||||
|
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
|
|
||||||
@Retention(AnnotationRetention.RUNTIME)
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
class O {}
|
|
||||||
class K {}
|
|
||||||
|
|
||||||
@Ann(args={O.class, K.class})
|
|
||||||
class Test {
|
|
||||||
}
|
|
||||||
+10
@@ -1,3 +1,13 @@
|
|||||||
|
// FILE: Test.java
|
||||||
|
|
||||||
|
class OK {}
|
||||||
|
|
||||||
|
@Ann(arg=OK.class)
|
||||||
|
class Test {
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: basic.kt
|
||||||
|
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
|
|
||||||
@Retention(AnnotationRetention.RUNTIME)
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
class OK {}
|
|
||||||
|
|
||||||
@Ann(arg=OK.class)
|
|
||||||
class Test {
|
|
||||||
}
|
|
||||||
+11
@@ -1,3 +1,14 @@
|
|||||||
|
// FILE: Test.java
|
||||||
|
|
||||||
|
class O {}
|
||||||
|
class K {}
|
||||||
|
|
||||||
|
@Ann(args={O.class, K.class})
|
||||||
|
class Test {
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: vararg.kt
|
||||||
|
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
|
|
||||||
@Retention(AnnotationRetention.RUNTIME)
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
class O {}
|
|
||||||
class K {}
|
|
||||||
|
|
||||||
@Ann(args={O.class, K.class})
|
|
||||||
class Test {
|
|
||||||
}
|
|
||||||
+18
@@ -1,3 +1,5 @@
|
|||||||
|
// FILE: Test.java
|
||||||
|
|
||||||
import java.lang.*;
|
import java.lang.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@@ -8,3 +10,19 @@ public class Test {
|
|||||||
public String setValue(String s) { return null; }
|
public String setValue(String s) { return null; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FILE: main.kt
|
||||||
|
|
||||||
|
//class MyIterable : Test.IterableImpl()
|
||||||
|
//class MyIterator : Test.IteratorImpl()
|
||||||
|
class MyMapEntry : Test.MapEntryImpl()
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
|
||||||
|
val b = MyMapEntry()
|
||||||
|
b.key
|
||||||
|
b.value
|
||||||
|
b.setValue(null)
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
-13
@@ -1,13 +0,0 @@
|
|||||||
//class MyIterable : Test.IterableImpl()
|
|
||||||
//class MyIterator : Test.IteratorImpl()
|
|
||||||
class MyMapEntry : Test.MapEntryImpl()
|
|
||||||
|
|
||||||
fun box(): String {
|
|
||||||
|
|
||||||
val b = MyMapEntry()
|
|
||||||
b.key
|
|
||||||
b.value
|
|
||||||
b.setValue(null)
|
|
||||||
|
|
||||||
return "OK"
|
|
||||||
}
|
|
||||||
+13
@@ -1,3 +1,16 @@
|
|||||||
|
// FILE: Test.java
|
||||||
|
|
||||||
|
public class Test {
|
||||||
|
public static void checkCallFromJava() {
|
||||||
|
try {
|
||||||
|
String x = TestKt.foo().iterator().next();
|
||||||
|
throw new AssertionError("E should have been thrown");
|
||||||
|
} catch (E e) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: test.kt
|
||||||
|
|
||||||
interface MyIterable<T> : Iterable<T>
|
interface MyIterable<T> : Iterable<T>
|
||||||
|
|
||||||
class E : RuntimeException()
|
class E : RuntimeException()
|
||||||
-8
@@ -1,8 +0,0 @@
|
|||||||
public class Test {
|
|
||||||
public static void checkCallFromJava() {
|
|
||||||
try {
|
|
||||||
String x = SubstitutedIterableKt.foo().iterator().next();
|
|
||||||
throw new AssertionError("E should have been thrown");
|
|
||||||
} catch (E e) { }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+17
@@ -1,3 +1,20 @@
|
|||||||
|
// FILE: Test.java
|
||||||
|
|
||||||
|
class Test {
|
||||||
|
interface A {
|
||||||
|
boolean add(String s);
|
||||||
|
}
|
||||||
|
|
||||||
|
static class D extends C {}
|
||||||
|
|
||||||
|
void test() {
|
||||||
|
A a = new D();
|
||||||
|
a.add("lol");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: test.kt
|
||||||
|
|
||||||
abstract class C : Test.A, List<String> {
|
abstract class C : Test.A, List<String> {
|
||||||
override val size: Int get() = null!!
|
override val size: Int get() = null!!
|
||||||
override fun isEmpty(): Boolean = null!!
|
override fun isEmpty(): Boolean = null!!
|
||||||
-12
@@ -1,12 +0,0 @@
|
|||||||
class Test {
|
|
||||||
interface A {
|
|
||||||
boolean add(String s);
|
|
||||||
}
|
|
||||||
|
|
||||||
static class D extends C {}
|
|
||||||
|
|
||||||
void test() {
|
|
||||||
A a = new D();
|
|
||||||
a.add("lol");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
// FILE: JFun.java
|
||||||
|
|
||||||
|
class JFun implements kotlin.jvm.functions.Function0<String> {
|
||||||
|
public String invoke() {
|
||||||
|
return "OK";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: test.kt
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val jfun = JFun()
|
||||||
|
val jf = jfun as Any
|
||||||
|
if (jf is Function0<*>) return jfun()
|
||||||
|
else return "Failed: jf is Function0<*>"
|
||||||
|
}
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
class JFun implements kotlin.jvm.functions.Function0<String> {
|
|
||||||
public String invoke() {
|
|
||||||
return "OK";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
fun box(): String {
|
|
||||||
val jfun = JFun()
|
|
||||||
val jf = jfun as Any
|
|
||||||
if (jf is Function0<*>) return jfun()
|
|
||||||
else return "Failed: jf is Function0<*>"
|
|
||||||
}
|
|
||||||
+10
-1
@@ -1,3 +1,5 @@
|
|||||||
|
// FILE: Box.java
|
||||||
|
|
||||||
public class Box<T> {
|
public class Box<T> {
|
||||||
private final T value;
|
private final T value;
|
||||||
|
|
||||||
@@ -12,4 +14,11 @@ public class Box<T> {
|
|||||||
public T getValue() {
|
public T getValue() {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FILE: test.kt
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val sub = Box<Long>(-1)
|
||||||
|
return if (sub.value == -1L) "OK" else "fail"
|
||||||
|
}
|
||||||
-4
@@ -1,4 +0,0 @@
|
|||||||
fun box(): String {
|
|
||||||
val sub = Box<Long>(-1)
|
|
||||||
return if (sub.value == -1L) "OK" else "fail"
|
|
||||||
}
|
|
||||||
+13
-1
@@ -1,3 +1,15 @@
|
|||||||
|
// FILE: CompanionInitialization.java
|
||||||
|
|
||||||
|
public class CompanionInitialization {
|
||||||
|
|
||||||
|
public static Object getCompanion() {
|
||||||
|
return ConcreteWithStatic.Companion;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: CompanionInitialization.kt
|
||||||
|
|
||||||
interface IStatic
|
interface IStatic
|
||||||
|
|
||||||
open class Static(x: IStatic) {
|
open class Static(x: IStatic) {
|
||||||
@@ -17,4 +29,4 @@ fun box(): String {
|
|||||||
if (companion != ConcreteWithStatic) return "fail 2"
|
if (companion != ConcreteWithStatic) return "fail 2"
|
||||||
|
|
||||||
return "OK"
|
return "OK"
|
||||||
}
|
}
|
||||||
-7
@@ -1,7 +0,0 @@
|
|||||||
public class CompanionInitialization {
|
|
||||||
|
|
||||||
public static Object getCompanion() {
|
|
||||||
return ConcreteWithStatic.Companion;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
public class J {
|
|
||||||
public static int f() {
|
|
||||||
return A.Companion.getI1() + A.Companion.getI2() + B.Named.getI1() + B.Named.getI2();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+34
@@ -1,3 +1,37 @@
|
|||||||
|
// FILE: J.java
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class J {
|
||||||
|
|
||||||
|
public static class B extends A {
|
||||||
|
public int getLength() { return 456; }
|
||||||
|
public char get(int index) {
|
||||||
|
if (index == 1) return 'a';
|
||||||
|
return super.get(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String foo() {
|
||||||
|
B b = new B();
|
||||||
|
CharSequence cs = (CharSequence) b;
|
||||||
|
|
||||||
|
if (cs.length() != 456) return "fail 01";
|
||||||
|
if (b.length() != 456) return "fail 02";
|
||||||
|
if (b.getLength() != 456) return "fail 03";
|
||||||
|
|
||||||
|
if (cs.charAt(0) != 'z') return "fail 1";
|
||||||
|
if (b.get(0) != 'z') return "fail 2";
|
||||||
|
|
||||||
|
if (cs.charAt(1) != 'a') return "fail 3";
|
||||||
|
if (b.get(1) != 'a') return "fail 4";
|
||||||
|
|
||||||
|
return "OK";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: test.kt
|
||||||
|
|
||||||
open class A : CharSequence {
|
open class A : CharSequence {
|
||||||
override val length: Int = 123
|
override val length: Int = 123
|
||||||
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
import java.util.*;
|
|
||||||
|
|
||||||
public class J {
|
|
||||||
|
|
||||||
public static class B extends A {
|
|
||||||
public int getLength() { return 456; }
|
|
||||||
public char get(int index) {
|
|
||||||
if (index == 1) return 'a';
|
|
||||||
return super.get(index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String foo() {
|
|
||||||
B b = new B();
|
|
||||||
CharSequence cs = (CharSequence) b;
|
|
||||||
|
|
||||||
if (cs.length() != 456) return "fail 01";
|
|
||||||
if (b.length() != 456) return "fail 02";
|
|
||||||
if (b.getLength() != 456) return "fail 03";
|
|
||||||
|
|
||||||
if (cs.charAt(0) != 'z') return "fail 1";
|
|
||||||
if (b.get(0) != 'z') return "fail 2";
|
|
||||||
|
|
||||||
if (cs.charAt(1) != 'a') return "fail 3";
|
|
||||||
if (b.get(1) != 'a') return "fail 4";
|
|
||||||
|
|
||||||
return "OK";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+31
@@ -1,3 +1,5 @@
|
|||||||
|
// FILE: J.java
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@@ -62,3 +64,32 @@ public class J extends MyList {
|
|||||||
return super.listIterator();
|
return super.listIterator();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FILE: test.kt
|
||||||
|
|
||||||
|
abstract class MyList : List<String>
|
||||||
|
|
||||||
|
class ListImpl : J() {
|
||||||
|
override val size: Int get() = super.size + 1
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val impl = ListImpl()
|
||||||
|
if (impl.size != 56) return "fail 1"
|
||||||
|
if (!impl.contains("abc")) return "fail 2"
|
||||||
|
|
||||||
|
val l: List<String> = impl
|
||||||
|
|
||||||
|
if (l.size != 56) return "fail 3"
|
||||||
|
if (!l.contains("abc")) return "fail 4"
|
||||||
|
|
||||||
|
val anyList: List<Any?> = impl as List<Any?>
|
||||||
|
|
||||||
|
if (anyList.size != 56) return "fail 5"
|
||||||
|
if (!anyList.contains("abc")) return "fail 6"
|
||||||
|
|
||||||
|
if (anyList.contains(1)) return "fail 7"
|
||||||
|
if (anyList.contains(null)) return "fail 8"
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
-26
@@ -1,26 +0,0 @@
|
|||||||
abstract class MyList : List<String>
|
|
||||||
|
|
||||||
class ListImpl : J() {
|
|
||||||
override val size: Int get() = super.size + 1
|
|
||||||
}
|
|
||||||
|
|
||||||
fun box(): String {
|
|
||||||
val impl = ListImpl()
|
|
||||||
if (impl.size != 56) return "fail 1"
|
|
||||||
if (!impl.contains("abc")) return "fail 2"
|
|
||||||
|
|
||||||
val l: List<String> = impl
|
|
||||||
|
|
||||||
if (l.size != 56) return "fail 3"
|
|
||||||
if (!l.contains("abc")) return "fail 4"
|
|
||||||
|
|
||||||
val anyList: List<Any?> = impl as List<Any?>
|
|
||||||
|
|
||||||
if (anyList.size != 56) return "fail 5"
|
|
||||||
if (!anyList.contains("abc")) return "fail 6"
|
|
||||||
|
|
||||||
if (anyList.contains(1)) return "fail 7"
|
|
||||||
if (anyList.contains(null)) return "fail 8"
|
|
||||||
|
|
||||||
return "OK"
|
|
||||||
}
|
|
||||||
+13
@@ -1,3 +1,5 @@
|
|||||||
|
// FILE: J.java
|
||||||
|
|
||||||
public class J {
|
public class J {
|
||||||
abstract static public class AImpl {
|
abstract static public class AImpl {
|
||||||
public char charAt(int index) {
|
public char charAt(int index) {
|
||||||
@@ -13,3 +15,14 @@ public class J {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FILE: test.kt
|
||||||
|
|
||||||
|
class X : J.A()
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val x = X()
|
||||||
|
if (x.length != 56) return "fail 1"
|
||||||
|
if (x[0] != 'A') return "fail 2"
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
-9
@@ -1,9 +0,0 @@
|
|||||||
|
|
||||||
class X : J.A()
|
|
||||||
|
|
||||||
fun box(): String {
|
|
||||||
val x = X()
|
|
||||||
if (x.length != 56) return "fail 1"
|
|
||||||
if (x[0] != 'A') return "fail 2"
|
|
||||||
return "OK"
|
|
||||||
}
|
|
||||||
+12
@@ -1,3 +1,15 @@
|
|||||||
|
// FILE: J.java
|
||||||
|
|
||||||
|
public class J {
|
||||||
|
public static class A extends AImpl implements CharSequence {
|
||||||
|
public CharSequence subSequence(int start, int end) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: test.kt
|
||||||
|
|
||||||
abstract class AImpl {
|
abstract class AImpl {
|
||||||
fun charAt(index: Int): Char {
|
fun charAt(index: Int): Char {
|
||||||
return 'A'
|
return 'A'
|
||||||
-7
@@ -1,7 +0,0 @@
|
|||||||
public class J {
|
|
||||||
public static class A extends AImpl implements CharSequence {
|
|
||||||
public CharSequence subSequence(int start, int end) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+14
@@ -1,3 +1,5 @@
|
|||||||
|
// FILE: J.java
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
public class J {
|
public class J {
|
||||||
abstract static public class AImpl {
|
abstract static public class AImpl {
|
||||||
@@ -97,3 +99,15 @@ public class J {
|
|||||||
public static class A extends AImpl implements List<String> {
|
public static class A extends AImpl implements List<String> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FILE: test.kt
|
||||||
|
|
||||||
|
class X : J.A()
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val x = X()
|
||||||
|
if (x.size != 56) return "fail 1"
|
||||||
|
if (!x.contains("")) return "fail 2"
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
-10
@@ -1,10 +0,0 @@
|
|||||||
|
|
||||||
class X : J.A()
|
|
||||||
|
|
||||||
fun box(): String {
|
|
||||||
val x = X()
|
|
||||||
if (x.size != 56) return "fail 1"
|
|
||||||
if (!x.contains("")) return "fail 2"
|
|
||||||
|
|
||||||
return "OK"
|
|
||||||
}
|
|
||||||
+9
@@ -1,3 +1,12 @@
|
|||||||
|
// FILE: A.java
|
||||||
|
|
||||||
|
public class A extends AImpl implements java.util.List<String> {
|
||||||
|
public <T> T[] toArray(T[] a) {return null;}
|
||||||
|
public Object[] toArray() {return null;}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: test.kt
|
||||||
|
|
||||||
public abstract class AImpl {
|
public abstract class AImpl {
|
||||||
fun add(element: String): Boolean {
|
fun add(element: String): Boolean {
|
||||||
throw UnsupportedOperationException()
|
throw UnsupportedOperationException()
|
||||||
-4
@@ -1,4 +0,0 @@
|
|||||||
public class A extends AImpl implements java.util.List<String> {
|
|
||||||
public <T> T[] toArray(T[] a) {return null;}
|
|
||||||
public Object[] toArray() {return null;}
|
|
||||||
}
|
|
||||||
+14
@@ -1,3 +1,5 @@
|
|||||||
|
// FILE: J.java
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
public class J {
|
public class J {
|
||||||
abstract static public class AImpl<E> {
|
abstract static public class AImpl<E> {
|
||||||
@@ -97,3 +99,15 @@ public class J {
|
|||||||
public static class A<E> extends AImpl<E> implements List<E> {
|
public static class A<E> extends AImpl<E> implements List<E> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FILE: test.kt
|
||||||
|
|
||||||
|
class X : J.A<Any?>()
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val x = X()
|
||||||
|
if (x.size != 56) return "fail 1"
|
||||||
|
if (!x.contains(null)) return "fail 2"
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
-10
@@ -1,10 +0,0 @@
|
|||||||
|
|
||||||
class X : J.A<Any?>()
|
|
||||||
|
|
||||||
fun box(): String {
|
|
||||||
val x = X()
|
|
||||||
if (x.size != 56) return "fail 1"
|
|
||||||
if (!x.contains(null)) return "fail 2"
|
|
||||||
|
|
||||||
return "OK"
|
|
||||||
}
|
|
||||||
+10
@@ -1,3 +1,13 @@
|
|||||||
|
// FILE: J.java
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class J implements Container {
|
||||||
|
final public String removeAt(int index) { return "abc"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: test.kt
|
||||||
|
|
||||||
interface Container {
|
interface Container {
|
||||||
fun removeAt(x: Int): String
|
fun removeAt(x: Int): String
|
||||||
}
|
}
|
||||||
-5
@@ -1,5 +0,0 @@
|
|||||||
import java.util.*;
|
|
||||||
|
|
||||||
public class J implements Container {
|
|
||||||
final public String removeAt(int index) { return "abc"; }
|
|
||||||
}
|
|
||||||
+10
@@ -1,3 +1,13 @@
|
|||||||
|
// FILE: J.java
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class J implements Sized {
|
||||||
|
final public int getSize() { return 123; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: test.kt
|
||||||
|
|
||||||
interface Sized {
|
interface Sized {
|
||||||
val size: Int
|
val size: Int
|
||||||
}
|
}
|
||||||
-5
@@ -1,5 +0,0 @@
|
|||||||
import java.util.*;
|
|
||||||
|
|
||||||
public class J implements Sized {
|
|
||||||
final public int getSize() { return 123; }
|
|
||||||
}
|
|
||||||
+18
@@ -1,3 +1,21 @@
|
|||||||
|
// FILE: J.java
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class J {
|
||||||
|
|
||||||
|
private static class MyList<E> extends KList<E> {}
|
||||||
|
|
||||||
|
public static String foo() {
|
||||||
|
Collection<String> collection = new MyList<String>();
|
||||||
|
if (!collection.contains("ABCDE")) return "fail 1";
|
||||||
|
if (!collection.containsAll(Arrays.asList(1, 2, 3))) return "fail 2";
|
||||||
|
return "OK";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: test.kt
|
||||||
|
|
||||||
open class KList<E> : MutableList<E> {
|
open class KList<E> : MutableList<E> {
|
||||||
override fun add(e: E): Boolean {
|
override fun add(e: E): Boolean {
|
||||||
throw UnsupportedOperationException()
|
throw UnsupportedOperationException()
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
import java.util.*;
|
|
||||||
|
|
||||||
public class J {
|
|
||||||
|
|
||||||
private static class MyList<E> extends KList<E> {}
|
|
||||||
|
|
||||||
public static String foo() {
|
|
||||||
Collection<String> collection = new MyList<String>();
|
|
||||||
if (!collection.contains("ABCDE")) return "fail 1";
|
|
||||||
if (!collection.containsAll(Arrays.asList(1, 2, 3))) return "fail 2";
|
|
||||||
return "OK";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+13
-1
@@ -1,3 +1,15 @@
|
|||||||
|
// FILE: J.java
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class J {
|
||||||
|
public static String nullValue() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: test.kt
|
||||||
|
|
||||||
class MySet : Set<String> {
|
class MySet : Set<String> {
|
||||||
override val size: Int
|
override val size: Int
|
||||||
get() = throw UnsupportedOperationException()
|
get() = throw UnsupportedOperationException()
|
||||||
@@ -37,4 +49,4 @@ fun box(): String {
|
|||||||
null in anySet
|
null in anySet
|
||||||
|
|
||||||
return "OK"
|
return "OK"
|
||||||
}
|
}
|
||||||
-7
@@ -1,7 +0,0 @@
|
|||||||
import java.util.*;
|
|
||||||
|
|
||||||
public class J {
|
|
||||||
public static String nullValue() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+19
-1
@@ -1,3 +1,21 @@
|
|||||||
|
// FILE: J.java
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class J {
|
||||||
|
|
||||||
|
private static class MyList<E> extends KList<E> {}
|
||||||
|
|
||||||
|
public static String foo() {
|
||||||
|
Collection<String> collection = new MyList<String>();
|
||||||
|
if (!collection.contains("ABCDE")) return "fail 1";
|
||||||
|
if (!collection.containsAll(Arrays.asList(1, 2, 3))) return "fail 2";
|
||||||
|
return "OK";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: test.kt
|
||||||
|
|
||||||
open class KList<E> : List<E> {
|
open class KList<E> : List<E> {
|
||||||
override val size: Int
|
override val size: Int
|
||||||
get() = throw UnsupportedOperationException()
|
get() = throw UnsupportedOperationException()
|
||||||
@@ -37,4 +55,4 @@ open class KList<E> : List<E> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun box() = J.foo()
|
fun box() = J.foo()
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
import java.util.*;
|
|
||||||
|
|
||||||
public class J {
|
|
||||||
|
|
||||||
private static class MyList<E> extends KList<E> {}
|
|
||||||
|
|
||||||
public static String foo() {
|
|
||||||
Collection<String> collection = new MyList<String>();
|
|
||||||
if (!collection.contains("ABCDE")) return "fail 1";
|
|
||||||
if (!collection.containsAll(Arrays.asList(1, 2, 3))) return "fail 2";
|
|
||||||
return "OK";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+18
@@ -1,3 +1,21 @@
|
|||||||
|
// FILE: J.java
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class J {
|
||||||
|
|
||||||
|
private static class MyMap<K, V> extends KMap<K, V> {}
|
||||||
|
|
||||||
|
public static String foo() {
|
||||||
|
Map<String, Integer> collection = new MyMap<String, Integer>();
|
||||||
|
if (!collection.containsKey("ABCDE")) return "fail 1";
|
||||||
|
if (!collection.containsValue(1)) return "fail 2";
|
||||||
|
return "OK";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: test.kt
|
||||||
|
|
||||||
open class KMap<K, V> : Map<K, V> {
|
open class KMap<K, V> : Map<K, V> {
|
||||||
override val size: Int
|
override val size: Int
|
||||||
get() = throw UnsupportedOperationException()
|
get() = throw UnsupportedOperationException()
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
import java.util.*;
|
|
||||||
|
|
||||||
public class J {
|
|
||||||
|
|
||||||
private static class MyMap<K, V> extends KMap<K, V> {}
|
|
||||||
|
|
||||||
public static String foo() {
|
|
||||||
Map<String, Integer> collection = new MyMap<String, Integer>();
|
|
||||||
if (!collection.containsKey("ABCDE")) return "fail 1";
|
|
||||||
if (!collection.containsValue(1)) return "fail 2";
|
|
||||||
return "OK";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+26
-1
@@ -1,3 +1,28 @@
|
|||||||
|
// FILE: J.java
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class J {
|
||||||
|
|
||||||
|
private static class MyList extends A {}
|
||||||
|
|
||||||
|
public static String foo() {
|
||||||
|
MyList myList = new MyList();
|
||||||
|
List<Integer> list = (List<Integer>) myList;
|
||||||
|
|
||||||
|
if (!list.remove((Integer) 1)) return "fail 1";
|
||||||
|
if (list.remove((int) 1) != 123) return "fail 2";
|
||||||
|
|
||||||
|
if (!myList.remove((Integer) 1)) return "fail 3";
|
||||||
|
if (myList.remove((int) 1) != 123) return "fail 4";
|
||||||
|
|
||||||
|
if (myList.removeAt(1) != 123) return "fail 5";
|
||||||
|
return "OK";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: test.kt
|
||||||
|
|
||||||
open class A : MutableList<Int> {
|
open class A : MutableList<Int> {
|
||||||
override val size: Int
|
override val size: Int
|
||||||
get() = throw UnsupportedOperationException()
|
get() = throw UnsupportedOperationException()
|
||||||
@@ -76,4 +101,4 @@ open class A : MutableList<Int> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun box() = J.foo()
|
fun box() = J.foo()
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
import java.util.*;
|
|
||||||
|
|
||||||
public class J {
|
|
||||||
|
|
||||||
private static class MyList extends A {}
|
|
||||||
|
|
||||||
public static String foo() {
|
|
||||||
MyList myList = new MyList();
|
|
||||||
List<Integer> list = (List<Integer>) myList;
|
|
||||||
|
|
||||||
if (!list.remove((Integer) 1)) return "fail 1";
|
|
||||||
if (list.remove((int) 1) != 123) return "fail 2";
|
|
||||||
|
|
||||||
if (!myList.remove((Integer) 1)) return "fail 3";
|
|
||||||
if (myList.remove((int) 1) != 123) return "fail 4";
|
|
||||||
|
|
||||||
if (myList.removeAt(1) != 123) return "fail 5";
|
|
||||||
return "OK";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+18
@@ -1,3 +1,21 @@
|
|||||||
|
// FILE: J.java
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class J {
|
||||||
|
|
||||||
|
private static class MyList extends KList {}
|
||||||
|
|
||||||
|
public static String foo() {
|
||||||
|
Collection<String> collection = new MyList();
|
||||||
|
if (!collection.contains("ABCDE")) return "fail 1";
|
||||||
|
if (!collection.containsAll(Arrays.asList(1, 2, 3))) return "fail 2";
|
||||||
|
return "OK";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: test.kt
|
||||||
|
|
||||||
abstract class KList : MutableList<String> {
|
abstract class KList : MutableList<String> {
|
||||||
override val size: Int
|
override val size: Int
|
||||||
get() = throw UnsupportedOperationException()
|
get() = throw UnsupportedOperationException()
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
import java.util.*;
|
|
||||||
|
|
||||||
public class J {
|
|
||||||
|
|
||||||
private static class MyList extends KList {}
|
|
||||||
|
|
||||||
public static String foo() {
|
|
||||||
Collection<String> collection = new MyList();
|
|
||||||
if (!collection.contains("ABCDE")) return "fail 1";
|
|
||||||
if (!collection.containsAll(Arrays.asList(1, 2, 3))) return "fail 2";
|
|
||||||
return "OK";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+10
@@ -1,3 +1,13 @@
|
|||||||
|
// FILE: J.java
|
||||||
|
|
||||||
|
public class J {
|
||||||
|
public static int f() {
|
||||||
|
return A.Companion.getI1() + A.Companion.getI2() + B.Named.getI1() + B.Named.getI2();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: test.kt
|
||||||
|
|
||||||
class A {
|
class A {
|
||||||
companion object {
|
companion object {
|
||||||
val i1 = 1
|
val i1 = 1
|
||||||
+23
@@ -1,3 +1,5 @@
|
|||||||
|
// FILE: JavaClass.java
|
||||||
|
|
||||||
public class JavaClass {
|
public class JavaClass {
|
||||||
|
|
||||||
public static class C extends B {
|
public static class C extends B {
|
||||||
@@ -21,3 +23,24 @@ public class JavaClass {
|
|||||||
return "OK";
|
return "OK";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FILE: main.kt
|
||||||
|
|
||||||
|
class OutPair<out X, out Y>(val x: X, val y: Y)
|
||||||
|
class In<in Z> {
|
||||||
|
fun make(x: Z): String = x.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
interface A {
|
||||||
|
fun foo(): OutPair<@JvmWildcard CharSequence, @JvmSuppressWildcards(false) Number>
|
||||||
|
fun bar(): In<@JvmWildcard String>
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class B : A {
|
||||||
|
override fun foo(): OutPair<String, Int> = OutPair("OK", 123)
|
||||||
|
override fun bar(): In<Any> = In()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
return JavaClass.test();
|
||||||
|
}
|
||||||
Vendored
-18
@@ -1,18 +0,0 @@
|
|||||||
class OutPair<out X, out Y>(val x: X, val y: Y)
|
|
||||||
class In<in Z> {
|
|
||||||
fun make(x: Z): String = x.toString()
|
|
||||||
}
|
|
||||||
|
|
||||||
interface A {
|
|
||||||
fun foo(): OutPair<@JvmWildcard CharSequence, @JvmSuppressWildcards(false) Number>
|
|
||||||
fun bar(): In<@JvmWildcard String>
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class B : A {
|
|
||||||
override fun foo(): OutPair<String, Int> = OutPair("OK", 123)
|
|
||||||
override fun bar(): In<Any> = In()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun box(): String {
|
|
||||||
return JavaClass.test();
|
|
||||||
}
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
public class B {
|
|
||||||
public static int a = A.INSTANCE.getC();
|
|
||||||
public static int b = A.INSTANCE.foo();
|
|
||||||
}
|
|
||||||
Vendored
-10
@@ -1,10 +0,0 @@
|
|||||||
import B
|
|
||||||
|
|
||||||
object A {
|
|
||||||
val c = 1
|
|
||||||
fun foo() = 4
|
|
||||||
}
|
|
||||||
|
|
||||||
fun box(): String {
|
|
||||||
return if (B.a == 1 && B.b == 4) "OK" else "${B.a} ${B.b}"
|
|
||||||
}
|
|
||||||
+6
@@ -1,3 +1,5 @@
|
|||||||
|
// FILE: J.java
|
||||||
|
|
||||||
public class J {
|
public class J {
|
||||||
// This test checks that although type '@org.jetbrains.annotations.NotNull Integer' is perceived as simple Int,
|
// This test checks that although type '@org.jetbrains.annotations.NotNull Integer' is perceived as simple Int,
|
||||||
// it's correctly mapped to 'Lj.l.Integer' by JVM backend
|
// it's correctly mapped to 'Lj.l.Integer' by JVM backend
|
||||||
@@ -5,3 +7,7 @@ public class J {
|
|||||||
return "OK";
|
return "OK";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FILE: box.kt
|
||||||
|
|
||||||
|
fun box() = J.test(1)
|
||||||
@@ -1 +0,0 @@
|
|||||||
fun box() = J.test(1)
|
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
// FILE: Baz.java
|
||||||
|
|
||||||
|
public class Baz {
|
||||||
|
public static String baz() {
|
||||||
|
return Foo.foo() + Bar.bar();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: bar.kt
|
||||||
|
|
||||||
|
@file:JvmName("Bar")
|
||||||
|
public fun bar(): String = "K"
|
||||||
|
|
||||||
|
// FILE: foo.kt
|
||||||
|
|
||||||
|
@file:JvmName("Foo")
|
||||||
|
public fun foo(): String = "O"
|
||||||
|
|
||||||
|
// FILE: test.kt
|
||||||
|
|
||||||
|
fun box(): String = Baz.baz()
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
public class Baz {
|
|
||||||
public static String baz() {
|
|
||||||
return Foo.foo() + Bar.bar();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
@file:JvmName("Bar")
|
|
||||||
public fun bar(): String = "K"
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
fun box(): String = Baz.baz()
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
@file:JvmName("Foo")
|
|
||||||
public fun foo(): String = "O"
|
|
||||||
+10
-1
@@ -1,3 +1,5 @@
|
|||||||
|
// FILE: StringHolder.java
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.ElementType;
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
@@ -7,4 +9,11 @@ import java.lang.annotation.Target;
|
|||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
public @interface StringHolder {
|
public @interface StringHolder {
|
||||||
public String value();
|
public String value();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FILE: fileFacade.kt
|
||||||
|
|
||||||
|
@file:StringHolder("OK")
|
||||||
|
|
||||||
|
fun box(): String =
|
||||||
|
Class.forName("FileFacadeKt").getAnnotation(StringHolder::class.java)?.value ?: "null"
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
// FILE: Baz.java
|
||||||
|
|
||||||
|
public class Baz {
|
||||||
|
public static String baz() {
|
||||||
|
return Util.foo() + Util.bar();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: bar.kt
|
||||||
|
|
||||||
|
@file:JvmName("Util")
|
||||||
|
@file:JvmMultifileClass
|
||||||
|
public fun bar(): String = "K"
|
||||||
|
|
||||||
|
// FILE: foo.kt
|
||||||
|
|
||||||
|
@file:[JvmName("Util") JvmMultifileClass]
|
||||||
|
public fun foo(): String = "O"
|
||||||
|
|
||||||
|
// FILE: test.kt
|
||||||
|
|
||||||
|
fun box(): String = Baz.baz()
|
||||||
-5
@@ -1,5 +0,0 @@
|
|||||||
public class Baz {
|
|
||||||
public static String baz() {
|
|
||||||
return Util.foo() + Util.bar();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
@file:JvmName("Util")
|
|
||||||
@file:JvmMultifileClass
|
|
||||||
public fun bar(): String = "K"
|
|
||||||
-2
@@ -1,2 +0,0 @@
|
|||||||
@file:[JvmName("Util") JvmMultifileClass]
|
|
||||||
public fun foo(): String = "O"
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
fun box(): String = Baz.baz()
|
|
||||||
+27
@@ -0,0 +1,27 @@
|
|||||||
|
// FILE: Baz.java
|
||||||
|
|
||||||
|
public class Baz {
|
||||||
|
public static String baz() {
|
||||||
|
return Util.foo() + Util.bar();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: bar.kt
|
||||||
|
|
||||||
|
@file:JvmName("Util")
|
||||||
|
@file:JvmMultifileClass
|
||||||
|
public fun bar(): String = barx()
|
||||||
|
|
||||||
|
public fun foox(): String = "O"
|
||||||
|
|
||||||
|
// FILE: foo.kt
|
||||||
|
|
||||||
|
@file:JvmName("Util")
|
||||||
|
@file:JvmMultifileClass
|
||||||
|
public fun foo(): String = foox()
|
||||||
|
|
||||||
|
public fun barx(): String = "K"
|
||||||
|
|
||||||
|
// FILE: test.kt
|
||||||
|
|
||||||
|
fun box(): String = Baz.baz()
|
||||||
-5
@@ -1,5 +0,0 @@
|
|||||||
public class Baz {
|
|
||||||
public static String baz() {
|
|
||||||
return Util.foo() + Util.bar();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-5
@@ -1,5 +0,0 @@
|
|||||||
@file:JvmName("Util")
|
|
||||||
@file:JvmMultifileClass
|
|
||||||
public fun bar(): String = barx()
|
|
||||||
|
|
||||||
public fun foox(): String = "O"
|
|
||||||
-5
@@ -1,5 +0,0 @@
|
|||||||
@file:JvmName("Util")
|
|
||||||
@file:JvmMultifileClass
|
|
||||||
public fun foo(): String = foox()
|
|
||||||
|
|
||||||
public fun barx(): String = "K"
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
fun box(): String = Baz.baz()
|
|
||||||
+27
@@ -0,0 +1,27 @@
|
|||||||
|
// FILE: Baz.java
|
||||||
|
|
||||||
|
public class Baz {
|
||||||
|
public static String baz() {
|
||||||
|
return Util.foo() + Util.bar();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: bar.kt
|
||||||
|
|
||||||
|
@file:JvmName("Util")
|
||||||
|
@file:JvmMultifileClass
|
||||||
|
public fun bar(): String = barx()
|
||||||
|
|
||||||
|
private fun barx(): String = "K"
|
||||||
|
|
||||||
|
// FILE: foo.kt
|
||||||
|
|
||||||
|
@file:JvmName("Util")
|
||||||
|
@file:JvmMultifileClass
|
||||||
|
public fun foo(): String = foox()
|
||||||
|
|
||||||
|
private fun foox(): String = "O"
|
||||||
|
|
||||||
|
// FILE: test.kt
|
||||||
|
|
||||||
|
fun box(): String = Baz.baz()
|
||||||
-5
@@ -1,5 +0,0 @@
|
|||||||
public class Baz {
|
|
||||||
public static String baz() {
|
|
||||||
return Util.foo() + Util.bar();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-5
@@ -1,5 +0,0 @@
|
|||||||
@file:JvmName("Util")
|
|
||||||
@file:JvmMultifileClass
|
|
||||||
public fun bar(): String = barx()
|
|
||||||
|
|
||||||
private fun barx(): String = "K"
|
|
||||||
-5
@@ -1,5 +0,0 @@
|
|||||||
@file:JvmName("Util")
|
|
||||||
@file:JvmMultifileClass
|
|
||||||
public fun foo(): String = foox()
|
|
||||||
|
|
||||||
private fun foox(): String = "O"
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
fun box(): String = Baz.baz()
|
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
// FILE: Bar.java
|
||||||
|
|
||||||
|
public class Bar {
|
||||||
|
public static String bar() {
|
||||||
|
return Foo.foo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: foo.kt
|
||||||
|
|
||||||
|
@file:JvmName("Foo")
|
||||||
|
public fun foo(): String = "OK"
|
||||||
|
|
||||||
|
// FILE: simple.kt
|
||||||
|
|
||||||
|
fun box(): String = Bar.bar()
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
public class Bar {
|
|
||||||
public static String bar() {
|
|
||||||
return Foo.foo();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
@file:JvmName("Foo")
|
|
||||||
public fun foo(): String = "OK"
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
fun box(): String = Bar.bar()
|
|
||||||
+27
@@ -0,0 +1,27 @@
|
|||||||
|
// FILE: Test.java
|
||||||
|
|
||||||
|
public class Test {
|
||||||
|
|
||||||
|
protected String data = "O";
|
||||||
|
|
||||||
|
protected Test() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static String testStatic() {
|
||||||
|
return "K";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: test.kt
|
||||||
|
|
||||||
|
public inline fun test(): String {
|
||||||
|
val p = object : Test() {}
|
||||||
|
return p.data + Test.testStatic();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
return test()
|
||||||
|
}
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
public class Test {
|
|
||||||
|
|
||||||
protected String data = "O";
|
|
||||||
|
|
||||||
protected Test() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static String testStatic() {
|
|
||||||
return "K";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
|
|
||||||
public inline fun test(): String {
|
|
||||||
val p = object : Test() {}
|
|
||||||
return p.data + Test.testStatic();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
fun box(): String {
|
|
||||||
return test()
|
|
||||||
}
|
|
||||||
+13
-1
@@ -1,3 +1,15 @@
|
|||||||
|
// FILE: JavaClass.java
|
||||||
|
|
||||||
|
public abstract class JavaClass {
|
||||||
|
public abstract InnerClass onCreateInner();
|
||||||
|
|
||||||
|
public class InnerClass {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: Kotlin.kt
|
||||||
|
|
||||||
public class MyWallpaperService : JavaClass() {
|
public class MyWallpaperService : JavaClass() {
|
||||||
override fun onCreateInner(): JavaClass.InnerClass = MyEngine()
|
override fun onCreateInner(): JavaClass.InnerClass = MyEngine()
|
||||||
|
|
||||||
@@ -6,4 +18,4 @@ public class MyWallpaperService : JavaClass() {
|
|||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
return if (MyWallpaperService().onCreateInner() != null) return "OK" else "fail"
|
return if (MyWallpaperService().onCreateInner() != null) return "OK" else "fail"
|
||||||
}
|
}
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
public abstract class JavaClass {
|
|
||||||
public abstract InnerClass onCreateInner();
|
|
||||||
|
|
||||||
public class InnerClass {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+10
@@ -1,3 +1,13 @@
|
|||||||
|
// FILE: JavaClass.java
|
||||||
|
|
||||||
|
public abstract class JavaClass {
|
||||||
|
public static String test() {
|
||||||
|
return Test.INSTANCE.foo(new Outer<String>("OK").new Inner<Integer>(1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: Kotlin.kt
|
||||||
|
|
||||||
class Outer<E>(val x: E) {
|
class Outer<E>(val x: E) {
|
||||||
inner class Inner<F>(val y: F) {
|
inner class Inner<F>(val y: F) {
|
||||||
fun foo() = x.toString() + y.toString()
|
fun foo() = x.toString() + y.toString()
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
public abstract class JavaClass {
|
|
||||||
public static String test() {
|
|
||||||
return Test.INSTANCE.foo(new Outer<String>("OK").new Inner<Integer>(1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+13
-1
@@ -1,3 +1,15 @@
|
|||||||
|
// FILE: CompanionInitialization.java
|
||||||
|
|
||||||
|
public class CompanionInitialization {
|
||||||
|
|
||||||
|
public static Object getCompanion() {
|
||||||
|
return IStatic.Companion;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: CompanionInitialization.kt
|
||||||
|
|
||||||
open class Static(): IStatic {
|
open class Static(): IStatic {
|
||||||
val p = IStatic::class.java.getDeclaredField("const").get(null)
|
val p = IStatic::class.java.getDeclaredField("const").get(null)
|
||||||
}
|
}
|
||||||
@@ -19,4 +31,4 @@ fun box(): String {
|
|||||||
if (companion != IStatic) return "fail 2"
|
if (companion != IStatic) return "fail 2"
|
||||||
|
|
||||||
return "OK"
|
return "OK"
|
||||||
}
|
}
|
||||||
-7
@@ -1,7 +0,0 @@
|
|||||||
public class CompanionInitialization {
|
|
||||||
|
|
||||||
public static Object getCompanion() {
|
|
||||||
return IStatic.Companion;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
+10
@@ -1,3 +1,13 @@
|
|||||||
|
// FILE: B.java
|
||||||
|
|
||||||
|
class B {
|
||||||
|
static String test(A x) {
|
||||||
|
return A.DefaultImpls.foo(x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: main.kt
|
||||||
|
|
||||||
interface A {
|
interface A {
|
||||||
fun foo() = "OK"
|
fun foo() = "OK"
|
||||||
}
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user