Eval4j: always cast int to byte, short, boolean and char when they are expected
This commit is contained in:
@@ -112,7 +112,6 @@ fun Value.obj(expectedType: Type = asmType): Any? {
|
|||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
return when {
|
return when {
|
||||||
expectedType == asmType -> (this as AbstractValue<*>).value
|
|
||||||
expectedType == Type.BOOLEAN_TYPE -> this.boolean
|
expectedType == Type.BOOLEAN_TYPE -> this.boolean
|
||||||
expectedType == Type.SHORT_TYPE -> (this as IntValue).int.toShort()
|
expectedType == Type.SHORT_TYPE -> (this as IntValue).int.toShort()
|
||||||
expectedType == Type.BYTE_TYPE -> (this as IntValue).int.toByte()
|
expectedType == Type.BYTE_TYPE -> (this as IntValue).int.toByte()
|
||||||
|
|||||||
@@ -124,6 +124,10 @@ class TestData {
|
|||||||
Long l = klass.lm;
|
Long l = klass.lm;
|
||||||
Float f = klass.fm;
|
Float f = klass.fm;
|
||||||
Double d = klass.dm;
|
Double d = klass.dm;
|
||||||
|
|
||||||
|
int i2 = klass.bm;
|
||||||
|
int i3 = klass.sm;
|
||||||
|
int i4 = klass.cm;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class CastFieldType {
|
static class CastFieldType {
|
||||||
|
|||||||
Reference in New Issue
Block a user