aa4a042612
#KT-42359 Fixed
28 lines
478 B
Kotlin
Vendored
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"
|
|
}
|