Question about MethodHandles#explicitCastArgument
Jochen Theodorou
blackdrag at gmx.org
Wed Nov 14 05:17:49 PST 2012
Hi,
I have a call to MethodHandles#explicitCastArgument with first argument
being my
MethodHandle(Groovy3135Bug,String,float,float,float,float,float)Object
and the type I cast to being
(Groovy3135Bug,String,Byte,Short,Integer,Long,Float)Object
Ignoring the first two I should have some kind of unboxing followed by
casting for most arguments. In the javadoc to that method I read:
"""
If T0 is a reference and T1 a primitive, an unboxing conversion will be
applied at runtime, possibly followed by a Java casting conversion (JLS
5.5) on the primitive value, possibly followed by a conversion from byte
to boolean by testing the low-order bit.
"""
Aren't T0 and T1 in my case for example T0=Byte and T1=float? Unless I
mix up T0 and T1, this should be working, or not?
Well... it fails with a NPE... that can't be right, can it? If I first
cast to an all-Object signature, and then to the target, then it
works... but that can't be how it should be, or not?
bye Jochen
--
Jochen "blackdrag" Theodorou - Groovy Project Tech Lead
blog: http://blackdragsview.blogspot.com/
german groovy discussion newsgroup: de.comp.lang.misc
For Groovy programming sources visit http://groovy-lang.org
More information about the mlvm-dev
mailing list