Rename tests: boxWithJava -> boxAgainstJava
This commit is contained in:
@@ -1,6 +0,0 @@
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@Retention(RetentionPolicy.CLASS)
|
||||
@interface Foo {
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
import java.lang.annotation.*
|
||||
|
||||
Foo class Bar
|
||||
|
||||
fun box(): String {
|
||||
Bar()
|
||||
return "OK"
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@interface JavaAnn {
|
||||
String value();
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
JavaAnn("value") class MyClass
|
||||
|
||||
fun box(): String {
|
||||
val ann = javaClass<MyClass>().getAnnotation(javaClass<JavaAnn>())
|
||||
if (ann == null) return "fail: cannot find Ann on MyClass}"
|
||||
if (ann.value() != "value") return "fail: annotation parameter i should be 'value', but was ${ann.value()}"
|
||||
return "OK"
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@interface JavaAnn {
|
||||
String value() default "default";
|
||||
}
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@interface JavaAnn2 {
|
||||
int a() default 1;
|
||||
byte b() default 1;
|
||||
short c() default 1;
|
||||
double d() default 1;
|
||||
float e() default 1;
|
||||
long j() default 1;
|
||||
String f() default "default";
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
JavaAnn class MyClass
|
||||
JavaAnn2 class MyClass2
|
||||
|
||||
fun box(): String {
|
||||
val ann = javaClass<MyClass>().getAnnotation(javaClass<JavaAnn>())
|
||||
if (ann == null) return "fail: cannot find Ann on MyClass}"
|
||||
if (ann.value() != "default") return "fail: annotation parameter i should be 'default', but was ${ann.value()}"
|
||||
|
||||
val ann2 = javaClass<MyClass2>().getAnnotation(javaClass<JavaAnn2>())
|
||||
if (ann2 == null) return "fail: cannot find Ann on MyClass}"
|
||||
if (ann2.a() != 1) return "fail for a: expected = 1, but was ${ann2.a()}"
|
||||
if (ann2.b() != 1.toByte()) return "fail for b: expected = 1, but was ${ann2.b()}"
|
||||
if (ann2.c() != 1.toShort()) return "fail for c: expected = 1, but was ${ann2.c()}"
|
||||
if (ann2.d() != 1.0) return "fail for d: expected = 1, but was ${ann2.d()}"
|
||||
if (ann2.e() != 1F) return "fail for e: expected = 1, but was ${ann2.e()}"
|
||||
if (ann2.j() != 1L) return "fail for j: expected = 1, but was ${ann2.j()}"
|
||||
if (ann2.f() != "default") return "fail for f: expected = default, but was ${ann2.f()}"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
class Foo {
|
||||
public static final int i = -2;
|
||||
public static final short s = -2;
|
||||
public static final float f = -2f;
|
||||
public static final double d = -2.0;
|
||||
public static final long l = -2L;
|
||||
public static final byte b = -2;
|
||||
}
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
import java.lang.annotation.Retention
|
||||
import java.lang.annotation.RetentionPolicy
|
||||
|
||||
Ann(Foo.i, Foo.s, Foo.f, Foo.d, Foo.l, Foo.b) class MyClass
|
||||
|
||||
fun box(): String {
|
||||
val ann = javaClass<MyClass>().getAnnotation(javaClass<Ann>())
|
||||
if (ann == null) return "fail: cannot find Ann on MyClass}"
|
||||
if (ann.i != -2) return "fail: annotation parameter i should be -2, but was ${ann.i}"
|
||||
if (ann.s != (-2).toShort()) return "fail: annotation parameter i should be -2, but was ${ann.i}"
|
||||
if (ann.f != -2.toFloat()) return "fail: annotation parameter i should be -2, but was ${ann.i}"
|
||||
if (ann.d != -2.toDouble()) return "fail: annotation parameter i should be -2, but was ${ann.i}"
|
||||
if (ann.l != -2.toLong()) return "fail: annotation parameter i should be -2, but was ${ann.i}"
|
||||
if (ann.b != (-2).toByte()) return "fail: annotation parameter i should be -2, but was ${ann.i}"
|
||||
return "OK"
|
||||
}
|
||||
|
||||
Retention(RetentionPolicy.RUNTIME)
|
||||
annotation class Ann(
|
||||
val i: Int,
|
||||
val s: Short,
|
||||
val f: Float,
|
||||
val d: Double,
|
||||
val l: Long,
|
||||
val b: Byte
|
||||
)
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
class Foo {
|
||||
public static final int i = 2;
|
||||
public static final short s = 2;
|
||||
public static final float f = 2f;
|
||||
public static final double d = 2.0;
|
||||
public static final long l = 2L;
|
||||
public static final byte b = 2;
|
||||
public static final boolean bool = true;
|
||||
public static final char c = 'c';
|
||||
public static final String str = "str";
|
||||
}
|
||||
-32
@@ -1,32 +0,0 @@
|
||||
import java.lang.annotation.Retention
|
||||
import java.lang.annotation.RetentionPolicy
|
||||
|
||||
Ann(Foo.i, Foo.s, Foo.f, Foo.d, Foo.l, Foo.b, Foo.bool, Foo.c, Foo.str) class MyClass
|
||||
|
||||
fun box(): String {
|
||||
val ann = javaClass<MyClass>().getAnnotation(javaClass<Ann>())
|
||||
if (ann == null) return "fail: cannot find Ann on MyClass}"
|
||||
if (ann.i != 2) return "fail: annotation parameter i should be 2, but was ${ann.i}"
|
||||
if (ann.s != 2.toShort()) return "fail: annotation parameter i should be 2, but was ${ann.i}"
|
||||
if (ann.f != 2.toFloat()) return "fail: annotation parameter i should be 2, but was ${ann.i}"
|
||||
if (ann.d != 2.toDouble()) return "fail: annotation parameter i should be 2, but was ${ann.i}"
|
||||
if (ann.l != 2.toLong()) return "fail: annotation parameter i should be 2, but was ${ann.i}"
|
||||
if (ann.b != 2.toByte()) return "fail: annotation parameter i should be 2, but was ${ann.i}"
|
||||
if (!ann.bool) return "fail: annotation parameter i should be true, but was ${ann.i}"
|
||||
if (ann.c != 'c') return "fail: annotation parameter i should be c, but was ${ann.i}"
|
||||
if (ann.str != "str") return "fail: annotation parameter i should be str, but was ${ann.i}"
|
||||
return "OK"
|
||||
}
|
||||
|
||||
Retention(RetentionPolicy.RUNTIME)
|
||||
annotation class Ann(
|
||||
val i: Int,
|
||||
val s: Short,
|
||||
val f: Float,
|
||||
val d: Double,
|
||||
val l: Long,
|
||||
val b: Byte,
|
||||
val bool: Boolean,
|
||||
val c: Char,
|
||||
val str: String
|
||||
)
|
||||
@@ -1,9 +0,0 @@
|
||||
class Foo {
|
||||
public static final int i = 2;
|
||||
public static final short s = 2;
|
||||
public static final float f = 2;
|
||||
public static final double d = 2;
|
||||
public static final long l = 2;
|
||||
public static final byte b = 2;
|
||||
public static final char c = 99;
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
import java.lang.annotation.Retention
|
||||
import java.lang.annotation.RetentionPolicy
|
||||
|
||||
Ann(Foo.i, Foo.s, Foo.f, Foo.d, Foo.l, Foo.b, Foo.c) class MyClass
|
||||
|
||||
fun box(): String {
|
||||
val ann = javaClass<MyClass>().getAnnotation(javaClass<Ann>())
|
||||
if (ann == null) return "fail: cannot find Ann on MyClass}"
|
||||
if (ann.i != 2) return "fail: annotation parameter i should be 2, but was ${ann.i}"
|
||||
if (ann.s != 2.toShort()) return "fail: annotation parameter i should be 2, but was ${ann.i}"
|
||||
if (ann.f != 2.toFloat()) return "fail: annotation parameter i should be 2, but was ${ann.i}"
|
||||
if (ann.d != 2.toDouble()) return "fail: annotation parameter i should be 2, but was ${ann.i}"
|
||||
if (ann.l != 2.toLong()) return "fail: annotation parameter i should be 2, but was ${ann.i}"
|
||||
if (ann.b != 2.toByte()) return "fail: annotation parameter i should be 2, but was ${ann.i}"
|
||||
if (ann.c != 'c') return "fail: annotation parameter i should be c, but was ${ann.i}"
|
||||
return "OK"
|
||||
}
|
||||
|
||||
Retention(RetentionPolicy.RUNTIME)
|
||||
annotation class Ann(
|
||||
val i: Int,
|
||||
val s: Short,
|
||||
val f: Float,
|
||||
val d: Double,
|
||||
val l: Long,
|
||||
val b: Byte,
|
||||
val c: Char
|
||||
)
|
||||
@@ -1,3 +0,0 @@
|
||||
class A {
|
||||
public A(double x, int y) { }
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
fun box(): String {
|
||||
(::A)(0.0, 0)
|
||||
return "OK"
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package test;
|
||||
|
||||
public class genericConstructor<T extends Number> {
|
||||
public genericConstructor(T number) {}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
import test.genericConstructor
|
||||
|
||||
class Subclass : genericConstructor<Int>(42) {
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
Subclass()
|
||||
return "OK"
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
import java.util.Set;
|
||||
|
||||
public class delegationAndInheritanceFromJava {
|
||||
public interface A extends Set<String> {}
|
||||
|
||||
public interface B extends Set<String> {}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
import delegationAndInheritanceFromJava.*
|
||||
import java.util.HashSet
|
||||
|
||||
class Impl(b: B): A, B by b
|
||||
|
||||
fun box() = "OK"
|
||||
@@ -1,5 +0,0 @@
|
||||
package test;
|
||||
|
||||
public enum simpleJavaEnum {
|
||||
A;
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
import test.*
|
||||
|
||||
fun box() =
|
||||
if (simpleJavaEnum.A.toString() == "A") "OK"
|
||||
else "fail"
|
||||
@@ -1,18 +0,0 @@
|
||||
package test;
|
||||
|
||||
import java.lang.Override;
|
||||
import java.lang.String;
|
||||
|
||||
public enum simpleJavaEnumWithFunction {
|
||||
A {
|
||||
@Override
|
||||
public String repr() {
|
||||
return "A";
|
||||
}
|
||||
},
|
||||
B;
|
||||
|
||||
public String repr() {
|
||||
return "ololol" + toString();
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
import test.simpleJavaEnumWithFunction.*
|
||||
|
||||
fun box() =
|
||||
if (A.repr() == "A" && B.repr() == "olololB") "OK"
|
||||
else "fail"
|
||||
@@ -1,5 +0,0 @@
|
||||
package test;
|
||||
|
||||
public enum simpleJavaEnumWithStaticImport {
|
||||
A;
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
import test.simpleJavaEnumWithStaticImport.A
|
||||
|
||||
fun box() =
|
||||
if (A.toString() == "A") "OK"
|
||||
else "fail"
|
||||
@@ -1,7 +0,0 @@
|
||||
package test;
|
||||
|
||||
public class simpleJavaInnerEnum {
|
||||
public enum MyEnum {
|
||||
A;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
import test.*
|
||||
import test.simpleJavaInnerEnum.MyEnum.A
|
||||
|
||||
fun box() =
|
||||
if (simpleJavaInnerEnum.MyEnum.A.toString() == "A" && A.toString() == "A") "OK"
|
||||
else "fail"
|
||||
@@ -1,12 +0,0 @@
|
||||
package test;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.EnumSet;
|
||||
|
||||
public enum staticField {
|
||||
INSTANCE;
|
||||
|
||||
public static int foo = 42;
|
||||
|
||||
public static final Set<staticField> INSTANCES = EnumSet.of(INSTANCE);
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
import test.staticField as E
|
||||
|
||||
fun box(): String {
|
||||
val instances = E.INSTANCES
|
||||
if (E.foo != 42)
|
||||
return "Wrong foo ${E.foo}"
|
||||
if (instances.size() != 1)
|
||||
return "Wrong size ${instances.size()}"
|
||||
if (E.INSTANCES.iterator().next() != E.INSTANCE)
|
||||
return "Wrong instance ${E.INSTANCES.iterator().next()}"
|
||||
return "OK"
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package test;
|
||||
|
||||
public enum staticMethod {
|
||||
ENTRY;
|
||||
|
||||
public static String foo() {
|
||||
return "OK";
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
fun box() = test.staticMethod.foo()
|
||||
@@ -1,7 +0,0 @@
|
||||
class A {
|
||||
public A() {}
|
||||
|
||||
public A(String x) {}
|
||||
|
||||
public A(long l, double z) {}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
fun box(): String {
|
||||
A()
|
||||
A("")
|
||||
A(0.toLong(), 0.0)
|
||||
return "OK"
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
import java.util.*;
|
||||
|
||||
public class max {
|
||||
public static <T extends Object & Comparable<? super T>> T max(Collection<? extends T> coll) {
|
||||
return Collections.max(coll);
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fun box(): String {
|
||||
return max.max(java.util.Arrays.asList("AK", "OK", "EK"))!!
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
class R {
|
||||
public static class id {
|
||||
public static final int main = 17;
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fun box() =
|
||||
if (R.id.main == 17) "OK" else "fail"
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
class R {
|
||||
public static class id {
|
||||
public static class zzz {
|
||||
public static final int main = 17;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fun box() =
|
||||
if (R.id.zzz.main == 17) "OK" else "fail"
|
||||
@@ -1,7 +0,0 @@
|
||||
import java.util.Collection;
|
||||
|
||||
public class unrelatedUpperBounds {
|
||||
public static <T extends CharSequence & java.io.Serializable> T id(T p) {
|
||||
return p;
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fun box(): String {
|
||||
return unrelatedUpperBounds.id("OK" as java.lang.String)!! as kotlin.String
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
public class kt3532 {
|
||||
public class Inner { }
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
fun box(): String {
|
||||
kt3532().Inner()
|
||||
return "OK"
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
public class kt3812 {
|
||||
public class Inner {
|
||||
|
||||
}
|
||||
|
||||
public class Inner$ {
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
fun box(): String {
|
||||
kt3812().Inner()
|
||||
kt3812().`Inner$`()
|
||||
return "OK"
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
public class kt4036 {
|
||||
public class Inner1$class {
|
||||
|
||||
}
|
||||
|
||||
public class Inner2$class {
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
fun box(): String {
|
||||
kt4036().`Inner1$class`()
|
||||
kt4036().`Inner2$class`()
|
||||
return "OK"
|
||||
}
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
public class fieldAccessFromExtensionInTraitImpl {
|
||||
public final String result = "OK";
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
// KT-4878
|
||||
|
||||
import fieldAccessFromExtensionInTraitImpl as D
|
||||
|
||||
trait T {
|
||||
fun Int.foo(d: D) = d.result!!
|
||||
}
|
||||
|
||||
class A : T {
|
||||
fun bar() = 42.foo(D())
|
||||
}
|
||||
|
||||
fun box() = A().bar()
|
||||
@@ -1,5 +0,0 @@
|
||||
class fieldAccessViaSubclass {
|
||||
public String fieldO;
|
||||
|
||||
public static String fieldK;
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
// KT-3492
|
||||
|
||||
class MyWrongClass : fieldAccessViaSubclass() {
|
||||
|
||||
}
|
||||
|
||||
fun box() : String {
|
||||
val clazz = MyWrongClass()
|
||||
clazz.fieldO = "O"
|
||||
fieldAccessViaSubclass.fieldK = "K"
|
||||
return clazz.fieldO!! + fieldAccessViaSubclass.fieldK!!
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
interface JavaInterface {
|
||||
void run(Runnable r);
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
class Impl: JavaInterface {
|
||||
override fun run(r: Runnable?) {
|
||||
r?.run()
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
var v = "FAIL"
|
||||
Impl().run { v = "OK" }
|
||||
return v
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
import java.util.*;
|
||||
|
||||
class JavaClass {
|
||||
public static void sortIntList(List<Integer> list, Comparator<Integer> comparator) {
|
||||
Collections.sort(list, comparator);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
import java.util.*
|
||||
|
||||
fun box(): String {
|
||||
val list = ArrayList(Arrays.asList(3, 2, 4, 8, 1, 5))
|
||||
val expected = ArrayList(Arrays.asList(8, 5, 4, 3, 2, 1))
|
||||
JavaClass.sortIntList(list, { a, b -> b - a })
|
||||
return if (list == expected) "OK" else list.toString()
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
class JavaClass {
|
||||
private Runnable r;
|
||||
|
||||
public JavaClass(Runnable r) {
|
||||
this.r = r;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
r.run();
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
fun box(): String {
|
||||
var v = "FAIL"
|
||||
JavaClass { v = "OK" }.run()
|
||||
return v
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
import java.io.*;
|
||||
|
||||
class JavaClass {
|
||||
public static String invokeFilter(FileFilter f, File file1, File file2) {
|
||||
return f.accept(file1) + " " + f.accept(file2);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
import java.io.*
|
||||
|
||||
fun box(): String {
|
||||
val ACCEPT_NAME = "test"
|
||||
val WRONG_NAME = "wrong"
|
||||
|
||||
val result = JavaClass.invokeFilter({ file -> ACCEPT_NAME == file?.getName() }, File(ACCEPT_NAME), File(WRONG_NAME))
|
||||
|
||||
if (result != "true false") return "Wrong result: $result"
|
||||
return "OK"
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
|
||||
class JavaClass {
|
||||
public static String foo(Comparator<String> comparator) {
|
||||
return Arrays.toString(comparator.getClass().getGenericInterfaces());
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
fun box(): String {
|
||||
val supertypes = JavaClass.foo { a, b -> a.compareTo(b) }
|
||||
if (supertypes != "[java.util.Comparator<java.lang.String>]") return "Fail: $supertypes"
|
||||
return "OK"
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
interface JavaInterface {
|
||||
void foo(Runnable r);
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
class Impl: JavaInterface {
|
||||
override fun foo(r: Runnable?) {
|
||||
r?.run()
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val fooMethods = javaClass<Impl>().getMethods().filter { it.getName() == "foo" }
|
||||
if (fooMethods.size() != 1) return fooMethods.toString()
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
class JavaClass {
|
||||
public void run(Runnable r) {
|
||||
r.run();
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
class KotlinSubclass: JavaClass() {
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
var v = "FAIL"
|
||||
KotlinSubclass().run { v = "OK" }
|
||||
return v
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
class Super {
|
||||
public String lastCalled = null;
|
||||
|
||||
void foo(Runnable r) {
|
||||
lastCalled = "super";
|
||||
}
|
||||
}
|
||||
|
||||
class Sub extends Super {
|
||||
void foo(kotlin.Function0<kotlin.Unit> r) {
|
||||
lastCalled = "sub";
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
fun box(): String {
|
||||
val sub = Sub()
|
||||
|
||||
(sub : Super).foo{ }
|
||||
if (sub.lastCalled != "super") {
|
||||
return "FAIL: ${sub.lastCalled} instead of super"
|
||||
}
|
||||
|
||||
sub.foo{ }
|
||||
if (sub.lastCalled != "sub") {
|
||||
return "FAIL: ${sub.lastCalled} instead of sub"
|
||||
}
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
class Super {
|
||||
void safeInvoke(Runnable r) {
|
||||
if (r != null) r.run();
|
||||
}
|
||||
}
|
||||
|
||||
class Sub extends Super {
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
fun box(): String {
|
||||
var r = "FAIL"
|
||||
val sub = Sub()
|
||||
sub.safeInvoke(null)
|
||||
sub.safeInvoke { r = "OK" }
|
||||
return r
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
class JavaClass {
|
||||
public static void run(Runnable r1, Runnable r2) {
|
||||
r1.run();
|
||||
r2.run();
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
fun box(): String {
|
||||
var v = "FAIL"
|
||||
val f = { v = "O" }
|
||||
JavaClass.run(f, { v += "K" })
|
||||
return v
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
import java.util.*;
|
||||
|
||||
class JavaClass {
|
||||
public static void sortIntList(List<Integer> list, Comparator<Integer> comparator) {
|
||||
Collections.sort(list, comparator);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
import java.util.*
|
||||
|
||||
fun box(): String {
|
||||
val list = ArrayList(Arrays.asList(3, 2, 4, 8, 1, 5))
|
||||
val expected = ArrayList(Arrays.asList(8, 5, 4, 3, 2, 1))
|
||||
|
||||
val f = { (a: Int, b: Int) -> b - a }
|
||||
JavaClass.sortIntList(list, f)
|
||||
return if (list == expected) "OK" else list.toString()
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
class JavaClass {
|
||||
private Runnable r;
|
||||
|
||||
public JavaClass(Runnable r) {
|
||||
this.r = r;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
r.run();
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
fun box(): String {
|
||||
var v = "FAIL"
|
||||
val f = { v = "OK" }
|
||||
JavaClass(f).run()
|
||||
return v
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
class JavaClass {
|
||||
public static String run(Runnable r) {
|
||||
return r == null ? "OK" : "FAIL";
|
||||
}
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
fun box(): String {
|
||||
val f: (() -> Unit)? = null
|
||||
return JavaClass.run(f)!!
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
class JavaClass {
|
||||
public static void run(Runnable r) {
|
||||
r.run();
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
fun box(): String {
|
||||
var v = "FAIL"
|
||||
val f = { v = "OK" }
|
||||
JavaClass.run(f)
|
||||
return v
|
||||
}
|
||||
-40
@@ -1,40 +0,0 @@
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
class Container {
|
||||
@NotNull
|
||||
Value get(Runnable i) {
|
||||
i.run();
|
||||
return new Value();
|
||||
}
|
||||
|
||||
void set(Runnable i, @NotNull Value value) {
|
||||
i.run();
|
||||
}
|
||||
}
|
||||
|
||||
class Value {
|
||||
@NotNull Value plus(Runnable i) {
|
||||
i.run();
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull Value minus(Runnable i) {
|
||||
i.run();
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull Value times(Runnable i) {
|
||||
i.run();
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull Value div(Runnable i) {
|
||||
i.run();
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull Value mod(Runnable i) {
|
||||
i.run();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
-30
@@ -1,30 +0,0 @@
|
||||
fun box(): String {
|
||||
var c = Container()
|
||||
var indexAccess = 0
|
||||
|
||||
// TODO uncomment when KT-3723 is fixed
|
||||
|
||||
//var v1 = "FAIL"
|
||||
//c[{ indexAccess++ }] += { v1 = "OK" }
|
||||
//if (v1 != "OK") return "plus: $v1"
|
||||
//
|
||||
//var v2 = "FAIL"
|
||||
//c[{ indexAccess++ }] -= { v2 = "OK" }
|
||||
//if (v2 != "OK") return "minus: $v2"
|
||||
//
|
||||
//var v3 = "FAIL"
|
||||
//c[{ indexAccess++ }] *= { v3 = "OK" }
|
||||
//if (v3 != "OK") return "times: $v3"
|
||||
//
|
||||
//var v4 = "FAIL"
|
||||
//c[{ indexAccess++ }] /= { v4 = "OK" }
|
||||
//if (v4 != "OK") return "div: $v4"
|
||||
//
|
||||
//var v5 = "FAIL"
|
||||
//c[{ indexAccess++ }] %= { v5 = "OK" }
|
||||
//if (v5 != "OK") return "mod: $v5"
|
||||
//
|
||||
//if (indexAccess != 10) return indexAccess
|
||||
|
||||
return "OK"
|
||||
}
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
class JavaClass {
|
||||
void plusAssign(Runnable i) {
|
||||
i.run();
|
||||
}
|
||||
|
||||
void minusAssign(Runnable i) {
|
||||
i.run();
|
||||
}
|
||||
|
||||
void timesAssign(Runnable i) {
|
||||
i.run();
|
||||
}
|
||||
|
||||
void divAssign(Runnable i) {
|
||||
i.run();
|
||||
}
|
||||
|
||||
void modAssign(Runnable i) {
|
||||
i.run();
|
||||
}
|
||||
}
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
fun box(): String {
|
||||
val obj = JavaClass()
|
||||
|
||||
var v1 = "FAIL"
|
||||
obj += { v1 = "OK" }
|
||||
if (v1 != "OK") return "plus: $v1"
|
||||
|
||||
var v2 = "FAIL"
|
||||
obj -= { v2 = "OK" }
|
||||
if (v2 != "OK") return "minus: $v2"
|
||||
|
||||
var v3 = "FAIL"
|
||||
obj *= { v3 = "OK" }
|
||||
if (v3 != "OK") return "times: $v3"
|
||||
|
||||
var v4 = "FAIL"
|
||||
obj /= { v4 = "OK" }
|
||||
if (v4 != "OK") return "div: $v4"
|
||||
|
||||
var v5 = "FAIL"
|
||||
obj %= { v5 = "OK" }
|
||||
if (v5 != "OK") return "mod: $v5"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
class JavaClass {
|
||||
JavaClass plus(Runnable i) {
|
||||
i.run();
|
||||
return this;
|
||||
}
|
||||
|
||||
JavaClass minus(Runnable i) {
|
||||
i.run();
|
||||
return this;
|
||||
}
|
||||
|
||||
JavaClass times(Runnable i) {
|
||||
i.run();
|
||||
return this;
|
||||
}
|
||||
|
||||
JavaClass div(Runnable i) {
|
||||
i.run();
|
||||
return this;
|
||||
}
|
||||
|
||||
JavaClass mod(Runnable i) {
|
||||
i.run();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
fun box(): String {
|
||||
var obj = JavaClass()
|
||||
|
||||
var v1 = "FAIL"
|
||||
obj += { v1 = "OK" }
|
||||
if (v1 != "OK") return "plus: $v1"
|
||||
|
||||
var v2 = "FAIL"
|
||||
obj -= { v2 = "OK" }
|
||||
if (v2 != "OK") return "minus: $v2"
|
||||
|
||||
var v3 = "FAIL"
|
||||
obj *= { v3 = "OK" }
|
||||
if (v3 != "OK") return "times: $v3"
|
||||
|
||||
var v4 = "FAIL"
|
||||
obj /= { v4 = "OK" }
|
||||
if (v4 != "OK") return "div: $v4"
|
||||
|
||||
var v5 = "FAIL"
|
||||
obj %= { v5 = "OK" }
|
||||
if (v5 != "OK") return "mod: $v5"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
class JavaClass {
|
||||
JavaClass plus(Runnable i) {
|
||||
i.run();
|
||||
return this;
|
||||
}
|
||||
|
||||
JavaClass minus(Runnable i) {
|
||||
i.run();
|
||||
return this;
|
||||
}
|
||||
|
||||
JavaClass times(Runnable i) {
|
||||
i.run();
|
||||
return this;
|
||||
}
|
||||
|
||||
JavaClass div(Runnable i) {
|
||||
i.run();
|
||||
return this;
|
||||
}
|
||||
|
||||
JavaClass mod(Runnable i) {
|
||||
i.run();
|
||||
return this;
|
||||
}
|
||||
|
||||
JavaClass rangeTo(Runnable i) {
|
||||
i.run();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
fun box(): String {
|
||||
val obj = JavaClass()
|
||||
|
||||
var v1 = "FAIL"
|
||||
obj + { v1 = "OK" }
|
||||
if (v1 != "OK") return "plus: $v1"
|
||||
|
||||
var v2 = "FAIL"
|
||||
obj - { v2 = "OK" }
|
||||
if (v2 != "OK") return "minus: $v2"
|
||||
|
||||
var v3 = "FAIL"
|
||||
obj * { v3 = "OK" }
|
||||
if (v3 != "OK") return "times: $v3"
|
||||
|
||||
var v4 = "FAIL"
|
||||
obj / { v4 = "OK" }
|
||||
if (v4 != "OK") return "div: $v4"
|
||||
|
||||
var v5 = "FAIL"
|
||||
obj % { v5 = "OK" }
|
||||
if (v5 != "OK") return "mod: $v5"
|
||||
|
||||
var v6 = "FAIL"
|
||||
obj .. { v6 = "OK" }
|
||||
if (v6 != "OK") return "rangeTo: $v6"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
class JavaClass {
|
||||
int compareTo(Runnable i) {
|
||||
i.run();
|
||||
return 239;
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
fun box(): String {
|
||||
val obj = JavaClass()
|
||||
|
||||
var v1 = "FAIL"
|
||||
obj < { v1 = "OK" }
|
||||
if (v1 != "OK") return "<: $v1"
|
||||
|
||||
var v2 = "FAIL"
|
||||
obj > { v2 = "OK" }
|
||||
if (v2 != "OK") return ">: $v2"
|
||||
|
||||
var v3 = "FAIL"
|
||||
obj <= { v3 = "OK" }
|
||||
if (v3 != "OK") return "<=: $v3"
|
||||
|
||||
var v4 = "FAIL"
|
||||
obj >= { v4 = "OK" }
|
||||
if (v4 != "OK") return ">=: $v4"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
class JavaClass {
|
||||
boolean contains(Runnable i) {
|
||||
i.run();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
fun box(): String {
|
||||
val obj = JavaClass()
|
||||
|
||||
var v = "FAIL"
|
||||
{ v = "O" } in obj
|
||||
{ v += "K" } !in obj
|
||||
return v
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
class JavaClass {
|
||||
int get(Runnable i) {
|
||||
i.run();
|
||||
return 239;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
fun box(): String {
|
||||
val obj = JavaClass()
|
||||
|
||||
var v = "FAIL"
|
||||
obj[{ v = "OK" }]
|
||||
return v
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
class JavaClass {
|
||||
void doSomething(Runnable i) {
|
||||
i.run();
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
fun box(): String {
|
||||
val obj = JavaClass()
|
||||
|
||||
var v = "FAIL"
|
||||
obj doSomething { v = "OK" }
|
||||
return v
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
class JavaClass {
|
||||
void invoke(Runnable i) {
|
||||
i.run();
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
fun box(): String {
|
||||
val obj = JavaClass()
|
||||
|
||||
var v = "FAIL"
|
||||
obj({ v = "O" })
|
||||
obj { v += "K" }
|
||||
return v
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
class JavaClass {
|
||||
int get(Runnable i1, Runnable i2) {
|
||||
i1.run();
|
||||
i2.run();
|
||||
return 239;
|
||||
}
|
||||
|
||||
void set(Runnable i1, Runnable i2, Runnable value) {
|
||||
i1.run();
|
||||
i2.run();
|
||||
value.run();
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fun box(): String {
|
||||
val obj = JavaClass()
|
||||
|
||||
var v1 = "FAIL"
|
||||
obj[{ v1 = "O" }, { v1 += "K" }]
|
||||
if (v1 != "OK") return "get: $v1"
|
||||
|
||||
var v2 = "FAIL"
|
||||
obj[{ v2 = "" }, { v2 += "O" }] = { v2 += "K" }
|
||||
if (v2 != "OK") return "set: $v2"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
class JavaClass {
|
||||
void invoke(Runnable p1, Runnable p2) {
|
||||
p1.run();
|
||||
p2.run();
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
fun box(): String {
|
||||
val obj = JavaClass()
|
||||
|
||||
var v = "FAIL"
|
||||
obj({ v = "O" }, { v += "K" })
|
||||
return v
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user