Fix for KT-10313: ClassCastException with Generics

#KT-10313 Fixed
This commit is contained in:
Anton Sukhonosenko
2015-12-15 08:54:09 +03:00
committed by Michael Bogdanov
parent edf6a2142b
commit 0073257841
12 changed files with 140 additions and 2 deletions
@@ -0,0 +1,15 @@
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;
}
}
@@ -0,0 +1,4 @@
fun box(): String {
val sub = Box<Long>(-1)
return if (sub.value == -1L) "OK" else "fail"
}