Closed aionbot closed 5 years ago
Comment by JunhanHu-aion (on Thursday Sep 27, 2018 at 15:19 GMT)
This is caused by invokeDynamic, (String + int) is not working properly. This is a known issue for string concat
Comment by nancyaion (on Thursday Sep 27, 2018 at 15:26 GMT)
Thanks Junhan. Changing the title.
Comment by nancyaion (on Thursday Sep 27, 2018 at 15:53 GMT)
Also not work of (String + other primitive types)
Comment by nancyaion (on Thursday Sep 27, 2018 at 20:35 GMT)
Actually the issue is still related to the shadow String constructor.
public String(String original) {
IHelper.currentContractHelper.get().externalChargeEnergy(RuntimeMethodFeeSchedule.String_avm_constructor_1);
this.v = new java.lang.String(original.v);
}`
The problem is gone after replacing original.v
to original.getUnderlying()
. It is because the fields of the shadow String original
is not yet loaded when original.v
is referenced and that causes the null pointer exception. Instead, getUnderlying()
method does lazyLoad()
so the problem is gone. It is recommended to use the methods to access the shadow class fields, not directly access them.
Issue created by nancyaion (on Thursday Sep 27, 2018 at 15:17 GMT)
Figured out with the test
shadow.PrimitiveShadowingTest
, for example, inByteTest.Decode.main()
check(new String(""+Byte.MIN_VALUE), Byte.MIN_VALUE); // does not work
check(String.valueOf(Byte.MIN_VALUE), Byte.MIN_VALUE); // works