On 2010.03.25., at 20:32, Charles Oliver Nutter wrote:

> On Thu, Mar 25, 2010 at 1:14 PM, John Rose <john.r...@sun.com> wrote:
>>> MethodHandleImpl.java:1104:in `raiseException':
>>> java.lang.ClassCastException: required class [Ljava.lang.Object; but
>>> encountered class java.util.Collections$UnmodifiableRandomAccessList
>>>       from MethodHandle.java:357:in `invokeVarargs'
>>>       from MethodHandles.java:563:in `invoke'
>>>       from DynamicLinkerImpl.java:120:in `_relinkAndInvoke'
>>>       from FilterGeneric.java:520:in `invoke_C0'
>>>       from dynamic.duby:3:in `foo'
>>> ...
>> 
>> Do you know who is creating the UnmodifiableRandomAccessList?
>> 
>> It looks like it needs a toArray call to create the low-level varargs list.
> 
> I don't think it does. The URAL comes from Duby's literal array syntax
> (the [1,2,3] in the example) and for the error in question it's simply
> the receiver of the call (getClass or size).

For the record, with my own MLVM build from last August, I have 6 unit test 
errors - all in the TestSimpleDynamicMethod.testVarArgs*() testcases; they're 
known issues in that version of MethodHandles support, with int[] -> Object[] 
conversion for varargs.
With Stephen Bannasch's java-1.7.0-internal-2010_03_07.tar.gz, I'm getting 
those 6 (so they're *still* not fixed...), *and* I'm getting 12 new ones that 
previously worked, mostly all similar to the ClassCastException you reported, 
i.e. here's one from a really simple testcase, the "test fixed name property 
getter" - doesn't get much simpler than that :-):

java.lang.ClassCastException: required class [Ljava.lang.Object; but 
encountered class org.dynalang.dynalink.beans.TestPropertyGetter$T1
        at sun.dyn.MethodHandleImpl.raiseException(MethodHandleImpl.java:1104)
        at java.dyn.MethodHandle.invokeVarargs(MethodHandle.java:357)
        at java.dyn.MethodHandles.invoke(MethodHandles.java:563)
        at 
org.dynalang.dynalink.support.DynamicLinkerImpl._relinkAndInvoke(DynamicLinkerImpl.java:120)
        at sun.dyn.FilterGeneric$F1.invoke_C0(FilterGeneric.java:520)
        at sun.dyn.FilterGeneric$F1.invoke_F0(FilterGeneric.java:514)
        at java.dyn.MethodHandle.invokeVarargs(MethodHandle.java:357)
        at java.dyn.MethodHandles.invoke(MethodHandles.java:563)
        at 
org.dynalang.dynalink.beans.TestPropertyGetter.testFixedNamePropertyGetter(TestPropertyGetter.java:26)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:613)
        at junit.framework.TestCase.runTest(TestCase.java:164)
        ...

I'll investigate, but I'm afraid the problem is in the JRE. In the next step, I 
think I'll update my own local Mercurial copy, apply the patches, and do a 
build myself - so at least I have source xref to the stack traces. John, can 
you maybe enlighten us as to why does 
java.dyn.MethodHandle.invokeVarargs(MethodHandle.java:357) expect the first 
argument to be an Object[] - it should be arbitrarily typed receiver, no?

Thanks,
  Attila.

--
home: http://www.szegedi.org
twitter: http://twitter.com/szegedi
weblog: http://constc.blogspot.com
_______________________________________________
mlvm-dev mailing list
mlvm-dev@openjdk.java.net
http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev

Reply via email to