Community
Participate
Working Groups
Platform: Eclipse 3.1 M4 Code example: package t1; public class Test { public static void main (String[] args) { new Test ().test (new byte[5]); } private void test (Object... params) { } } The code generates the following error at runtime when started from Eclipse (and only when started from Eclipse): java.lang.VerifyError: (class: t1/Test, method: main signature: ([Ljava/lang/String;)V) Incompatible argument to function The error is eliminated if the call to method test is expressed as: new Test ().test (new Object[] {new byte[5]}); Could it be an autoboxing issue?
Reproduced. I will investigate.
We don't wrap the array of byte into an array of Object. public static void main(String[] args); 0 new X [2] 3 dup 4 invokespecial X.<init>()V [16] 7 iconst_5 8 newarray byte [8] 10 invokespecial X.test([Ljava/lang/Object;)V [20] 13 return iconst5 and newarray byte should be replace with something like: iconst_1 anewarray java/lang/Object dup iconst_0 iconst_5 newarray byte aastore
Created attachment 17392 [details] Apply on HEAD
The bug was coming from the fact that we didn't check the compatibility of the last argument in case it was an array. We simply check the dimensions. Philippe, could you please review the patch? Thanks.
Looks good to me
Fixed and released in HEAD. Regression test added in VarargsTest.test023.
*** Bug 83183 has been marked as a duplicate of this bug. ***
Verified in I20050215-2300