Eval4j: always cast int to byte, short, boolean and char when they are expected

This commit is contained in:
Natalia Ukhorskaya
2014-04-24 13:42:43 +04:00
parent 5536f4da07
commit 1e0a4ddbdd
2 changed files with 4 additions and 1 deletions
@@ -112,7 +112,6 @@ fun Value.obj(expectedType: Type = asmType): Any? {
return v
}
return when {
expectedType == asmType -> (this as AbstractValue<*>).value
expectedType == Type.BOOLEAN_TYPE -> this.boolean
expectedType == Type.SHORT_TYPE -> (this as IntValue).int.toShort()
expectedType == Type.BYTE_TYPE -> (this as IntValue).int.toByte()
@@ -124,6 +124,10 @@ class TestData {
Long l = klass.lm;
Float f = klass.fm;
Double d = klass.dm;
int i2 = klass.bm;
int i3 = klass.sm;
int i4 = klass.cm;
}
static class CastFieldType {