Merge boxWithJava testData into box, delete BoxWithJava test
This commit is contained in:
committed by
Alexander Udalov
parent
16a0ddd2fb
commit
f8dfaf4599
+28
@@ -0,0 +1,28 @@
|
||||
// FILE: Test.java
|
||||
|
||||
import java.lang.*;
|
||||
import java.util.*;
|
||||
|
||||
public class Test {
|
||||
public static class MapEntryImpl implements Map.Entry<String, String> {
|
||||
public String getKey() { return null; }
|
||||
public String getValue() { 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"
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
// 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()
|
||||
fun foo(): MyIterable<String> = throw E()
|
||||
|
||||
fun box(): String {
|
||||
try {
|
||||
foo().iterator().next()
|
||||
return "Fail: E should have been thrown"
|
||||
} catch (e: E) {}
|
||||
|
||||
Test.checkCallFromJava()
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
// 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!!
|
||||
override fun contains(o: String): Boolean = null!!
|
||||
override fun iterator(): Iterator<String> = null!!
|
||||
override fun containsAll(c: Collection<String>): Boolean = null!!
|
||||
override fun get(index: Int): String = null!!
|
||||
override fun indexOf(o: String): Int = null!!
|
||||
override fun lastIndexOf(o: String): Int = null!!
|
||||
override fun listIterator(): ListIterator<String> = null!!
|
||||
override fun listIterator(index: Int): ListIterator<String> = null!!
|
||||
override fun subList(fromIndex: Int, toIndex: Int): List<String> = null!!
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
try {
|
||||
Test().test()
|
||||
return "Fail"
|
||||
} catch (e: UnsupportedOperationException) {
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user