mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-17 00:21:28 +00:00
Migrate boxWithJava tests to multi-file framework
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
// FILE: Test.java
|
||||
|
||||
import java.lang.*;
|
||||
import java.util.*;
|
||||
|
||||
@@ -8,3 +10,19 @@ public class Test {
|
||||
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"
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
@@ -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>
|
||||
|
||||
class E : RuntimeException()
|
||||
@@ -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) { }
|
||||
}
|
||||
}
|
||||
@@ -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> {
|
||||
override val size: Int get() = null!!
|
||||
override fun isEmpty(): Boolean = null!!
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user