Path: blob/master/test/functional/Jsr292/src/com/ibm/j9/jsr292/MethodHandleTest.java
6007 views
/*******************************************************************************1* Copyright (c) 2001, 2019 IBM Corp. and others2*3* This program and the accompanying materials are made available under4* the terms of the Eclipse Public License 2.0 which accompanies this5* distribution and is available at https://www.eclipse.org/legal/epl-2.0/6* or the Apache License, Version 2.0 which accompanies this distribution and7* is available at https://www.apache.org/licenses/LICENSE-2.0.8*9* This Source Code may also be made available under the following10* Secondary Licenses when the conditions for such availability set11* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU12* General Public License, version 2 with the GNU Classpath13* Exception [1] and GNU General Public License, version 2 with the14* OpenJDK Assembly Exception [2].15*16* [1] https://www.gnu.org/software/classpath/license.html17* [2] http://openjdk.java.net/legal/assembly-exception.html18*19* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception20*******************************************************************************/21package com.ibm.j9.jsr292;2223import org.testng.annotations.Test;24import org.testng.Assert;25import java.lang.invoke.MethodHandle;26import java.lang.invoke.MethodHandles;27import java.lang.invoke.MethodType;28import java.lang.invoke.WrongMethodTypeException;29import java.util.ArrayList;30import java.util.Arrays;31import java.util.List;32import java.util.NavigableMap;33import java.util.TreeMap;34import examples.PackageExamples;3536/**37* @author mesbah38* This class contains tests for the MethodType API.39*/40public class MethodHandleTest{4142/****************************43* Tests for asCollector44* **************************/4546/**47* Basic asCollector test. Tests by invoking a MH obtained through a findVirtual call to a class in the same package48* @throws Throwable49*/50@Test(groups = { "level.extended" })51public void test_asCollector_SamePackage_Virtual() throws Throwable{52MethodHandle mh = MethodHandles.lookup().findVirtual(SamePackageExample.class,"arrayToString",MethodType.methodType(String.class, String[].class));53SamePackageExample g = new SamePackageExample();54mh = mh.bindTo(g);55mh = mh.asCollector(String[].class, 5);5657Assert.assertEquals(mh.type(), MethodType.methodType(String.class,String.class,String.class,String.class,String.class,String.class));58Assert.assertEquals((String)mh.invokeExact("A","star","I am looking at","may already have","died"), "[A,star,I am looking at,may already have,died]");59}6061/**62* Basic asCollector test. Tests by invoking a MH obtained through a findStatic call to a class in the same package63* @throws Throwable64*/65@Test(groups = { "level.extended" })66public void test_asCollector_SamePackage_Static() throws Throwable{67MethodHandle mh = MethodHandles.lookup().findStatic(SamePackageExample.class,"getLengthStatic",MethodType.methodType(int.class, String[].class));68mh = mh.asCollector(String[].class, 5);6970Assert.assertEquals(mh.type(), MethodType.methodType(int.class,String.class,String.class,String.class,String.class,String.class));71Assert.assertEquals((int)mh.invokeExact("A","star","I am looking at","may already have","died"), 5);72}7374/**75* asCollector test using Arrays.deepToString76* @throws Throwable77*/78@Test(groups = { "level.extended" })79public void test_asCollector_SamePackage_Static_Array() throws Throwable{80MethodHandle mh = MethodHandles.lookup().findStatic(Arrays.class,"deepToString",MethodType.methodType(String.class, Object[].class));81mh = mh.asCollector(Object[].class, 1);8283Assert.assertEquals((String)mh.invokeExact( (Object) new Object[] {"There", "is", "nothing", "outside of text"}), "[[There, is, nothing, outside of text]]");84}8586/**87* Negative test : asCollector using wrong type on a MH obtained through a findVirtual call to a class in the same package88* @throws Throwable89*/90@Test(expectedExceptions = IllegalArgumentException.class, groups = { "level.extended" })91public void test_asCollector_SamePackage_Virtual_WrongType() throws Throwable{92MethodHandle mh = MethodHandles.lookup().findVirtual(SamePackageExample.class,"getLength",MethodType.methodType(int.class, String[].class));93SamePackageExample g = new SamePackageExample();94mh = mh.bindTo(g);95mh = mh.asCollector(int[].class, 2);96Assert.fail("The test case failed to throw an IllegalArgumentException in the case of the wrong method type");97}9899/**100* Cross package test : asCollector MH for a virtual method of a class in a different package101* @throws Throwable102*/103@Test(groups = { "level.extended" })104public void test_asCollector_CrossPackage_Virtual() throws Throwable{105MethodHandle mh = MethodHandles.lookup().findVirtual(PackageExamples.class,"getLength",MethodType.methodType(int.class, String[].class));106PackageExamples g = new PackageExamples();107mh = mh.bindTo(g);108mh = mh.asCollector(String[].class, 5);109110Assert.assertEquals(mh.type(), MethodType.methodType(int.class,String.class,String.class,String.class,String.class,String.class));111Assert.assertEquals((int)mh.invokeExact("A","star","I am looking at","may already have","died"), 5);112}113114/**115* Cross package test : asCollector MH for a static method of a class in a different package116* @throws Throwable117*/118@Test(groups = { "level.extended" })119public void test_asCollector_CrossPackage_Static() throws Throwable{120MethodHandle mh = MethodHandles.lookup().findStatic(PackageExamples.class,"getLengthStatic",MethodType.methodType(int.class, String[].class));121mh = mh.asCollector(String[].class, 5);122123Assert.assertEquals(mh.type(), MethodType.methodType(int.class,String.class,String.class,String.class,String.class,String.class));124Assert.assertEquals((int)mh.invokeExact("A","star","I am looking at","may already have","died"), 5);125}126127/**128* Negative test : asCollector using wrong type on a MH obtained through a findVirtual call to a class in a different package129* @throws Throwable130*/131@Test(expectedExceptions = IllegalArgumentException.class, groups = { "level.extended" })132public void test_asCollector_CrossPackage_Virtual_WrongType() throws Throwable{133MethodHandle mh = MethodHandles.lookup().findVirtual(PackageExamples.class,"getLength",MethodType.methodType(int.class, String[].class));134PackageExamples g = new PackageExamples();135mh = mh.bindTo(g);136mh = mh.asCollector(int[].class, 2);137Assert.fail("The test case failed to throw an IllegalArgumentException in the case of the wrong method type");138}139140/**141* Negative test : asCollector using wrong type on a MH that has no array argument , obtained through a findVirtual call to a class in a different package142* @throws Throwable143*/144@Test(expectedExceptions = IllegalArgumentException.class, groups = { "level.extended" })145public void test_asCollector_CrossPackage_Virtual_WrongType_nonArrayTarget() throws Throwable{146MethodHandle mh = MethodHandles.lookup().findVirtual(PackageExamples.class,"addPublic",MethodType.methodType(int.class, int.class, int.class));147PackageExamples g = new PackageExamples();148mh = mh.bindTo(g);149mh = mh.asCollector(int[].class, 2);150Assert.fail("The test case failed to throw an IllegalArgumentException in the case of the wrong method type");151}152153/**154* asCollector test for compatible array types - ie: MH takes Object[], asCollector it to String[]155* @throws Throwable156*/157@Test(groups = { "level.extended" })158public void test_asCollector_CompatibleArrayTypes_StringToObject() throws Throwable {159MethodHandle mh = MethodHandles.lookup().findVirtual(SamePackageExample.class,"arrayToString",MethodType.methodType(String.class,Object[].class));160SamePackageExample g = new SamePackageExample();161mh = mh.bindTo(g);162mh = mh.asCollector(String[].class, 2);163Assert.assertEquals((String)mh.invokeExact("a","b"), "[a,b]");164}165166/**167* asCollector test for the special case of a MH with Object as the final arg - asCollector that to an array168* @throws Throwable169*/170@Test(groups = { "level.extended" })171public void test_asCollector_TypeCompatibility_Array_Object() throws Throwable {172MethodHandle mh = MethodHandles.lookup().findVirtual(SamePackageExample.class,"toOjectArrayString",MethodType.methodType(String.class,Object.class));173SamePackageExample g = new SamePackageExample();174mh = mh.bindTo(g);175mh = mh.asCollector(Object[].class, 6);176Assert.assertEquals(mh.invoke("a",1000,true,1.1,Long.MAX_VALUE,Short.MIN_VALUE), "[a,1000,true,1.1,9223372036854775807,-32768]");177}178179/**180* asCollector test for the corner cases: 0 sized array, different array types when using 0, etc181* @throws Throwable182*/183@Test(groups = { "level.extended" })184public void test_asCollector_ZeroSizedArray() throws Throwable{185//test with String array186MethodHandle mhGetLength = MethodHandles.lookup().findVirtual(SamePackageExample.class,"getLength",MethodType.methodType(int.class,String[].class));187SamePackageExample g = new SamePackageExample();188mhGetLength = mhGetLength.bindTo(g);189mhGetLength = mhGetLength.asCollector(String[].class, 0);190Assert.assertEquals((int)mhGetLength.invokeExact(), 0);191192//test with Object array193MethodHandle mhArrayToString = MethodHandles.lookup().findVirtual(SamePackageExample.class,"arrayToString",MethodType.methodType(String.class,Object[].class));194mhArrayToString = mhArrayToString.bindTo(g);195mhArrayToString = mhArrayToString.asCollector(String[].class,0);196Assert.assertEquals((String)mhArrayToString.invokeExact(), "[]");197198//test with byte array199MethodHandle mhByteArray = MethodHandles.lookup().findVirtual(SamePackageExample.class,"getLength",MethodType.methodType(int.class,byte[].class));200mhByteArray = mhByteArray.bindTo(g);201mhByteArray = mhByteArray.asCollector(byte[].class,0);202Assert.assertEquals((int)mhByteArray.invokeExact(), 0);203204//test with short array205MethodHandle mhShortArray = MethodHandles.lookup().findVirtual(SamePackageExample.class,"getLength",MethodType.methodType(int.class,short[].class));206mhShortArray = mhShortArray.bindTo(g);207mhShortArray = mhShortArray.asCollector(short[].class,0);208Assert.assertEquals((int)mhShortArray.invokeExact(), 0);209210//test with boolean array211MethodHandle mhBooleanArray = MethodHandles.lookup().findVirtual(SamePackageExample.class,"getLength",MethodType.methodType(int.class,boolean[].class));212mhBooleanArray = mhBooleanArray.bindTo(g);213mhBooleanArray = mhBooleanArray.asCollector(boolean[].class,0);214Assert.assertEquals((int)mhBooleanArray.invokeExact(), 0);215216//test with long array217MethodHandle mhLongArray = MethodHandles.lookup().findVirtual(SamePackageExample.class,"getLength",MethodType.methodType(int.class,long[].class));218mhLongArray = mhLongArray.bindTo(g);219mhLongArray = mhLongArray.asCollector(long[].class,0);220Assert.assertEquals((int)mhLongArray.invokeExact(), 0);221222//test with char array223MethodHandle mhCharArray = MethodHandles.lookup().findVirtual(SamePackageExample.class,"getLength",MethodType.methodType(int.class,char[].class));224mhCharArray = mhCharArray.bindTo(g);225mhCharArray = mhCharArray.asCollector(char[].class,0);226Assert.assertEquals((int)mhCharArray.invokeExact(), 0);227228//test with double array229MethodHandle mhDoubleArray = MethodHandles.lookup().findVirtual(SamePackageExample.class,"getLength",MethodType.methodType(int.class,double[].class));230mhDoubleArray = mhDoubleArray.bindTo(g);231mhDoubleArray = mhDoubleArray.asCollector(double[].class,0);232Assert.assertEquals((int)mhDoubleArray.invokeExact(), 0);233234//test with float array235MethodHandle mhFloatArray = MethodHandles.lookup().findVirtual(SamePackageExample.class,"getLength",MethodType.methodType(int.class,float[].class));236mhFloatArray = mhFloatArray.bindTo(g);237mhFloatArray = mhFloatArray.asCollector(float[].class,0);238Assert.assertEquals((int)mhFloatArray.invokeExact(), 0);239240//test with int array241MethodHandle mhIntArray = MethodHandles.lookup().findVirtual(SamePackageExample.class,"getLength",MethodType.methodType(int.class,int[].class));242mhIntArray = mhIntArray.bindTo(g);243mhIntArray = mhIntArray.asCollector(int[].class,0);244Assert.assertEquals((int)mhIntArray.invokeExact(), 0);245}246247248/******************************249* Tests for asVarargsCollector250* ****************************/251252/**253* Basic asVarargsCollector test using a virtual method in a class living in the same package (uses MethodHandle.invoke)254* @throws Throwable255*/256@Test(groups = { "level.extended" })257public void test_asVarargsCollector_SamePackage_Virtual_Invoke() throws Throwable {258MethodHandle mh = MethodHandles.lookup().findVirtual(SamePackageExample.class,"arrayToString",MethodType.methodType(String.class, String[].class));259SamePackageExample g = new SamePackageExample();260mh = mh.bindTo(g);261mh = mh.asVarargsCollector(String[].class);262263Assert.assertEquals(mh.type(), MethodType.methodType(String.class,String[].class));264Assert.assertEquals(mh.invoke("A","star","I am looking at","may already have","died"), "[A,star,I am looking at,may already have,died]");265}266267/**268* Basic asVarargsCollector test using a virtual method in a class living in the same package (uses MethodHandle.invokeExact)269* @throws Throwable270*/271@Test(groups = { "level.extended" })272public void test_asVarargsCollector_SamePackage_Virtual_InvokeExact() throws Throwable {273MethodHandle mh = MethodHandles.lookup().findVirtual(SamePackageExample.class,"arrayToString",MethodType.methodType(String.class, String[].class));274SamePackageExample g = new SamePackageExample();275mh = mh.bindTo(g);276mh = mh.asVarargsCollector(String[].class);277278Assert.assertEquals(mh.type(), MethodType.methodType(String.class,String[].class));279Assert.assertEquals((String)mh.invokeExact(new String[]{"A","star","I am looking at","may already have","died"}), "[A,star,I am looking at,may already have,died]");280}281282/**283* Negative test : asVarargsCollector test using wrong method type284* @throws Throwable285*/286@Test(expectedExceptions = IllegalArgumentException.class, groups = { "level.extended" })287public void test_asVarargsCollector_SamePackage_Virtual_WrongType() throws Throwable{288MethodHandle mh = MethodHandles.lookup().findVirtual(PackageExamples.class,"getLength",MethodType.methodType(int.class, String[].class));289PackageExamples g = new PackageExamples();290mh = mh.bindTo(g);291mh = mh.asVarargsCollector(int[].class);292Assert.fail("The test case failed to throw an IllegalArgumentException in the case of the wrong method type");293}294295/**296* asVarargsCollector test using Arrays.deepToString method297* @throws Throwable298*/299@Test(groups = { "level.extended" })300public void test_asVarargsCollector_SamePackage_Static_Array() throws Throwable{301MethodHandle mh = MethodHandles.lookup().findStatic(Arrays.class,"deepToString",MethodType.methodType(String.class, Object[].class));302mh = mh.asVarargsCollector(Object[].class);303304Assert.assertEquals((String)mh.invoke((Object) new Object[] {"There", "is", "nothing", "outside of text"}), "[[There, is, nothing, outside of text]]");305}306307/**308* Basic asVarargsCollector test using a virtual method in a class living in a different package (uses MethodHandle.invoke)309* @throws Throwable310*/311@Test(groups = { "level.extended" })312public void test_asVarargsCollector_CrossPackage_Virtual_Invoke() throws Throwable {313MethodHandle mh = MethodHandles.lookup().findVirtual(PackageExamples.class,"getLength",MethodType.methodType(int.class, String[].class));314PackageExamples g = new PackageExamples();315mh = mh.bindTo(g);316mh = mh.asVarargsCollector(String[].class);317318Assert.assertEquals(mh.type(), MethodType.methodType(int.class,String[].class));319Assert.assertEquals(mh.invoke("A","star","I am looking at","may already have","died","long ago"), 6);320}321322/**323* Basic asVarargsCollector test using a virtual method in a class living in a different package (uses MethodHandle.invokeExact)324* @throws Throwable325*/326@Test(groups = { "level.extended" })327public void test_asVarargsCollector_CrossPackage_Virtual_InvokeExact() throws Throwable {328MethodHandle mh = MethodHandles.lookup().findVirtual(PackageExamples.class,"getLength",MethodType.methodType(int.class, String[].class));329PackageExamples g = new PackageExamples();330mh = mh.bindTo(g);331mh = mh.asVarargsCollector(String[].class);332333Assert.assertEquals(mh.type(), MethodType.methodType(int.class,String[].class));334Assert.assertEquals((int)mh.invokeExact(new String[]{"A","star","I am looking at","may already have","died"}), 5);335}336337/**338* Basic asVarargsCollector test using static method living in a class of a different package339* @throws Throwable340*/341@Test(groups = { "level.extended" })342public void test_asVarargsCollector_CrossPackage_Static() throws Throwable{343MethodHandle mh = MethodHandles.lookup().findStatic(PackageExamples.class,"getLengthStatic",MethodType.methodType(int.class, String[].class));344mh = mh.asVarargsCollector(String[].class);345346Assert.assertEquals(mh.type(), MethodType.methodType(int.class,String[].class));347Assert.assertEquals((int)mh.invoke("A","star","I am looking at","may already have","died"), 5);348}349350/**351* Negative test : asVarargsCollector test using wrong type and a virtual method belonging to a class in a different package352* @throws Throwable353*/354@Test(expectedExceptions = IllegalArgumentException.class, groups = { "level.extended" })355public void test_asVarargsCollector_CrossPackage_Virtual_WrongType() throws Throwable{356MethodHandle mh = MethodHandles.lookup().findVirtual(PackageExamples.class,"getLength",MethodType.methodType(int.class, String[].class));357PackageExamples g = new PackageExamples();358mh = mh.bindTo(g);359mh = mh.asVarargsCollector(int[].class);360Assert.fail("The test case failed to throw an IllegalArgumentException in the case of the wrong method type");361}362363/**364* Negative test : asVarargsCollector test using wrong method type and virtual method living in a class of a different package365* @throws Throwable366*/367@Test(expectedExceptions = IllegalArgumentException.class, groups = { "level.extended" })368public void test_asVarargsCollector_CrossPackage_Virtual_WrongType_nonArrayTarget() throws Throwable{369MethodHandle mh = MethodHandles.lookup().findVirtual(PackageExamples.class,"addPublic",MethodType.methodType(int.class, int.class, int.class));370PackageExamples g = new PackageExamples();371mh = mh.bindTo(g);372mh = mh.asVarargsCollector(int[].class);373Assert.fail("The test case failed to throw an IllegalArgumentException in the case of the wrong method type");374}375376/**377* asVarargsCollector test for compatible array types - ie: MH takes Object[], asCollector it to String[]378* @throws Throwable379*/380@Test(groups = { "level.extended" })381public void test_asVarargsCollector_CompatibleArrayTypes_StringToObject() throws Throwable {382MethodHandle mh = MethodHandles.lookup().findVirtual(SamePackageExample.class,"arrayToString",MethodType.methodType(String.class,Object[].class));383SamePackageExample g = new SamePackageExample();384mh = mh.bindTo(g);385mh = mh.asVarargsCollector(String[].class);386Assert.assertEquals((String)mh.invoke("a","b"), "[a,b]");387}388389/**390* asVarargsCollectorTest for the special case of a MH with Object as the final arg - asCollector that to an array391* @throws Throwable392*/393@Test(groups = { "level.extended" })394public void test_asVarargsCollector_TypeCompatibility_Array_Object() throws Throwable {395MethodHandle mh = MethodHandles.lookup().findVirtual(SamePackageExample.class,"toOjectArrayString",MethodType.methodType(String.class,Object.class));396SamePackageExample g = new SamePackageExample();397mh = mh.bindTo(g);398mh = mh.asVarargsCollector(Object[].class);399Assert.assertEquals(mh.invoke("a",1000,true,1.1,Long.MAX_VALUE,Short.MIN_VALUE), "[a,1000,true,1.1,9223372036854775807,-32768]");400}401402403/******************************404* Tests for asSpreader405* ****************************/406407/**408* Basic asSpreader test using a virtual method in the same package409* @throws Throwable410*/411@Test(groups = { "level.extended" })412public void test_asSpreader_SamePackage_Virtual() throws Throwable{413MethodHandle mh = MethodHandles.lookup().findVirtual(SamePackageExample.class,"addPublic",MethodType.methodType(int.class,int.class,int.class));414SamePackageExample g = new SamePackageExample();415mh = mh.bindTo(g);416mh = mh.asSpreader(int[].class, 2);417Assert.assertEquals(mh.type(), MethodType.methodType(int.class,int[].class));418Assert.assertEquals((int)mh.invokeExact(new int[] {3,2}), 5);419}420421/**422* Negative test : asSpreader test using wrong method type for a virtual method in the same package423* @throws Throwable424*/425@Test(expectedExceptions = WrongMethodTypeException.class, groups = { "level.extended" })426public void test_asSpreader_SamePackage_Virtual_WrongType() throws Throwable{427MethodHandle mh = MethodHandles.lookup().findVirtual(SamePackageExample.class,"addPublic",MethodType.methodType(int.class,int.class,int.class));428SamePackageExample g = new SamePackageExample();429mh = mh.bindTo(g);430mh = mh.asSpreader(String[].class, 2);431Assert.fail("The test case failed to throw an WrongMethodTypeException in the case of the wrong method type");432}433434/**435* Negative test : asSpreader test using wrong argument count for the target method436* @throws Throwable437*/438@Test(expectedExceptions = IllegalArgumentException.class, groups = { "level.extended" })439public void test_asSpreader_SamePackage_Virtual_WrongArgCount() throws Throwable{440MethodHandle mh = MethodHandles.lookup().findVirtual(SamePackageExample.class,"addPublic",MethodType.methodType(int.class,int.class,int.class));441SamePackageExample g = new SamePackageExample();442mh = mh.bindTo(g);443mh = mh.asSpreader(int[].class, 3);444Assert.fail("The test case failed to throw an IllegalArgumentException in the case of the wrong method type");445}446447/**448* asSpreader test using static method of a class living in the same package449* @throws Throwable450*/451@Test(groups = { "level.extended" })452public void test_asSpreader_SamePackage_Static() throws Throwable{453MethodHandle mh = MethodHandles.lookup().findStatic(SamePackageExample.class,"addPublicStatic",MethodType.methodType(int.class,int.class,int.class));454mh = mh.asSpreader(int[].class, 2);455Assert.assertEquals(mh.type(), MethodType.methodType(int.class,int[].class));456Assert.assertEquals((int)mh.invokeExact(new int[] {3,2}), 5);457}458459/**460* Negative test : asSpreader test using wrong method type for a static method belonging to a class in the same package461* @throws Throwable462*/463@Test(expectedExceptions = IllegalArgumentException.class, groups = { "level.extended" })464public void test_asSpreader_SamePackage_Static_WrongType() throws Throwable{465MethodHandle mh = MethodHandles.lookup().findStatic(SamePackageExample.class,"addPublicStatic",MethodType.methodType(int.class,int.class,int.class));466mh = mh.asSpreader(int[].class, 2);467mh = mh.asSpreader(String[].class, 2);468Assert.fail("The test case failed to throw an IllegalArgumentException in the case of the wrong method type");469}470471/**472* Basic asSpreader test using cross package virtual method473* @throws Throwable474*/475@Test(groups = { "level.extended" })476public void test_asSpreader_CrossPackage_Virtual() throws Throwable{477MethodHandle mh = MethodHandles.lookup().findVirtual(PackageExamples.class,"addPublic",MethodType.methodType(int.class,int.class,int.class));478PackageExamples g = new PackageExamples();479mh = mh.bindTo(g);480mh = mh.asSpreader(int[].class, 2);481Assert.assertEquals(mh.type(), MethodType.methodType(int.class,int[].class));482Assert.assertEquals((int)mh.invokeExact(new int[] {3,2}), 5);483}484485/**486* Basic asSpreader test using cross package static method487* @throws Throwable488*/489@Test(groups = { "level.extended" })490public void test_asSpreader_CrossPackage_Static() throws Throwable{491MethodHandle mh = MethodHandles.lookup().findStatic(PackageExamples.class,"addPublicStatic",MethodType.methodType(int.class,int.class,int.class));492mh = mh.asSpreader(int[].class, 2);493Assert.assertEquals(mh.type(), MethodType.methodType(int.class,int[].class));494Assert.assertEquals((int)mh.invokeExact(new int[] {3,2}), 5);495}496497/**498* Negative test : asSpreader test using cross package virtual method with a wrong method type499* @throws Throwable500*/501@Test(expectedExceptions = WrongMethodTypeException.class, groups = { "level.extended" })502public void test_asSpreader_CrossPackage_Virtual_WrongType() throws Throwable{503MethodHandle mh = MethodHandles.lookup().findVirtual(PackageExamples.class,"addPublic",MethodType.methodType(int.class,int.class,int.class));504PackageExamples g = new PackageExamples();505mh = mh.bindTo(g);506mh = mh.asSpreader(String[].class, 2);507Assert.fail("The test case failed to throw an WrongMethodTypeException in the case of the wrong method type");508}509510/**511* Negative test : asSpreader test using a cross-package static method and wrong method type512* @throws Throwable513*/514@Test(expectedExceptions = IllegalArgumentException.class, groups = { "level.extended" })515public void test_asSpreader_CrossPackage_Static_WrongType() throws Throwable{516MethodHandle mh = MethodHandles.lookup().findStatic(PackageExamples.class,"addPublicStatic",MethodType.methodType(int.class,int.class,int.class));517mh = mh.asSpreader(int[].class, 2);518mh = mh.asSpreader(String[].class, 2);519Assert.fail("The test case failed to throw an IllegalArgumentException in the case of the wrong method type");520}521522/**523* Negative test : asSpreader test using cross package static method and a wrong argument count524* @throws Throwable525*/526@Test(expectedExceptions = IllegalArgumentException.class, groups = { "level.extended" })527public void test_asSpreader_CrossPackage_Static_WrongArgCount() throws Throwable{528MethodHandle mh = MethodHandles.lookup().findStatic(PackageExamples.class,"addPublicStatic",MethodType.methodType(int.class,int.class,int.class));529mh = mh.asSpreader(int[].class, 3);530Assert.fail("The test case failed to throw an IllegalArgumentException in the case of the wrong argument count");531}532533/******************************534* Tests for MethodHandle arity535* ****************************/536/**537* Create MethodHandle with highest possible arity and use findConstructor (253)538* @throws Throwable539*/540@Test(groups = { "level.extended" })541public void test_findConstructor_ArityLimit() throws Throwable {542MethodHandle mh = MethodHandles.lookup().findConstructor(HelperConstructorClass.class, helperMethodType_void_253int);543mh = mh.asSpreader(int[].class, 253);544}545546/**547* Negative test: Create MethodHandle with highest possible arity + 1 (254)548* @throws Throwable549*/550@Test(expectedExceptions = IllegalArgumentException.class, groups = { "level.extended" })551public void test_findConstructor_ArityLimit_TooHigh() throws Throwable {552MethodHandles.lookup().findConstructor(HelperConstructorClass.class, helperMethodType_void_254int);553Assert.fail("The test case failed to detect that the argument slots exceeds the upper limit (255)");554}555556/**557* Create MethodHandle with highest possible arity and use asSpreader (253)558* @throws Throwable559*/560@Test(groups = { "level.extended" })561public void test_asSpreader_ArityLimit() throws Throwable {562MethodHandle mh = null;563mh = MethodHandles.lookup().findVirtual(MethodHandleTest.class, "helperSpreaderMethod_253arg", helperMethodType_void_253int);564mh = mh.asSpreader(int[].class, 253);565}566567/**568* Create static MethodHandle with highest possible arity and use asSpreader (254)569* @throws Throwable570*/571@Test(groups = { "level.extended" })572public void test_asSpreader_Static_ArityLimit() throws Throwable {573MethodHandle mh = null;574mh = MethodHandles.lookup().findStatic(MethodHandleTest.class, "helperSpreaderStaticMethod_254arg", helperMethodType_void_254int);575mh = mh.asSpreader(int[].class, 254);576}577578/**579* Negative test: Create MethodHandle with highest possible arity + 1 (254)580* @throws Throwable581*/582@Test(expectedExceptions = IllegalArgumentException.class, groups = { "level.extended" })583public void test_MethodHandle_ArityLimit_TooHigh() throws Throwable {584MethodHandles.lookup().findVirtual(MethodHandleTest.class, "helperSpreaderMethod_254arg", helperMethodType_void_254int);585Assert.fail("The test case failed to detect that the argument slots exceeds the upper limit (255)");586}587588/**589* Negative test: Create static MethodHandle with highest possible arity + 1 (255)590* @throws Throwable591*/592@Test(expectedExceptions = IllegalArgumentException.class, groups = { "level.extended" })593public void test_MethodHandle_Static_ArityLimit_TooHigh() throws Throwable {594MethodHandles.lookup().findStatic(MethodHandleTest.class, "helperSpreaderStaticMethod_255arg", helperMethodType_void_255int);595Assert.fail("The test case failed to detect that the argument slots exceeds the upper limit (255)");596}597598/**599* Create MethodHandle with highest possible arity using asCollector (253)600* @throws Throwable601*/602@Test(groups = { "level.extended" })603public void test_asCollector_ArityLimit() throws Throwable {604MethodHandle mh = MethodHandles.lookup().findVirtual(MethodHandleTest.class, "helperCollectorMethod", MethodType.methodType(void.class,int[].class));605mh = mh.asCollector(int[].class, 253);606}607608/**609* Negative test: Create MethodHandle with highest possible arity + 1 using asCollector (254)610* @throws Throwable611*/612@Test(expectedExceptions = IllegalArgumentException.class, groups = { "level.extended" })613public void test_asCollector_ArityLimit_TooHigh() throws Throwable {614MethodHandle mh = MethodHandles.lookup().findVirtual(MethodHandleTest.class, "helperCollectorMethod", MethodType.methodType(void.class, int[].class));615mh = mh.asCollector(int[].class, 254);616Assert.fail("The test case failed to detect that the argument slots exceeds the upper limit (255)");617}618619/**620* Create MethodHandle with highest possible arity using asCollector (254)621* @throws Throwable622*/623@Test(groups = { "level.extended" })624public void test_asCollector_Static_ArityLimit() throws Throwable {625MethodHandle mh = MethodHandles.lookup().findStatic(MethodHandleTest.class, "helperStaticCollectorMethod", MethodType.methodType(void.class, int[].class));626mh = mh.asCollector(int[].class, 254);627}628629/**630* Negative test: Create MethodHandle with highest possible arity + 1 using asCollector (255)631* @throws Throwable632*/633@Test(expectedExceptions = IllegalArgumentException.class, groups = { "level.extended" })634public void test_asCollector_Static_ArityLimit_TooHigh() throws Throwable {635MethodHandle mh = MethodHandles.lookup().findStatic(MethodHandleTest.class, "helperStaticCollectorMethod", MethodType.methodType(void.class, int[].class));636mh = mh.asCollector(int[].class, 255);637Assert.fail("The test case failed to detect that the argument slots exceeds the upper limit (255)");638}639640/**641* Create spreadInvoker with highest possible arity (253)642* @throws Throwable643*/644@Test(groups = { "level.extended" })645public void test_spreadInvoker_ArityLimit() throws Throwable {646final int args = 252;647MethodHandle mh = MethodHandles.lookup().findVirtual(MethodHandleTest.class, "helperSpreaderMethod_" + args + "arg", helperMethodType_void_252int);648MethodHandle invoker = MethodHandles.spreadInvoker(helperMethodType_void_252int.insertParameterTypes(0, MethodHandleTest.class), 1);649Object[] a = new Object[args];650for (int i = 0; i < args; i++) {651a[i] = 0;652}653invoker.invoke(mh, new MethodHandleTest(), a);654}655656/**657* Create spreadInvoker with highest possible arity 254)658* @throws Throwable659*/660@Test(groups = { "level.extended" })661public void test_spreadInvoker_Static_ArityLimit() throws Throwable {662final int args = 253;663MethodHandle mh = MethodHandles.lookup().findStatic(MethodHandleTest.class, "helperSpreaderStaticMethod_" + args + "arg", helperMethodType_void_253int);664MethodHandle invoker = MethodHandles.spreadInvoker(helperMethodType_void_253int, 0);665Object[] a = new Object[args];666for (int i = 0; i < args; i++) {667a[i] = 0;668}669invoker.invoke(mh, a);670}671672/**673* Create exactInvoker with highest possible arity (252)674* @throws Throwable675*/676@Test(groups = { "level.extended" })677public void test_exactInvoker_ArityLimit() throws Throwable {678final int args = 252;679MethodHandle mh = MethodHandles.lookup().findVirtual(MethodHandleTest.class, "helperSpreaderMethod_" + args + "arg", helperMethodType_void_252int);680MethodHandle invoker = MethodHandles.exactInvoker(helperMethodType_void_252int.insertParameterTypes(0, MethodHandleTest.class));681invoker.invokeExact(mh, new MethodHandleTest(),6820, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,6830, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,6840, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,6850, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,6860, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,6870, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,6880, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,6890, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,6900, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,6910, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,6920, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,6930, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,6940, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);695}696697/**698* Create static exactInvoker with highest possible arity (253)699* @throws Throwable700*/701@Test(groups = { "level.extended" })702public void test_exactInvoker_Static_ArityLimit() throws Throwable {703final int args = 253;704MethodHandle mh = MethodHandles.lookup().findStatic(MethodHandleTest.class, "helperSpreaderStaticMethod_" + args + "arg", helperMethodType_void_253int);705MethodHandle invoker = MethodHandles.exactInvoker(helperMethodType_void_253int);706invoker.invokeExact(mh,7070, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,7080, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,7090, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,7100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,7110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,7120, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,7130, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,7140, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,7150, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,7160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,7170, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,7180, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,7190, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);720}721722/**723* Negative test: Create exactInvoker with highest possible arity + 1 (253)724* @throws Throwable725*/726@Test(expectedExceptions = IllegalArgumentException.class, groups = { "level.extended" })727public void test_exactInvoker_ArityLimit_TooHigh() throws Throwable {728MethodHandles.exactInvoker(helperMethodType_void_253int.insertParameterTypes(0, MethodHandleTest.class));729Assert.fail("The test case failed to detect that the argument slots exceeds the upper limit (255)");730}731732/**733* Negative test: Create static exactInvoker with highest possible arity + 1 (254)734* @throws Throwable735*/736@Test(expectedExceptions = IllegalArgumentException.class, groups = { "level.extended" })737public void test_exactInvoker_Static_ArityLimit_TooHigh() throws Throwable {738MethodHandles.exactInvoker(helperMethodType_void_254int);739Assert.fail("The test case failed to detect that the argument slots exceeds the upper limit (255)");740}741742/**743* Create invoker with highest possible arity (252)744* @throws Throwable745*/746@Test(groups = { "level.extended" })747public void test_invoker_ArityLimit() throws Throwable {748final int args = 252;749MethodHandle mh = MethodHandles.lookup().findVirtual(MethodHandleTest.class, "helperSpreaderMethod_" + args + "arg", helperMethodType_void_252int);750MethodHandle invoker = MethodHandles.invoker(helperMethodType_void_252int.insertParameterTypes(0, MethodHandleTest.class));751invoker.invoke(mh, new MethodHandleTest(),7520, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,7530, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,7540, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,7550, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,7560, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,7570, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,7580, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,7590, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,7600, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,7610, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,7620, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,7630, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,7640, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);765}766767/**768* Create invoker with highest possible arity (253)769* @throws Throwable770*/771@Test(groups = { "level.extended" })772public void test_invoker_Static_ArityLimit() throws Throwable {773final int args = 253;774MethodHandle mh = MethodHandles.lookup().findStatic(MethodHandleTest.class, "helperSpreaderStaticMethod_" + args + "arg", helperMethodType_void_253int);775MethodHandle invoker = MethodHandles.invoker(helperMethodType_void_253int);776invoker.invoke(mh,7770, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,7780, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,7790, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,7800, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,7810, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,7820, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,7830, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,7840, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,7850, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,7860, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,7870, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,7880, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,7890, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);790}791792/**793* Negative test: Create invoker with highest possible arity + 1 (253)794* @throws Throwable795*/796@Test(expectedExceptions = IllegalArgumentException.class, groups = { "level.extended" })797public void test_invoker_ArityLimit_TooHigh() throws Throwable {798MethodHandles.invoker(helperMethodType_void_253int.insertParameterTypes(0, MethodHandleTest.class));799Assert.fail("The test case failed to detect that the argument slots exceeds the upper limit (255)");800}801802/**803* Negative test: Create static invoker with highest possible arity + 1 (254)804* @throws Throwable805*/806@Test(expectedExceptions = IllegalArgumentException.class, groups = { "level.extended" })807public void test_invoker_Static_ArityLimit_TooHigh() throws Throwable {808MethodHandles.invoker(helperMethodType_void_254int);809Assert.fail("The test case failed to detect that the argument slots exceeds the upper limit (255)");810}811812@Test(groups = { "level.extended" })813public void test_invokeWithArguments_ArityLimit() throws Throwable {814MethodHandle mh = MethodHandles.lookup().findVirtual(MethodHandleTest.class, "helperSpreaderMethod_253arg", helperMethodType_void_253int);815mh.invokeWithArguments(new MethodHandleTest(),8160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8170, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8180, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8190, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8200, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8210, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8220, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8230, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8240, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8250, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8260, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8270, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8280, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);829}830831@Test(groups = { "level.extended" })832public void test_invokeWithArguments_Static_ArityLimit() throws Throwable {833MethodHandle mh = MethodHandles.lookup().findStatic(MethodHandleTest.class, "helperSpreaderStaticMethod_254arg", helperMethodType_void_254int);834mh.invokeWithArguments(8350, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8360, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8370, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8380, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8390, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8400, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8410, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8420, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8430, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8440, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8450, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8460, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8470, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);848}849850/**851* 252 characters: below character limit for variable arity invokeWithArguments.852* @throws Throwable853*/854@Test(groups = { "level.extended" })855public void test_invokeWithArguments_VarArgs_SmallArityLimit() throws Throwable {856MethodHandle mh = MethodHandles.lookup().findVirtual(MethodHandleTest.class, "helperVarArgsMethod",857MethodType.methodType(void.class, String.class, int[].class));858mh.invokeWithArguments(new MethodHandleTest(), "test",8590, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8600, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8610, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8620, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8630, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8640, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8650, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8660, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8670, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8680, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8690, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8700, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8710, 0, 0, 0, 0, 0, 0, 0, 0, 0);872}873874/**875* 254 characters: the maximum number of characters for a variable arity MethodHandle.876* @throws Throwable877*/878@Test(groups = { "level.extended" })879public void test_invokeWithArguments_VarArgs_EdgeArityLimit() throws Throwable {880MethodHandle mh = MethodHandles.lookup().findVirtual(MethodHandleTest.class, "helperVarArgsMethod",881MethodType.methodType(void.class, String.class, int[].class));882mh.invokeWithArguments(new MethodHandleTest(), "test",8830, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8840, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8850, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8860, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8870, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8880, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8890, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8900, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8910, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8920, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8930, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8940, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,8950, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);896}897898/******************************899* Tests for asFixedArity900* ****************************/901902/**903* asFixedArity test to ensure MethodHandles.lookup().find* methods returned varargs handles for methods with the ACC_VARARGS bit904* @throws Throwable905*/906@Test(groups = { "level.extended" })907public void test_asFixedArity_Using_VariableArity_JavaMethod_Virtual_SamePackage() throws Throwable {908MethodHandle mh = MethodHandles.lookup().findVirtual(SamePackageExample.class,"takeVariableArityObject", MethodType.methodType(void.class, Object[].class));909SamePackageExample g = new SamePackageExample();910911Assert.assertTrue(mh.isVarargsCollector());912913mh = mh.asFixedArity();914915//Ensure after calling asFixedArity, it is no longer a varargs handles916Assert.assertFalse(mh.isVarargsCollector());917918Assert.assertEquals(mh.invoke(g,new Object[]{new Object[]{"abc",true,12}}), null);919}920921/**922* Basic asFixedArity test using a same-package static method923* @throws Throwable924*/925@Test(groups = { "level.extended" })926public void test_asFixedArity_SamePackage_Static() throws Throwable {927MethodHandle mh = MethodHandles.lookup().findStatic(SamePackageExample.class, "getLengthStatic", MethodType.methodType(int.class,String[].class));928mh = mh.asVarargsCollector(String[].class);929MethodHandle mhFix = mh.asFixedArity();930931Assert.assertFalse(mhFix.isVarargsCollector());932Assert.assertEquals(mhFix.invoke(new String[]{"a","b","c","d","e"}), 5);933}934935/**936* Negative test : asFixedArity test using variable input937* @throws Throwable938*/939@Test(expectedExceptions = WrongMethodTypeException.class, groups = { "level.extended" })940public void test_asFixedArity_SamePackage_Static_VarialbeInput() throws Throwable {941MethodHandle mh = MethodHandles.lookup().findStatic(SamePackageExample.class, "getLengthStatic", MethodType.methodType(int.class,String[].class));942mh = mh.asVarargsCollector(String[].class);943944MethodHandle mhFix = mh.asFixedArity();945946Assert.assertFalse(mhFix.isVarargsCollector());947948mhFix.invoke("a","b","c","d","e");949Assert.fail("The test case failed to throw an WrongMethodTypeException in using variable input");950}951952953/****************************************954* Tests for invokeWithArguments(List<?>)955* **************************************/956957public static String helper_invokeWithArguments_List_Different_Array_Type(Object a, Object b, Object c) {958return "" + a + ":" + b + ":" + c;959}960961/**962* Basic invokeWithArgument(List<?>) test using same-package virtual method963* @throws Throwable964*/965@Test(groups = { "level.extended" })966public void test_invokeWithArguments_List_Different_Array_Type() throws Throwable {967MethodHandle mh = MethodHandles.lookup().findStatic(968MethodHandleTest.class,969"helper_invokeWithArguments_List_Different_Array_Type",970MethodType.methodType(String.class, Object.class,Object.class,Object.class));971String result = (String)mh.invokeWithArguments(Arrays.asList("A", "B", "C"));972Assert.assertEquals(result, "A:B:C");973}974975/**976* Basic invokeWithArgument(List<?>) test using same-package virtual method977* @throws Throwable978*/979@Test(groups = { "level.extended" })980public void test_invokeWithArguments_List_SamePackage_Virtual() throws Throwable{981MethodHandle mh = MethodHandles.lookup().findVirtual(SamePackageExample.class, "addPublic", MethodType.methodType(int.class,int.class,int.class));982SamePackageExample g = new SamePackageExample();983mh = mh.bindTo(g);984985List<Integer> l = new ArrayList<Integer>();986l.add(1);987l.add(2);988989Assert.assertEquals((int)mh.invokeWithArguments(l), 3);990}991992/**993* Negative test : invokeWithArgument(List<?>) test with mismatched number of argument passed in argument list994* @throws Throwable995*/996@Test(expectedExceptions = WrongMethodTypeException.class, groups = { "level.extended" })997public void test_invokeWithArguments_List_SamePackage_Virtual_WrongArgCount() throws Throwable{998MethodHandle mh = MethodHandles.lookup().findVirtual(SamePackageExample.class, "addPublic", MethodType.methodType(int.class,int.class,int.class));999SamePackageExample g = new SamePackageExample();1000mh = mh.bindTo(g);10011002List<Integer> l = new ArrayList<Integer>();1003l.add(1);1004l.add(2);1005l.add(3);10061007mh.invokeWithArguments(l);1008Assert.fail("The test case failed to throw an WrongMethodTypeException in the case of mismatched number of argument");1009}10101011/**1012* invokeWithArgument(List<?>) test using a same-package static method1013* @throws Throwable1014*/1015@Test(groups = { "level.extended" })1016public void test_invokeWithArguments_List_SamePackage_Static() throws Throwable{1017MethodHandle mh = MethodHandles.lookup().findStatic(SamePackageExample.class, "addPublicStatic", MethodType.methodType(int.class,int.class,int.class));10181019List<Integer> l = new ArrayList<Integer>();1020l.add(1);1021l.add(2);10221023Assert.assertEquals((int)mh.invokeWithArguments(l), 3);1024}10251026/**1027* invokeWithArgument(List<?>) test using a cross-package virtual method1028* @throws Throwable1029*/1030@Test(groups = { "level.extended" })1031public void test_invokeWithArguments_List_CrossPackage_Virtual() throws Throwable{1032MethodHandle mh = MethodHandles.lookup().findVirtual(PackageExamples.class, "addPublic", MethodType.methodType(int.class,int.class,int.class));1033PackageExamples g = new PackageExamples();1034mh = mh.bindTo(g);10351036List<Integer> l = new ArrayList<Integer>();1037l.add(1);1038l.add(2);10391040Assert.assertEquals((int)mh.invokeWithArguments(l), 3);1041}10421043/**1044* invokeWithArgument(List<?>) test using a cross-package static method1045* @throws Throwable1046*/1047@Test(groups = { "level.extended" })1048public void test_invokeWithArguments_List_CrossPackage_Static() throws Throwable{1049MethodHandle mh = MethodHandles.lookup().findStatic(PackageExamples.class, "addPublicStatic", MethodType.methodType(int.class,int.class,int.class));10501051List<Integer> l = new ArrayList<Integer>();1052l.add(1);1053l.add(2);10541055Assert.assertEquals((int)mh.invokeWithArguments(l), 3);1056}105710581059/****************************************1060* Tests for invokeWithArguments(Object...)1061* **************************************/10621063@Test(expectedExceptions = WrongMethodTypeException.class, groups = { "level.extended" })1064public void test_invokeWithArguments_WMT_NULL_args() throws Throwable {1065MethodHandle mh = MethodHandles.lookup().findVirtual(Object.class, "toString", MethodType.methodType(String.class));1066mh.invokeWithArguments("receiver", null, null);1067Assert.fail("The test case failed to throw an WrongMethodTypeException in the case of null arguments");1068}10691070/**1071* invokeWithArguments(Object... args) test using a same-package virtual method1072* @throws Throwable1073*/1074@Test(groups = { "level.extended" })1075public void test_invokeWithArguments_VarargsObj_SamePackage_Virtual() throws Throwable{1076MethodHandle mh = MethodHandles.lookup().findVirtual(SamePackageExample.class, "addPublic", MethodType.methodType(int.class,int.class,int.class));1077SamePackageExample g = new SamePackageExample();10781079Assert.assertEquals((int)mh.invokeWithArguments(g,1,2), 3);1080}10811082/**1083* invokeWithArguments(Object... args) test to ensure that the varargsCollector behavior is respected by the invokeWithArguments call1084* @throws Throwable1085*/1086@Test(groups = { "level.extended" })1087public void test_invokeWithArguments_VarargsObj_SamePackage_Virtual_VarargsMethod() throws Throwable{1088MethodHandle mh = MethodHandles.lookup().findVirtual(SamePackageExample.class, "addPublicVariableArity", MethodType.methodType(int.class,Object[].class));1089SamePackageExample g = new SamePackageExample();10901091Assert.assertTrue(mh.isVarargsCollector());10921093Assert.assertEquals(mh.invokeWithArguments(g, 1, 2, 2, 2, 2), 9);1094}10951096/**1097* Negative test : invokeWithArguments(Object... args) with wrong argument type1098* @throws Throwable1099*/1100@Test(expectedExceptions = WrongMethodTypeException.class, groups = { "level.extended" })1101public void test_invokeWithArguments_VarargsObj_SamePackage_Virtual_WrongArgCount() throws Throwable{1102MethodHandle mh = MethodHandles.lookup().findVirtual(SamePackageExample.class, "addPublic", MethodType.methodType(int.class,int.class,int.class));1103SamePackageExample g = new SamePackageExample();1104mh = mh.bindTo(g);1105mh.invokeWithArguments(1,2,3);1106Assert.fail("The test case failed to throw an WrongMethodTypeException in the case of wrong argument type");1107}11081109/**1110* invokeWithArguments(Object... args) test with same-package static method1111* @throws Throwable1112*/1113@Test(groups = { "level.extended" })1114public void test_invokeWithArguments_VarargsObj_SamePackage_Static() throws Throwable{1115MethodHandle mh = MethodHandles.lookup().findStatic(SamePackageExample.class, "addPublicStatic", MethodType.methodType(int.class,int.class,int.class));11161117Object [] l = new Object[2];1118l[0] = 1;1119l[1] = 2;11201121Assert.assertEquals((int)mh.invokeWithArguments(l), 3);1122}11231124/**1125* invokeWithArguments(Object... args) with cross-package virtual method1126* @throws Throwable1127*/1128@Test(groups = { "level.extended" })1129public void test_invokeWithArguments_VarargsObj_CrossPackage_Virtual() throws Throwable{1130MethodHandle mh = MethodHandles.lookup().findVirtual(PackageExamples.class, "addPublic", MethodType.methodType(int.class,int.class,int.class));1131PackageExamples g = new PackageExamples();1132mh = mh.bindTo(g);11331134Object [] l = new Object[2];1135l[0] = 1;1136l[1] = 2;11371138Assert.assertEquals((int)mh.invokeWithArguments(l), 3);1139}11401141/**1142* invokeWithArguments(Object... args) with cross-package static method1143* @throws Throwable1144*/1145@Test(groups = { "level.extended" })1146public void test_invokeWithArguments_VarargsObj_CrossPackage_Static() throws Throwable{1147MethodHandle mh = MethodHandles.lookup().findStatic(PackageExamples.class, "addPublicStatic", MethodType.methodType(int.class,int.class,int.class));11481149Object [] l = new Object[2];1150l[0] = 1;1151l[1] = 2;11521153Assert.assertEquals((int)mh.invokeWithArguments(l), 3);1154}11551156/**1157* invokeWithArguments(Object... args) test with Corner case of 0 length array1158* @throws Throwable1159*/1160@Test(expectedExceptions = WrongMethodTypeException.class, groups = { "level.extended" })1161public void test_invokeWithArguments_VarargsObj_CrossPackage_Static_ZeroLengthArray() throws Throwable{1162MethodHandle mh = MethodHandles.lookup().findStatic(SamePackageExample.class, "returnOne", MethodType.methodType(String.class));11631164Object [] l = new Object[0];11651166Assert.assertEquals((String)mh.invokeWithArguments(l), "1");11671168MethodHandle mh2 = MethodHandles.lookup().findStatic(SamePackageExample.class, "addPublicStatic", MethodType.methodType(int.class,int.class,int.class));11691170Object [] l2 = new Object[0];11711172mh2.invokeWithArguments(l2);1173Assert.fail("The test case failed to throw an WrongMethodTypeException in the case of 0 length array");1174}11751176/****************************************1177* Tests for isVarargsCollector1178* **************************************/11791180/**1181* Test isVarargsCollector using a call to asVarargsCollector1182* @throws Throwable1183*/1184@Test(groups = { "level.extended" })1185public void test_isVarargsCollector_Using_asVarargsCollector_Virtual_SamePackage() throws Throwable{1186MethodHandle mh = MethodHandles.lookup().findVirtual(SamePackageExample.class,"arrayToString",MethodType.methodType(String.class, String[].class));1187SamePackageExample g = new SamePackageExample();1188mh = mh.bindTo(g);1189mh = mh.asVarargsCollector(String[].class);11901191Assert.assertTrue(mh.isVarargsCollector());1192}11931194/**1195* Negative test : isVarargsCollector test using asCollector call1196* @throws Throwable1197*/1198@Test(groups = { "level.extended" })1199public void test_isVarargsCollector_Using_asCollector_Virtual_SamePackage() throws Throwable{1200MethodHandle mh = MethodHandles.lookup().findVirtual(SamePackageExample.class,"arrayToString",MethodType.methodType(String.class, String[].class));1201SamePackageExample g = new SamePackageExample();1202mh = mh.bindTo(g);1203mh = mh.asCollector(String[].class,3);12041205Assert.assertFalse(mh.isVarargsCollector());1206}12071208/**1209* Basic isVarargsCollector test using a cross-package static method1210* @throws Throwable1211*/1212@Test(groups = { "level.extended" })1213public void test_isVarargsCollector_Using_asVarargsCollector_Static_CrossPackage() throws Throwable{1214MethodHandle mh = MethodHandles.lookup().findStatic(PackageExamples.class,"getLengthStatic",MethodType.methodType(int.class, String[].class));1215mh = mh.asVarargsCollector(String[].class);12161217Assert.assertTrue(mh.isVarargsCollector());1218}12191220/**1221* Test isVarargsCollector using a asVarargsCollector type MethodHandle obtained from a call to a lookup method which resolves to a variable arity Java method1222* @throws Throwable1223*/1224@Test(groups = { "level.extended" })1225public void test_isVarargsCollector_Using_VariableArity_JavaMethod_Virtual_SamePackage() throws Throwable{1226MethodHandle mh = MethodHandles.lookup().findVirtual(SamePackageExample.class,"addPublicVariableArity",MethodType.methodType(int.class, int[].class));12271228Assert.assertTrue(mh.isVarargsCollector());1229}12301231/**1232* Test isVarargsCollector using MethodHandle obtained from a call to a lookup method which resolves to a variable arity Java constructor1233* @throws Throwable1234*/1235@Test(groups = { "level.extended" })1236public void test_isVarargsCollector_Using_VariableArity_JavaConstructor_SamePackage() throws Throwable{1237MethodHandle mh = MethodHandles.lookup().findConstructor(SamePackageExample.class,MethodType.methodType(void.class, int[].class));12381239Assert.assertTrue(mh.isVarargsCollector());1240}12411242/**1243* Test isVarargsCollector using a asVarargsCollector type MH obtained from a call to a lookup method which resolves to a variable arity Java method in a different package1244* @throws Throwable1245*/1246@Test(groups = { "level.extended" })1247public void test_isVarargsCollector_Using_VariableArity_JavaMethod_Virtual_CrossPackage() throws Throwable{1248MethodHandle mh = MethodHandles.lookup().findVirtual(PackageExamples.class,"addPublicVariableArity",MethodType.methodType(int.class, int[].class));12491250Assert.assertTrue(mh.isVarargsCollector());1251}12521253/**1254* Test isVarargsCollector using a asVarargsCollector type MH obtained from a call to a lookup method which resolves to a static variable arity Java method in a different package1255* @throws Throwable1256*/1257@Test(groups = { "level.extended" })1258public void test_isVarargsCollector_Using_VariableArity_JavaMethod_Static_CrossPackage() throws Throwable{1259MethodHandle mh = MethodHandles.lookup().findStatic(PackageExamples.class,"addPublicStaticVariableArity",MethodType.methodType(int.class, int[].class));12601261Assert.assertTrue(mh.isVarargsCollector());1262}12631264/**1265* Test isVarargsCollector to ensure that an asVarargsCollector handle that has been asTyped() to the same type still remains asVarargsCollector type1266* @throws Throwable1267*/1268@Test(groups = { "level.extended" })1269public void test_isVarargsCollector_Using_asVarargsCollector_asTyped() throws Throwable {1270MethodHandle mh = MethodHandles.lookup().findStatic(PackageExamples.class,"addPublicStaticVariableArity",MethodType.methodType(int.class, int[].class));12711272Assert.assertTrue(mh.isVarargsCollector());12731274mh = mh.asType(MethodType.methodType(int.class,int[].class));12751276Assert.assertTrue(mh.isVarargsCollector());1277}12781279/**1280* Ensure that an asVarargsCollector handle that has been asTyped() to a different type no longer remains asVarargsCollector type1281* Change type of argument from int --> byte1282* @throws Throwable1283*/1284@Test(groups = { "level.extended" })1285public void test_isVarargsCollector_Using_asVarargsCollector_asTyped_arg_int_to_byte() throws Throwable {1286MethodHandle mh = MethodHandles.lookup().findStatic(PackageExamples.class,"addPublicStaticVariableArity",MethodType.methodType(int.class, int[].class));12871288Assert.assertTrue(mh.isVarargsCollector());12891290mh = mh.asType(MethodType.methodType(int.class,byte.class));12911292Assert.assertFalse(mh.isVarargsCollector());1293}12941295/**1296* Ensure that an asVarargsCollector handle that has been asTyped() to a different type no longer remains asVarargsCollector type1297* Negative test : Change return type from int --> byte : This should throw exception as return types can only be converted from small to big types1298* @throws Throwable1299*/1300@Test(expectedExceptions = WrongMethodTypeException.class, groups = { "level.extended" })1301public void test_isVarargsCollector_Using_asVarargsCollector_asTyped_RT_int_to_byte() throws Throwable {1302MethodHandle mh = MethodHandles.lookup().findStatic(PackageExamples.class,"addPublicStaticVariableArity",MethodType.methodType(int.class, int[].class));13031304Assert.assertTrue(mh.isVarargsCollector());13051306mh = mh.asType(MethodType.methodType(byte.class,int[].class));1307Assert.fail("The test case failed to throw an WrongMethodTypeException as return types can only be converted from small to big types");1308}13091310/**1311* Ensure that an asVarargsCollector handle that has been asTyped() to a different type no longer remains asVarargsCollector type1312* Change type of argument from int --> short1313* @throws Throwable1314*/1315@Test(groups = { "level.extended" })1316public void test_isVarargsCollector_Using_asVarargsCollector_asTyped_arg_int_to_short() throws Throwable {1317MethodHandle mh = MethodHandles.lookup().findStatic(PackageExamples.class,"addPublicStaticVariableArity",MethodType.methodType(int.class, int[].class));13181319Assert.assertTrue(mh.isVarargsCollector());13201321mh = mh.asType(MethodType.methodType(int.class,short.class));13221323Assert.assertFalse(mh.isVarargsCollector());1324}13251326/**1327* Ensure that an asVarargsCollector handle that has been asTyped() to a different type no longer remains asVarargsCollector type1328* Negative test : Change return type from int --> short : This should throw exception as return types can only be converted from small to big types1329* @throws Throwable1330*/1331@Test(expectedExceptions = WrongMethodTypeException.class, groups = { "level.extended" })1332public void test_isVarargsCollector_Using_asVarargsCollector_asTyped_RT_int_to_short() throws Throwable {1333MethodHandle mh = MethodHandles.lookup().findStatic(PackageExamples.class,"addPublicStaticVariableArity",MethodType.methodType(int.class, int[].class));13341335Assert.assertTrue(mh.isVarargsCollector());13361337mh = mh.asType(MethodType.methodType(short.class,int[].class));1338Assert.fail("The test case failed to throw an WrongMethodTypeException as return types can only be converted from small to big types");1339}13401341/**1342* Ensure that an asVarargsCollector handle that has been asTyped() to a different type no longer remains asVarargsCollector type1343* Negative test : Change type of argument from int --> long : This is an invalid conversion1344* @throws Throwable1345*/1346@Test(expectedExceptions = WrongMethodTypeException.class, groups = { "level.extended" })1347public void test_isVarargsCollector_Using_asVarargsCollector_asTyped_arg_int_to_long() throws Throwable {1348MethodHandle mh = MethodHandles.lookup().findStatic(PackageExamples.class,"addPublicStaticVariableArity",MethodType.methodType(int.class, int[].class));13491350Assert.assertTrue(mh.isVarargsCollector());13511352mh = mh.asType(MethodType.methodType(int.class,long.class));1353Assert.fail("The test case failed to throw an WrongMethodTypeException in the case of the invalid type conversion from int to long");1354}135513561357/**1358* Ensure that an asVarargsCollector handle that has been asTyped() to a different type no longer remains asVarargsCollector type1359* Change return type from int --> long1360* @throws Throwable1361*/1362@Test(groups = { "level.extended" })1363public void test_isVarargsCollector_Using_asVarargsCollector_asTyped_RT_int_to_long() throws Throwable {1364MethodHandle mh = MethodHandles.lookup().findStatic(PackageExamples.class,"addPublicStaticVariableArity",MethodType.methodType(int.class, int[].class));13651366Assert.assertTrue(mh.isVarargsCollector());13671368mh = mh.asType(MethodType.methodType(long.class,int[].class));13691370Assert.assertFalse(mh.isVarargsCollector());1371}13721373/**1374* Ensure that an asVarargsCollector handle that has been asTyped() to a different type no longer remains asVarargsCollector type1375* Negative test : Change type of argument from int --> double : This is an invalid conversion1376* @throws Throwable1377*/1378@Test(expectedExceptions = WrongMethodTypeException.class, groups = { "level.extended" })1379public void test_isVarargsCollector_Using_asVarargsCollector_asTyped_arg_int_to_double() throws Throwable {1380MethodHandle mh = MethodHandles.lookup().findStatic(PackageExamples.class,"addPublicStaticVariableArity",MethodType.methodType(int.class, int[].class));13811382Assert.assertTrue(mh.isVarargsCollector());13831384mh = mh.asType(MethodType.methodType(int.class,double.class));1385Assert.fail("The test case failed to throw an WrongMethodTypeException in the case of the invalid type conversion from int to double");1386}13871388/**1389* Tests bindTo by binding non-null and null objects to a MethodHandle1390* @throws Throwable1391*/1392@Test(expectedExceptions = NullPointerException.class, groups = { "level.extended" })1393public void testBindTo() throws Throwable {1394MethodHandle handle = SamePackageExample.getLookup().findSpecial(SamePackageExample.class, "isReceiverNull", MethodType.methodType(boolean.class), SamePackageExample.class);13951396Assert.assertFalse((boolean)handle.bindTo(new SamePackageExample()).invokeExact());13971398boolean b = (boolean)(handle.bindTo(null).invokeExact());1399Assert.fail("The test case failed to throw an NullPointerException in the case of null objects");1400}14011402/**1403* Negative test for invoke on String as argument1404* @throws Throwable1405*/1406@Test(expectedExceptions = NumberFormatException.class, groups = { "level.extended" })1407public void test_Invoke_String() throws Throwable {1408MethodHandle handle = MethodHandles.lookup().findStatic(Integer.class, "parseInt", MethodType.methodType(int.class,String.class));14091410handle.invoke("s");1411Assert.fail("The test case failed to throw an NumberFormatException");1412}14131414/**1415* Negative test for invoke on Integer as argument1416* @throws Throwable1417*/1418@Test(expectedExceptions = WrongMethodTypeException.class, groups = { "level.extended" })1419public void test_Invoke_Int() throws Throwable {1420MethodHandle handle = MethodHandles.lookup().findStatic(Integer.class, "parseInt", MethodType.methodType(int.class,String.class));14211422handle.invoke(5);1423Assert.fail("The test case failed to throw an WrongMethodTypeException");1424}14251426/**1427* Negative test for invokeExcat on an array of characters as argument1428* @throws Throwable1429*/1430@Test(expectedExceptions = WrongMethodTypeException.class, groups = { "level.extended" })1431public void test_InvokeExact_InvalidArgument1() throws Throwable {1432MethodHandle mh = MethodHandles.lookup().findVirtual(SamePackageExample.class,"arrayToString",MethodType.methodType(String.class,Object[].class));1433SamePackageExample g = new SamePackageExample();1434mh = mh.bindTo(g);14351436String str = (String)mh.invokeExact("a","b");1437Assert.fail("The test case failed to throw an WrongMethodTypeException");1438}14391440/**1441* Negative test for invokeExcat on a combination of String array and Integer as argument1442* @throws Throwable1443*/1444@Test(expectedExceptions = WrongMethodTypeException.class, groups = { "level.extended" })1445public void test_InvokeExact_InvalidArgument2() throws Throwable {1446MethodHandle mh = MethodHandles.lookup().findVirtual(SamePackageExample.class,"arrayToString",MethodType.methodType(String.class,Object[].class));1447SamePackageExample g = new SamePackageExample();1448mh = mh.bindTo(g);14491450ArrayList<String> a = new ArrayList<String>();1451MethodHandle m = MethodHandles.lookup().findVirtual(ArrayList.class, "add", MethodType.methodType(boolean.class,Object.class));14521453Object r = (Object)m.invokeExact(a,1);1454Assert.fail("The test case failed to throw an WrongMethodTypeException");1455}14561457public static int countArgs(int... args) {1458return args.length;1459}14601461@Test(groups = { "level.extended" })1462public void test_invokeWithArguments_variable_input() throws Throwable {1463MethodHandle MH = MethodHandles.lookup().findStatic( MethodHandleTest.class, "countArgs", MethodType.methodType( int.class, int[].class) );1464ArrayList args = new ArrayList();1465for ( int i = 0; i < 25; i++ ){1466args.add( i );1467Assert.assertEquals(MH.invokeWithArguments(args.toArray()), i+1);1468}1469}14701471private static MethodType helperMethodType_void_252int = MethodType.methodType(void.class,1472int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1473int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1474int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1475int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1476int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1477int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1478int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1479int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1480int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1481int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1482int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1483int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1484int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1485int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1486int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1487int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1488int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1489int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1490int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1491int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1492int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1493int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1494int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1495int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1496int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1497int.class, int.class);1498private static MethodType helperMethodType_void_253int = MethodType.methodType(void.class,1499int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1500int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1501int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1502int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1503int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1504int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1505int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1506int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1507int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1508int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1509int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1510int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1511int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1512int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1513int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1514int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1515int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1516int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1517int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1518int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1519int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1520int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1521int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1522int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1523int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1524int.class, int.class, int.class);1525private static MethodType helperMethodType_void_254int = MethodType.methodType(void.class,1526int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1527int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1528int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1529int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1530int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1531int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1532int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1533int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1534int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1535int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1536int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1537int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1538int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1539int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1540int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1541int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1542int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1543int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1544int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1545int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1546int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1547int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1548int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1549int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1550int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1551int.class, int.class, int.class, int.class);1552private static MethodType helperMethodType_void_255int = MethodType.methodType(void.class,1553int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1554int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1555int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1556int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1557int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1558int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1559int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1560int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1561int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1562int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1563int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1564int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1565int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1566int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1567int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1568int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1569int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1570int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1571int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1572int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1573int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1574int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1575int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1576int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1577int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class,1578int.class, int.class, int.class, int.class ,int.class);15791580private void helperSpreaderMethod_252arg(1581int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9, int i10,1582int i11, int i12, int i13, int i14, int i15, int i16, int i17, int i18, int i19, int i20,1583int i21, int i22, int i23, int i24, int i25, int i26, int i27, int i28, int i29, int i30,1584int i31, int i32, int i33, int i34, int i35, int i36, int i37, int i38, int i39, int i40,1585int i41, int i42, int i43, int i44, int i45, int i46, int i47, int i48, int i49, int i50,1586int i51, int i52, int i53, int i54, int i55, int i56, int i57, int i58, int i59, int i60,1587int i61, int i62, int i63, int i64, int i65, int i66, int i67, int i68, int i69, int i70,1588int i71, int i72, int i73, int i74, int i75, int i76, int i77, int i78, int i79, int i80,1589int i81, int i82, int i83, int i84, int i85, int i86, int i87, int i88, int i89, int i90,1590int i91, int i92, int i93, int i94, int i95, int i96, int i97, int i98, int i99, int i100,1591int i101, int i102, int i103, int i104, int i105, int i106, int i107, int i108, int i109, int i110,1592int i111, int i112, int i113, int i114, int i115, int i116, int i117, int i118, int i119, int i120,1593int i121, int i122, int i123, int i124, int i125, int i126, int i127, int i128, int i129, int i130,1594int i131, int i132, int i133, int i134, int i135, int i136, int i137, int i138, int i139, int i140,1595int i141, int i142, int i143, int i144, int i145, int i146, int i147, int i148, int i149, int i150,1596int i151, int i152, int i153, int i154, int i155, int i156, int i157, int i158, int i159, int i160,1597int i161, int i162, int i163, int i164, int i165, int i166, int i167, int i168, int i169, int i170,1598int i171, int i172, int i173, int i174, int i175, int i176, int i177, int i178, int i179, int i180,1599int i181, int i182, int i183, int i184, int i185, int i186, int i187, int i188, int i189, int i190,1600int i191, int i192, int i193, int i194, int i195, int i196, int i197, int i198, int i199, int i200,1601int i201, int i202, int i203, int i204, int i205, int i206, int i207, int i208, int i209, int i210,1602int i211, int i212, int i213, int i214, int i215, int i216, int i217, int i218, int i219, int i220,1603int i221, int i222, int i223, int i224, int i225, int i226, int i227, int i228, int i229, int i230,1604int i231, int i232, int i233, int i234, int i235, int i236, int i237, int i238, int i239, int i240,1605int i241, int i242, int i243, int i244, int i245, int i246, int i247, int i248, int i249, int i250,1606int i251, int i252) {}1607private void helperSpreaderMethod_253arg(1608int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9, int i10,1609int i11, int i12, int i13, int i14, int i15, int i16, int i17, int i18, int i19, int i20,1610int i21, int i22, int i23, int i24, int i25, int i26, int i27, int i28, int i29, int i30,1611int i31, int i32, int i33, int i34, int i35, int i36, int i37, int i38, int i39, int i40,1612int i41, int i42, int i43, int i44, int i45, int i46, int i47, int i48, int i49, int i50,1613int i51, int i52, int i53, int i54, int i55, int i56, int i57, int i58, int i59, int i60,1614int i61, int i62, int i63, int i64, int i65, int i66, int i67, int i68, int i69, int i70,1615int i71, int i72, int i73, int i74, int i75, int i76, int i77, int i78, int i79, int i80,1616int i81, int i82, int i83, int i84, int i85, int i86, int i87, int i88, int i89, int i90,1617int i91, int i92, int i93, int i94, int i95, int i96, int i97, int i98, int i99, int i100,1618int i101, int i102, int i103, int i104, int i105, int i106, int i107, int i108, int i109, int i110,1619int i111, int i112, int i113, int i114, int i115, int i116, int i117, int i118, int i119, int i120,1620int i121, int i122, int i123, int i124, int i125, int i126, int i127, int i128, int i129, int i130,1621int i131, int i132, int i133, int i134, int i135, int i136, int i137, int i138, int i139, int i140,1622int i141, int i142, int i143, int i144, int i145, int i146, int i147, int i148, int i149, int i150,1623int i151, int i152, int i153, int i154, int i155, int i156, int i157, int i158, int i159, int i160,1624int i161, int i162, int i163, int i164, int i165, int i166, int i167, int i168, int i169, int i170,1625int i171, int i172, int i173, int i174, int i175, int i176, int i177, int i178, int i179, int i180,1626int i181, int i182, int i183, int i184, int i185, int i186, int i187, int i188, int i189, int i190,1627int i191, int i192, int i193, int i194, int i195, int i196, int i197, int i198, int i199, int i200,1628int i201, int i202, int i203, int i204, int i205, int i206, int i207, int i208, int i209, int i210,1629int i211, int i212, int i213, int i214, int i215, int i216, int i217, int i218, int i219, int i220,1630int i221, int i222, int i223, int i224, int i225, int i226, int i227, int i228, int i229, int i230,1631int i231, int i232, int i233, int i234, int i235, int i236, int i237, int i238, int i239, int i240,1632int i241, int i242, int i243, int i244, int i245, int i246, int i247, int i248, int i249, int i250,1633int i251, int i252, int i253) {}1634private void helperSpreaderMethod_254arg(1635int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9, int i10,1636int i11, int i12, int i13, int i14, int i15, int i16, int i17, int i18, int i19, int i20,1637int i21, int i22, int i23, int i24, int i25, int i26, int i27, int i28, int i29, int i30,1638int i31, int i32, int i33, int i34, int i35, int i36, int i37, int i38, int i39, int i40,1639int i41, int i42, int i43, int i44, int i45, int i46, int i47, int i48, int i49, int i50,1640int i51, int i52, int i53, int i54, int i55, int i56, int i57, int i58, int i59, int i60,1641int i61, int i62, int i63, int i64, int i65, int i66, int i67, int i68, int i69, int i70,1642int i71, int i72, int i73, int i74, int i75, int i76, int i77, int i78, int i79, int i80,1643int i81, int i82, int i83, int i84, int i85, int i86, int i87, int i88, int i89, int i90,1644int i91, int i92, int i93, int i94, int i95, int i96, int i97, int i98, int i99, int i100,1645int i101, int i102, int i103, int i104, int i105, int i106, int i107, int i108, int i109, int i110,1646int i111, int i112, int i113, int i114, int i115, int i116, int i117, int i118, int i119, int i120,1647int i121, int i122, int i123, int i124, int i125, int i126, int i127, int i128, int i129, int i130,1648int i131, int i132, int i133, int i134, int i135, int i136, int i137, int i138, int i139, int i140,1649int i141, int i142, int i143, int i144, int i145, int i146, int i147, int i148, int i149, int i150,1650int i151, int i152, int i153, int i154, int i155, int i156, int i157, int i158, int i159, int i160,1651int i161, int i162, int i163, int i164, int i165, int i166, int i167, int i168, int i169, int i170,1652int i171, int i172, int i173, int i174, int i175, int i176, int i177, int i178, int i179, int i180,1653int i181, int i182, int i183, int i184, int i185, int i186, int i187, int i188, int i189, int i190,1654int i191, int i192, int i193, int i194, int i195, int i196, int i197, int i198, int i199, int i200,1655int i201, int i202, int i203, int i204, int i205, int i206, int i207, int i208, int i209, int i210,1656int i211, int i212, int i213, int i214, int i215, int i216, int i217, int i218, int i219, int i220,1657int i221, int i222, int i223, int i224, int i225, int i226, int i227, int i228, int i229, int i230,1658int i231, int i232, int i233, int i234, int i235, int i236, int i237, int i238, int i239, int i240,1659int i241, int i242, int i243, int i244, int i245, int i246, int i247, int i248, int i249, int i250,1660int i251, int i252, int i253, int i254) {}16611662private static void helperSpreaderStaticMethod_253arg(1663int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9, int i10,1664int i11, int i12, int i13, int i14, int i15, int i16, int i17, int i18, int i19, int i20,1665int i21, int i22, int i23, int i24, int i25, int i26, int i27, int i28, int i29, int i30,1666int i31, int i32, int i33, int i34, int i35, int i36, int i37, int i38, int i39, int i40,1667int i41, int i42, int i43, int i44, int i45, int i46, int i47, int i48, int i49, int i50,1668int i51, int i52, int i53, int i54, int i55, int i56, int i57, int i58, int i59, int i60,1669int i61, int i62, int i63, int i64, int i65, int i66, int i67, int i68, int i69, int i70,1670int i71, int i72, int i73, int i74, int i75, int i76, int i77, int i78, int i79, int i80,1671int i81, int i82, int i83, int i84, int i85, int i86, int i87, int i88, int i89, int i90,1672int i91, int i92, int i93, int i94, int i95, int i96, int i97, int i98, int i99, int i100,1673int i101, int i102, int i103, int i104, int i105, int i106, int i107, int i108, int i109, int i110,1674int i111, int i112, int i113, int i114, int i115, int i116, int i117, int i118, int i119, int i120,1675int i121, int i122, int i123, int i124, int i125, int i126, int i127, int i128, int i129, int i130,1676int i131, int i132, int i133, int i134, int i135, int i136, int i137, int i138, int i139, int i140,1677int i141, int i142, int i143, int i144, int i145, int i146, int i147, int i148, int i149, int i150,1678int i151, int i152, int i153, int i154, int i155, int i156, int i157, int i158, int i159, int i160,1679int i161, int i162, int i163, int i164, int i165, int i166, int i167, int i168, int i169, int i170,1680int i171, int i172, int i173, int i174, int i175, int i176, int i177, int i178, int i179, int i180,1681int i181, int i182, int i183, int i184, int i185, int i186, int i187, int i188, int i189, int i190,1682int i191, int i192, int i193, int i194, int i195, int i196, int i197, int i198, int i199, int i200,1683int i201, int i202, int i203, int i204, int i205, int i206, int i207, int i208, int i209, int i210,1684int i211, int i212, int i213, int i214, int i215, int i216, int i217, int i218, int i219, int i220,1685int i221, int i222, int i223, int i224, int i225, int i226, int i227, int i228, int i229, int i230,1686int i231, int i232, int i233, int i234, int i235, int i236, int i237, int i238, int i239, int i240,1687int i241, int i242, int i243, int i244, int i245, int i246, int i247, int i248, int i249, int i250,1688int i251, int i252, int i253) {}1689private static void helperSpreaderStaticMethod_254arg(1690int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9, int i10,1691int i11, int i12, int i13, int i14, int i15, int i16, int i17, int i18, int i19, int i20,1692int i21, int i22, int i23, int i24, int i25, int i26, int i27, int i28, int i29, int i30,1693int i31, int i32, int i33, int i34, int i35, int i36, int i37, int i38, int i39, int i40,1694int i41, int i42, int i43, int i44, int i45, int i46, int i47, int i48, int i49, int i50,1695int i51, int i52, int i53, int i54, int i55, int i56, int i57, int i58, int i59, int i60,1696int i61, int i62, int i63, int i64, int i65, int i66, int i67, int i68, int i69, int i70,1697int i71, int i72, int i73, int i74, int i75, int i76, int i77, int i78, int i79, int i80,1698int i81, int i82, int i83, int i84, int i85, int i86, int i87, int i88, int i89, int i90,1699int i91, int i92, int i93, int i94, int i95, int i96, int i97, int i98, int i99, int i100,1700int i101, int i102, int i103, int i104, int i105, int i106, int i107, int i108, int i109, int i110,1701int i111, int i112, int i113, int i114, int i115, int i116, int i117, int i118, int i119, int i120,1702int i121, int i122, int i123, int i124, int i125, int i126, int i127, int i128, int i129, int i130,1703int i131, int i132, int i133, int i134, int i135, int i136, int i137, int i138, int i139, int i140,1704int i141, int i142, int i143, int i144, int i145, int i146, int i147, int i148, int i149, int i150,1705int i151, int i152, int i153, int i154, int i155, int i156, int i157, int i158, int i159, int i160,1706int i161, int i162, int i163, int i164, int i165, int i166, int i167, int i168, int i169, int i170,1707int i171, int i172, int i173, int i174, int i175, int i176, int i177, int i178, int i179, int i180,1708int i181, int i182, int i183, int i184, int i185, int i186, int i187, int i188, int i189, int i190,1709int i191, int i192, int i193, int i194, int i195, int i196, int i197, int i198, int i199, int i200,1710int i201, int i202, int i203, int i204, int i205, int i206, int i207, int i208, int i209, int i210,1711int i211, int i212, int i213, int i214, int i215, int i216, int i217, int i218, int i219, int i220,1712int i221, int i222, int i223, int i224, int i225, int i226, int i227, int i228, int i229, int i230,1713int i231, int i232, int i233, int i234, int i235, int i236, int i237, int i238, int i239, int i240,1714int i241, int i242, int i243, int i244, int i245, int i246, int i247, int i248, int i249, int i250,1715int i251, int i252, int i253, int i254) {}1716private static void helperSpreaderStaticMethod_255arg(1717int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9, int i10,1718int i11, int i12, int i13, int i14, int i15, int i16, int i17, int i18, int i19, int i20,1719int i21, int i22, int i23, int i24, int i25, int i26, int i27, int i28, int i29, int i30,1720int i31, int i32, int i33, int i34, int i35, int i36, int i37, int i38, int i39, int i40,1721int i41, int i42, int i43, int i44, int i45, int i46, int i47, int i48, int i49, int i50,1722int i51, int i52, int i53, int i54, int i55, int i56, int i57, int i58, int i59, int i60,1723int i61, int i62, int i63, int i64, int i65, int i66, int i67, int i68, int i69, int i70,1724int i71, int i72, int i73, int i74, int i75, int i76, int i77, int i78, int i79, int i80,1725int i81, int i82, int i83, int i84, int i85, int i86, int i87, int i88, int i89, int i90,1726int i91, int i92, int i93, int i94, int i95, int i96, int i97, int i98, int i99, int i100,1727int i101, int i102, int i103, int i104, int i105, int i106, int i107, int i108, int i109, int i110,1728int i111, int i112, int i113, int i114, int i115, int i116, int i117, int i118, int i119, int i120,1729int i121, int i122, int i123, int i124, int i125, int i126, int i127, int i128, int i129, int i130,1730int i131, int i132, int i133, int i134, int i135, int i136, int i137, int i138, int i139, int i140,1731int i141, int i142, int i143, int i144, int i145, int i146, int i147, int i148, int i149, int i150,1732int i151, int i152, int i153, int i154, int i155, int i156, int i157, int i158, int i159, int i160,1733int i161, int i162, int i163, int i164, int i165, int i166, int i167, int i168, int i169, int i170,1734int i171, int i172, int i173, int i174, int i175, int i176, int i177, int i178, int i179, int i180,1735int i181, int i182, int i183, int i184, int i185, int i186, int i187, int i188, int i189, int i190,1736int i191, int i192, int i193, int i194, int i195, int i196, int i197, int i198, int i199, int i200,1737int i201, int i202, int i203, int i204, int i205, int i206, int i207, int i208, int i209, int i210,1738int i211, int i212, int i213, int i214, int i215, int i216, int i217, int i218, int i219, int i220,1739int i221, int i222, int i223, int i224, int i225, int i226, int i227, int i228, int i229, int i230,1740int i231, int i232, int i233, int i234, int i235, int i236, int i237, int i238, int i239, int i240,1741int i241, int i242, int i243, int i244, int i245, int i246, int i247, int i248, int i249, int i250,1742int i251, int i252, int i253, int i254, int i255) {}1743private void helperCollectorMethod(int[] i) {}1744private static void helperStaticCollectorMethod(int[] i) {}1745private void helperVarArgsMethod(String s, int... i) {}1746}17471748class HelperConstructorClass {1749public HelperConstructorClass(1750int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9, int i10,1751int i11, int i12, int i13, int i14, int i15, int i16, int i17, int i18, int i19, int i20,1752int i21, int i22, int i23, int i24, int i25, int i26, int i27, int i28, int i29, int i30,1753int i31, int i32, int i33, int i34, int i35, int i36, int i37, int i38, int i39, int i40,1754int i41, int i42, int i43, int i44, int i45, int i46, int i47, int i48, int i49, int i50,1755int i51, int i52, int i53, int i54, int i55, int i56, int i57, int i58, int i59, int i60,1756int i61, int i62, int i63, int i64, int i65, int i66, int i67, int i68, int i69, int i70,1757int i71, int i72, int i73, int i74, int i75, int i76, int i77, int i78, int i79, int i80,1758int i81, int i82, int i83, int i84, int i85, int i86, int i87, int i88, int i89, int i90,1759int i91, int i92, int i93, int i94, int i95, int i96, int i97, int i98, int i99, int i100,1760int i101, int i102, int i103, int i104, int i105, int i106, int i107, int i108, int i109, int i110,1761int i111, int i112, int i113, int i114, int i115, int i116, int i117, int i118, int i119, int i120,1762int i121, int i122, int i123, int i124, int i125, int i126, int i127, int i128, int i129, int i130,1763int i131, int i132, int i133, int i134, int i135, int i136, int i137, int i138, int i139, int i140,1764int i141, int i142, int i143, int i144, int i145, int i146, int i147, int i148, int i149, int i150,1765int i151, int i152, int i153, int i154, int i155, int i156, int i157, int i158, int i159, int i160,1766int i161, int i162, int i163, int i164, int i165, int i166, int i167, int i168, int i169, int i170,1767int i171, int i172, int i173, int i174, int i175, int i176, int i177, int i178, int i179, int i180,1768int i181, int i182, int i183, int i184, int i185, int i186, int i187, int i188, int i189, int i190,1769int i191, int i192, int i193, int i194, int i195, int i196, int i197, int i198, int i199, int i200,1770int i201, int i202, int i203, int i204, int i205, int i206, int i207, int i208, int i209, int i210,1771int i211, int i212, int i213, int i214, int i215, int i216, int i217, int i218, int i219, int i220,1772int i221, int i222, int i223, int i224, int i225, int i226, int i227, int i228, int i229, int i230,1773int i231, int i232, int i233, int i234, int i235, int i236, int i237, int i238, int i239, int i240,1774int i241, int i242, int i243, int i244, int i245, int i246, int i247, int i248, int i249, int i250,1775int i251, int i252, int i253) {}17761777public HelperConstructorClass(1778int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9, int i10,1779int i11, int i12, int i13, int i14, int i15, int i16, int i17, int i18, int i19, int i20,1780int i21, int i22, int i23, int i24, int i25, int i26, int i27, int i28, int i29, int i30,1781int i31, int i32, int i33, int i34, int i35, int i36, int i37, int i38, int i39, int i40,1782int i41, int i42, int i43, int i44, int i45, int i46, int i47, int i48, int i49, int i50,1783int i51, int i52, int i53, int i54, int i55, int i56, int i57, int i58, int i59, int i60,1784int i61, int i62, int i63, int i64, int i65, int i66, int i67, int i68, int i69, int i70,1785int i71, int i72, int i73, int i74, int i75, int i76, int i77, int i78, int i79, int i80,1786int i81, int i82, int i83, int i84, int i85, int i86, int i87, int i88, int i89, int i90,1787int i91, int i92, int i93, int i94, int i95, int i96, int i97, int i98, int i99, int i100,1788int i101, int i102, int i103, int i104, int i105, int i106, int i107, int i108, int i109, int i110,1789int i111, int i112, int i113, int i114, int i115, int i116, int i117, int i118, int i119, int i120,1790int i121, int i122, int i123, int i124, int i125, int i126, int i127, int i128, int i129, int i130,1791int i131, int i132, int i133, int i134, int i135, int i136, int i137, int i138, int i139, int i140,1792int i141, int i142, int i143, int i144, int i145, int i146, int i147, int i148, int i149, int i150,1793int i151, int i152, int i153, int i154, int i155, int i156, int i157, int i158, int i159, int i160,1794int i161, int i162, int i163, int i164, int i165, int i166, int i167, int i168, int i169, int i170,1795int i171, int i172, int i173, int i174, int i175, int i176, int i177, int i178, int i179, int i180,1796int i181, int i182, int i183, int i184, int i185, int i186, int i187, int i188, int i189, int i190,1797int i191, int i192, int i193, int i194, int i195, int i196, int i197, int i198, int i199, int i200,1798int i201, int i202, int i203, int i204, int i205, int i206, int i207, int i208, int i209, int i210,1799int i211, int i212, int i213, int i214, int i215, int i216, int i217, int i218, int i219, int i220,1800int i221, int i222, int i223, int i224, int i225, int i226, int i227, int i228, int i229, int i230,1801int i231, int i232, int i233, int i234, int i235, int i236, int i237, int i238, int i239, int i240,1802int i241, int i242, int i243, int i244, int i245, int i246, int i247, int i248, int i249, int i250,1803int i251, int i252, int i253, int i254) {}1804}180518061807