Files
kotlin-fork/compiler/testData/codegen/box/casts/literalExpressionAsGenericArgument/javaBox.kt
T
2020-10-07 10:43:43 +03:00

28 lines
478 B
Kotlin
Vendored

// TARGET_BACKEND: JVM
// FILE: Box.java
public class Box<T> {
private final T value;
public Box(T value) {
this.value = value;
}
public static <T> Box<T> create(T defaultValue) {
return new Box(defaultValue);
}
public T getValue() {
return value;
}
}
// FILE: test.kt
// See KT-10313: ClassCastException with Generics
fun box(): String {
val sub = Box<Long>(-1)
return if (sub.value == -1L) "OK" else "fail"
}