IllegalArgumentException: bad adapter (conversion=0x00000100)
Rémi Forax
forax at univ-mlv.fr
Wed Oct 13 04:56:40 PDT 2010
Le 13/10/2010 13:33, Christian Thalinger a écrit :
> I'm trying to do a conversion in a testcase for a feature I'm working
> on:
>
> MethodHandle mh1 = MethodHandles.lookup().findStatic(CLASS, "i2b",
> MethodType.methodType(byte.class, int.class));
> MethodHandle mh2 = MethodHandles.convertArguments(mh1,
> MethodType.methodType(byte.class, byte.class));
>
> But it fails with this exception:
>
> Exception in thread "main" java.lang.IllegalArgumentException: bad
> adapter (conversion=0x00000100): type mismatch: returning a int, but
> caller expects byte
>
> I'm not very used to all this argument conversion stuff, so my
> question is can I do a conversion like this? Is the exception correct
> and excepted to be thrown or is this a bug in the RI?
>
> -- Christian
>
It's a bug in the RI, but the EG decide not too long ago
that conversions with loss, here, int -> byte is allowed.
Rémi
More information about the mlvm-dev
mailing list