IllegalArgumentException: bad adapter (conversion=0x00000100)

Christian Thalinger christian.thalinger at oracle.com
Wed Oct 13 04:33:53 PDT 2010


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


More information about the mlvm-dev mailing list