Fix ClassCastException with nullable chars

#KT-4210 Fixed
 #KT-4098 Fixed
 #KT-4251 Fixed
This commit is contained in:
Alexander Udalov
2013-12-02 23:34:32 +04:00
parent dab9d69a40
commit fa7076a4fa
6 changed files with 70 additions and 4 deletions
@@ -251,13 +251,19 @@ public abstract class StackValue {
}
}
else if (fromType.getSort() == Type.OBJECT) {
if (toType.getSort() == Type.BOOLEAN || toType.getSort() == Type.CHAR) {
coerce(fromType, boxType(toType), v);
if (fromType.equals(getType(Boolean.class)) || fromType.equals(getType(Character.class))) {
unbox(unboxType(fromType), v);
coerce(unboxType(fromType), toType, v);
}
else {
coerce(fromType, getType(Number.class), v);
if (toType.getSort() == Type.BOOLEAN || toType.getSort() == Type.CHAR) {
coerce(fromType, boxType(toType), v);
}
else {
coerce(fromType, getType(Number.class), v);
}
unbox(toType, v);
}
unbox(toType, v);
}
else {
v.cast(fromType, toType);