Java Code Examples for java.lang.invoke.MethodType#genericMethodType()
The following examples show how to use
java.lang.invoke.MethodType#genericMethodType() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FinalScriptFunctionData.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Override MethodType getGenericType() { // We need to ask the code for its generic type. We can't just rely on this function data's arity, as it's not // actually correct for lots of built-ins. E.g. ECMAScript 5.1 section 15.5.3.2 prescribes that // Script.fromCharCode([char0[, char1[, ...]]]) has a declared arity of 1 even though it's a variable arity // method. int max = 0; for(final CompiledFunction fn: code) { final MethodType t = fn.type(); if(ScriptFunctionData.isVarArg(t)) { // 2 for (callee, this, args[]) return MethodType.genericMethodType(2, true); } final int paramCount = t.parameterCount() - (ScriptFunctionData.needsCallee(t) ? 1 : 0); if(paramCount > max) { max = paramCount; } } // +1 for callee return MethodType.genericMethodType(max + 1); }
Example 2
Source File: DefaultStaticInvokeTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private MethodHandle getTestMH(Class clazz, String methodName, Object param, boolean isNegativeTest) throws Exception { MethodType mType = (param != null) ? MethodType.genericMethodType(1) : MethodType.methodType(String.class); MethodHandles.Lookup lookup = MethodHandles.lookup(); if (!isNegativeTest) { return methodName.equals("staticMethod") ? lookup.findStatic(clazz, methodName, mType) : lookup.findVirtual(clazz, methodName, mType); } else { return methodName.equals("staticMethod") ? lookup.findVirtual(clazz, methodName, mType) : lookup.findStatic(clazz, methodName, mType); } }
Example 3
Source File: FinalScriptFunctionData.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
@Override MethodType getGenericType() { // We need to ask the code for its generic type. We can't just rely on this function data's arity, as it's not // actually correct for lots of built-ins. E.g. ECMAScript 5.1 section 15.5.3.2 prescribes that // Script.fromCharCode([char0[, char1[, ...]]]) has a declared arity of 1 even though it's a variable arity // method. int max = 0; for(final CompiledFunction fn: code) { final MethodType t = fn.type(); if(ScriptFunctionData.isVarArg(t)) { // 2 for (callee, this, args[]) return MethodType.genericMethodType(2, true); } final int paramCount = t.parameterCount() - (ScriptFunctionData.needsCallee(t) ? 1 : 0); if(paramCount > max) { max = paramCount; } } // +1 for callee return MethodType.genericMethodType(max + 1); }
Example 4
Source File: RecompilableScriptFunctionData.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@Override MethodType getGenericType() { // 2 is for (callee, this) if (isVariableArity()) { return MethodType.genericMethodType(2, true); } return MethodType.genericMethodType(2 + getArity()); }
Example 5
Source File: BigArityTest.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@Test public void test254() throws Throwable { final int ARITY = 254; System.out.println("test"+ARITY); Object[] a = testArgs(ARITY); Object r0 = hashArguments(a); Object r; r = hashArguments_254( // <editor-fold defaultstate="collapsed" desc="a[0x00], a[0x01], a[0x02], a[0x03], a[0x04], ..."> a[0x00], a[0x01], a[0x02], a[0x03], a[0x04], a[0x05], a[0x06], a[0x07], a[0x08], a[0x09], a[0x0A], a[0x0B], a[0x0C], a[0x0D], a[0x0E], a[0x0F], a[0x10], a[0x11], a[0x12], a[0x13], a[0x14], a[0x15], a[0x16], a[0x17], a[0x18], a[0x19], a[0x1A], a[0x1B], a[0x1C], a[0x1D], a[0x1E], a[0x1F], a[0x20], a[0x21], a[0x22], a[0x23], a[0x24], a[0x25], a[0x26], a[0x27], a[0x28], a[0x29], a[0x2A], a[0x2B], a[0x2C], a[0x2D], a[0x2E], a[0x2F], a[0x30], a[0x31], a[0x32], a[0x33], a[0x34], a[0x35], a[0x36], a[0x37], a[0x38], a[0x39], a[0x3A], a[0x3B], a[0x3C], a[0x3D], a[0x3E], a[0x3F], a[0x40], a[0x41], a[0x42], a[0x43], a[0x44], a[0x45], a[0x46], a[0x47], a[0x48], a[0x49], a[0x4A], a[0x4B], a[0x4C], a[0x4D], a[0x4E], a[0x4F], a[0x50], a[0x51], a[0x52], a[0x53], a[0x54], a[0x55], a[0x56], a[0x57], a[0x58], a[0x59], a[0x5A], a[0x5B], a[0x5C], a[0x5D], a[0x5E], a[0x5F], a[0x60], a[0x61], a[0x62], a[0x63], a[0x64], a[0x65], a[0x66], a[0x67], a[0x68], a[0x69], a[0x6A], a[0x6B], a[0x6C], a[0x6D], a[0x6E], a[0x6F], a[0x70], a[0x71], a[0x72], a[0x73], a[0x74], a[0x75], a[0x76], a[0x77], a[0x78], a[0x79], a[0x7A], a[0x7B], a[0x7C], a[0x7D], a[0x7E], a[0x7F], a[0x80], a[0x81], a[0x82], a[0x83], a[0x84], a[0x85], a[0x86], a[0x87], a[0x88], a[0x89], a[0x8A], a[0x8B], a[0x8C], a[0x8D], a[0x8E], a[0x8F], a[0x90], a[0x91], a[0x92], a[0x93], a[0x94], a[0x95], a[0x96], a[0x97], a[0x98], a[0x99], a[0x9A], a[0x9B], a[0x9C], a[0x9D], a[0x9E], a[0x9F], a[0xA0], a[0xA1], a[0xA2], a[0xA3], a[0xA4], a[0xA5], a[0xA6], a[0xA7], a[0xA8], a[0xA9], a[0xAA], a[0xAB], a[0xAC], a[0xAD], a[0xAE], a[0xAF], a[0xB0], a[0xB1], a[0xB2], a[0xB3], a[0xB4], a[0xB5], a[0xB6], a[0xB7], a[0xB8], a[0xB9], a[0xBA], a[0xBB], a[0xBC], a[0xBD], a[0xBE], a[0xBF], a[0xC0], a[0xC1], a[0xC2], a[0xC3], a[0xC4], a[0xC5], a[0xC6], a[0xC7], a[0xC8], a[0xC9], a[0xCA], a[0xCB], a[0xCC], a[0xCD], a[0xCE], a[0xCF], a[0xD0], a[0xD1], a[0xD2], a[0xD3], a[0xD4], a[0xD5], a[0xD6], a[0xD7], a[0xD8], a[0xD9], a[0xDA], a[0xDB], a[0xDC], a[0xDD], a[0xDE], a[0xDF], a[0xE0], a[0xE1], a[0xE2], a[0xE3], a[0xE4], a[0xE5], a[0xE6], a[0xE7], a[0xE8], a[0xE9], a[0xEA], a[0xEB], a[0xEC], a[0xED], a[0xEE], a[0xEF], a[0xF0], a[0xF1], a[0xF2], a[0xF3], a[0xF4], a[0xF5], a[0xF6], a[0xF7], // </editor-fold> a[0xF8], a[0xF9], a[0xFA], a[0xFB], a[0xFC], a[0xFD]); // hashArguments_254 assertEquals(r0, r); MethodType mt = MethodType.genericMethodType(ARITY); MethodHandle mh = MethodHandles.lookup().findStatic(BigArityTest.class, "hashArguments_"+ARITY, mt); test254(mh, a, r0); MethodHandle mh_CA = MH_hashArguments_VA.asFixedArity().asCollector(Object[].class, ARITY); test254(mh_CA, a, r0); }
Example 6
Source File: BigArityTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Test public void test253() throws Throwable { final int ARITY = 253; System.out.println("test"+ARITY); Object[] a = testArgs(ARITY); Object r0 = hashArguments(a); Object r; r = hashArguments_253( // <editor-fold defaultstate="collapsed" desc="a[0x00], a[0x01], a[0x02], a[0x03], a[0x04], ..."> a[0x00], a[0x01], a[0x02], a[0x03], a[0x04], a[0x05], a[0x06], a[0x07], a[0x08], a[0x09], a[0x0A], a[0x0B], a[0x0C], a[0x0D], a[0x0E], a[0x0F], a[0x10], a[0x11], a[0x12], a[0x13], a[0x14], a[0x15], a[0x16], a[0x17], a[0x18], a[0x19], a[0x1A], a[0x1B], a[0x1C], a[0x1D], a[0x1E], a[0x1F], a[0x20], a[0x21], a[0x22], a[0x23], a[0x24], a[0x25], a[0x26], a[0x27], a[0x28], a[0x29], a[0x2A], a[0x2B], a[0x2C], a[0x2D], a[0x2E], a[0x2F], a[0x30], a[0x31], a[0x32], a[0x33], a[0x34], a[0x35], a[0x36], a[0x37], a[0x38], a[0x39], a[0x3A], a[0x3B], a[0x3C], a[0x3D], a[0x3E], a[0x3F], a[0x40], a[0x41], a[0x42], a[0x43], a[0x44], a[0x45], a[0x46], a[0x47], a[0x48], a[0x49], a[0x4A], a[0x4B], a[0x4C], a[0x4D], a[0x4E], a[0x4F], a[0x50], a[0x51], a[0x52], a[0x53], a[0x54], a[0x55], a[0x56], a[0x57], a[0x58], a[0x59], a[0x5A], a[0x5B], a[0x5C], a[0x5D], a[0x5E], a[0x5F], a[0x60], a[0x61], a[0x62], a[0x63], a[0x64], a[0x65], a[0x66], a[0x67], a[0x68], a[0x69], a[0x6A], a[0x6B], a[0x6C], a[0x6D], a[0x6E], a[0x6F], a[0x70], a[0x71], a[0x72], a[0x73], a[0x74], a[0x75], a[0x76], a[0x77], a[0x78], a[0x79], a[0x7A], a[0x7B], a[0x7C], a[0x7D], a[0x7E], a[0x7F], a[0x80], a[0x81], a[0x82], a[0x83], a[0x84], a[0x85], a[0x86], a[0x87], a[0x88], a[0x89], a[0x8A], a[0x8B], a[0x8C], a[0x8D], a[0x8E], a[0x8F], a[0x90], a[0x91], a[0x92], a[0x93], a[0x94], a[0x95], a[0x96], a[0x97], a[0x98], a[0x99], a[0x9A], a[0x9B], a[0x9C], a[0x9D], a[0x9E], a[0x9F], a[0xA0], a[0xA1], a[0xA2], a[0xA3], a[0xA4], a[0xA5], a[0xA6], a[0xA7], a[0xA8], a[0xA9], a[0xAA], a[0xAB], a[0xAC], a[0xAD], a[0xAE], a[0xAF], a[0xB0], a[0xB1], a[0xB2], a[0xB3], a[0xB4], a[0xB5], a[0xB6], a[0xB7], a[0xB8], a[0xB9], a[0xBA], a[0xBB], a[0xBC], a[0xBD], a[0xBE], a[0xBF], a[0xC0], a[0xC1], a[0xC2], a[0xC3], a[0xC4], a[0xC5], a[0xC6], a[0xC7], a[0xC8], a[0xC9], a[0xCA], a[0xCB], a[0xCC], a[0xCD], a[0xCE], a[0xCF], a[0xD0], a[0xD1], a[0xD2], a[0xD3], a[0xD4], a[0xD5], a[0xD6], a[0xD7], a[0xD8], a[0xD9], a[0xDA], a[0xDB], a[0xDC], a[0xDD], a[0xDE], a[0xDF], a[0xE0], a[0xE1], a[0xE2], a[0xE3], a[0xE4], a[0xE5], a[0xE6], a[0xE7], a[0xE8], a[0xE9], a[0xEA], a[0xEB], a[0xEC], a[0xED], a[0xEE], a[0xEF], a[0xF0], a[0xF1], a[0xF2], a[0xF3], a[0xF4], a[0xF5], a[0xF6], a[0xF7], // </editor-fold> a[0xF8], a[0xF9], a[0xFA], a[0xFB], a[0xFC]); // hashArguments_253 assertEquals(r0, r); MethodType mt = MethodType.genericMethodType(ARITY); MethodHandle mh = MethodHandles.lookup().findStatic(BigArityTest.class, "hashArguments_"+ARITY, mt); test253(mh, a, r0); MethodHandle mh_CA = MH_hashArguments_VA.asFixedArity().asCollector(Object[].class, ARITY); test253(mh_CA, a, r0); MethodHandle mh_a = MethodHandles.lookup().findStatic(BigArityTest.class, "hashArguments_"+ARITY+"_a", MT_A).asCollector(1, Object[].class, ARITY-2); test253(mh_a, a, r0); }
Example 7
Source File: BigArityTest.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@Test public void test252() throws Throwable { final int ARITY = 252; System.out.println("test"+ARITY); Object[] a = testArgs(ARITY); Object r0 = hashArguments(a); Object r; r = hashArguments_252( // <editor-fold defaultstate="collapsed" desc="a[0x00], a[0x01], a[0x02], a[0x03], a[0x04], ..."> a[0x00], a[0x01], a[0x02], a[0x03], a[0x04], a[0x05], a[0x06], a[0x07], a[0x08], a[0x09], a[0x0A], a[0x0B], a[0x0C], a[0x0D], a[0x0E], a[0x0F], a[0x10], a[0x11], a[0x12], a[0x13], a[0x14], a[0x15], a[0x16], a[0x17], a[0x18], a[0x19], a[0x1A], a[0x1B], a[0x1C], a[0x1D], a[0x1E], a[0x1F], a[0x20], a[0x21], a[0x22], a[0x23], a[0x24], a[0x25], a[0x26], a[0x27], a[0x28], a[0x29], a[0x2A], a[0x2B], a[0x2C], a[0x2D], a[0x2E], a[0x2F], a[0x30], a[0x31], a[0x32], a[0x33], a[0x34], a[0x35], a[0x36], a[0x37], a[0x38], a[0x39], a[0x3A], a[0x3B], a[0x3C], a[0x3D], a[0x3E], a[0x3F], a[0x40], a[0x41], a[0x42], a[0x43], a[0x44], a[0x45], a[0x46], a[0x47], a[0x48], a[0x49], a[0x4A], a[0x4B], a[0x4C], a[0x4D], a[0x4E], a[0x4F], a[0x50], a[0x51], a[0x52], a[0x53], a[0x54], a[0x55], a[0x56], a[0x57], a[0x58], a[0x59], a[0x5A], a[0x5B], a[0x5C], a[0x5D], a[0x5E], a[0x5F], a[0x60], a[0x61], a[0x62], a[0x63], a[0x64], a[0x65], a[0x66], a[0x67], a[0x68], a[0x69], a[0x6A], a[0x6B], a[0x6C], a[0x6D], a[0x6E], a[0x6F], a[0x70], a[0x71], a[0x72], a[0x73], a[0x74], a[0x75], a[0x76], a[0x77], a[0x78], a[0x79], a[0x7A], a[0x7B], a[0x7C], a[0x7D], a[0x7E], a[0x7F], a[0x80], a[0x81], a[0x82], a[0x83], a[0x84], a[0x85], a[0x86], a[0x87], a[0x88], a[0x89], a[0x8A], a[0x8B], a[0x8C], a[0x8D], a[0x8E], a[0x8F], a[0x90], a[0x91], a[0x92], a[0x93], a[0x94], a[0x95], a[0x96], a[0x97], a[0x98], a[0x99], a[0x9A], a[0x9B], a[0x9C], a[0x9D], a[0x9E], a[0x9F], a[0xA0], a[0xA1], a[0xA2], a[0xA3], a[0xA4], a[0xA5], a[0xA6], a[0xA7], a[0xA8], a[0xA9], a[0xAA], a[0xAB], a[0xAC], a[0xAD], a[0xAE], a[0xAF], a[0xB0], a[0xB1], a[0xB2], a[0xB3], a[0xB4], a[0xB5], a[0xB6], a[0xB7], a[0xB8], a[0xB9], a[0xBA], a[0xBB], a[0xBC], a[0xBD], a[0xBE], a[0xBF], a[0xC0], a[0xC1], a[0xC2], a[0xC3], a[0xC4], a[0xC5], a[0xC6], a[0xC7], a[0xC8], a[0xC9], a[0xCA], a[0xCB], a[0xCC], a[0xCD], a[0xCE], a[0xCF], a[0xD0], a[0xD1], a[0xD2], a[0xD3], a[0xD4], a[0xD5], a[0xD6], a[0xD7], a[0xD8], a[0xD9], a[0xDA], a[0xDB], a[0xDC], a[0xDD], a[0xDE], a[0xDF], a[0xE0], a[0xE1], a[0xE2], a[0xE3], a[0xE4], a[0xE5], a[0xE6], a[0xE7], a[0xE8], a[0xE9], a[0xEA], a[0xEB], a[0xEC], a[0xED], a[0xEE], a[0xEF], a[0xF0], a[0xF1], a[0xF2], a[0xF3], a[0xF4], a[0xF5], a[0xF6], a[0xF7], // </editor-fold> a[0xF8], a[0xF9], a[0xFA], a[0xFB]); // hashArguments_252 assertEquals(r0, r); MethodType mt = MethodType.genericMethodType(ARITY); MethodHandle mh = MethodHandles.lookup().findStatic(BigArityTest.class, "hashArguments_"+ARITY, mt); test252(mh, a, r0); MethodHandle mh_CA = MH_hashArguments_VA.asFixedArity().asCollector(Object[].class, ARITY); test252(mh_CA, a, r0); }
Example 8
Source File: MethodTypeTest.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@BeforeMethod public void setUp() throws Exception { rtype = void.class; ptypes = new Class<?>[] { int.class, String.class }; mt_viS = MethodType.methodType(void.class, int.class, String.class); mt_OO = MethodType.methodType(Object.class, Object.class); mt_OO2 = MethodType.methodType(Object.class, Object.class, Object.class); mt_vv = MethodType.methodType(void.class); mt_Vv = MethodType.methodType(Void.class); mt_Ov = MethodType.methodType(Object.class); mt_iSI = MethodType.methodType(int.class, String.class, Integer.class); mt_ISi = MethodType.methodType(Integer.class, String.class, int.class); mt_ISI = MethodType.methodType(Integer.class, String.class, Integer.class); mt_iSi = MethodType.methodType(int.class, String.class, int.class); compareTo = String.class.getDeclaredMethod("compareTo", String.class); mt_viO = MethodType.methodType(void.class, int.class, Object.class); mt_iO2 = MethodType.methodType(int.class, Object.class, Object.class); mt_OOi = MethodType.methodType(Object.class, Object.class, int.class); mt_iOi = MethodType.methodType(int.class, Object.class, int.class); mt_VIO = MethodType.methodType(Void.class, Integer.class, Object.class); mt_IO2 = MethodType.methodType(Integer.class, Object.class, Object.class); mt_OOI = MethodType.methodType(Object.class, Object.class, Integer.class); mt_IOI = MethodType.methodType(Integer.class, Object.class, Integer.class); mt_VIS = MethodType.methodType(Void.class, Integer.class, String.class); mt_vOiSzA = MethodType.methodType(void.class, Object.class, int.class, String.class, boolean.class, Object[].class); mt_OO99 = MethodType.genericMethodType(99); GALLERY = new MethodType[] { mt_viS, mt_OO, mt_OO2, mt_vv, mt_Vv, mt_Ov, mt_iSI, mt_ISi, mt_ISI, mt_iSi, mt_viO, mt_iO2, mt_OOi, mt_iOi, mt_VIO, mt_IO2, mt_OOI, mt_IOI, mt_VIS, mt_vOiSzA, mt_OO99 }; }
Example 9
Source File: MethodTypeTest.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@BeforeMethod public void setUp() throws Exception { rtype = void.class; ptypes = new Class<?>[] { int.class, String.class }; mt_viS = MethodType.methodType(void.class, int.class, String.class); mt_OO = MethodType.methodType(Object.class, Object.class); mt_OO2 = MethodType.methodType(Object.class, Object.class, Object.class); mt_vv = MethodType.methodType(void.class); mt_Vv = MethodType.methodType(Void.class); mt_Ov = MethodType.methodType(Object.class); mt_iSI = MethodType.methodType(int.class, String.class, Integer.class); mt_ISi = MethodType.methodType(Integer.class, String.class, int.class); mt_ISI = MethodType.methodType(Integer.class, String.class, Integer.class); mt_iSi = MethodType.methodType(int.class, String.class, int.class); compareTo = String.class.getDeclaredMethod("compareTo", String.class); mt_viO = MethodType.methodType(void.class, int.class, Object.class); mt_iO2 = MethodType.methodType(int.class, Object.class, Object.class); mt_OOi = MethodType.methodType(Object.class, Object.class, int.class); mt_iOi = MethodType.methodType(int.class, Object.class, int.class); mt_VIO = MethodType.methodType(Void.class, Integer.class, Object.class); mt_IO2 = MethodType.methodType(Integer.class, Object.class, Object.class); mt_OOI = MethodType.methodType(Object.class, Object.class, Integer.class); mt_IOI = MethodType.methodType(Integer.class, Object.class, Integer.class); mt_VIS = MethodType.methodType(Void.class, Integer.class, String.class); mt_vOiSzA = MethodType.methodType(void.class, Object.class, int.class, String.class, boolean.class, Object[].class); mt_OO99 = MethodType.genericMethodType(99); GALLERY = new MethodType[] { mt_viS, mt_OO, mt_OO2, mt_vv, mt_Vv, mt_Ov, mt_iSI, mt_ISi, mt_ISI, mt_iSi, mt_viO, mt_iO2, mt_OOi, mt_iOi, mt_VIO, mt_IO2, mt_OOI, mt_IOI, mt_VIS, mt_vOiSzA, mt_OO99 }; }
Example 10
Source File: MethodTypeTest.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@Test public void testMakeGeneric() { System.out.println("makeGeneric"); int objectArgCount = 2; MethodType expResult = mt_OO2; MethodType result = MethodType.genericMethodType(objectArgCount); assertSame(expResult, result); }
Example 11
Source File: BigArityTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@Test public void test252() throws Throwable { final int ARITY = 252; System.out.println("test"+ARITY); Object[] a = testArgs(ARITY); Object r0 = hashArguments(a); Object r; r = hashArguments_252( // <editor-fold defaultstate="collapsed" desc="a[0x00], a[0x01], a[0x02], a[0x03], a[0x04], ..."> a[0x00], a[0x01], a[0x02], a[0x03], a[0x04], a[0x05], a[0x06], a[0x07], a[0x08], a[0x09], a[0x0A], a[0x0B], a[0x0C], a[0x0D], a[0x0E], a[0x0F], a[0x10], a[0x11], a[0x12], a[0x13], a[0x14], a[0x15], a[0x16], a[0x17], a[0x18], a[0x19], a[0x1A], a[0x1B], a[0x1C], a[0x1D], a[0x1E], a[0x1F], a[0x20], a[0x21], a[0x22], a[0x23], a[0x24], a[0x25], a[0x26], a[0x27], a[0x28], a[0x29], a[0x2A], a[0x2B], a[0x2C], a[0x2D], a[0x2E], a[0x2F], a[0x30], a[0x31], a[0x32], a[0x33], a[0x34], a[0x35], a[0x36], a[0x37], a[0x38], a[0x39], a[0x3A], a[0x3B], a[0x3C], a[0x3D], a[0x3E], a[0x3F], a[0x40], a[0x41], a[0x42], a[0x43], a[0x44], a[0x45], a[0x46], a[0x47], a[0x48], a[0x49], a[0x4A], a[0x4B], a[0x4C], a[0x4D], a[0x4E], a[0x4F], a[0x50], a[0x51], a[0x52], a[0x53], a[0x54], a[0x55], a[0x56], a[0x57], a[0x58], a[0x59], a[0x5A], a[0x5B], a[0x5C], a[0x5D], a[0x5E], a[0x5F], a[0x60], a[0x61], a[0x62], a[0x63], a[0x64], a[0x65], a[0x66], a[0x67], a[0x68], a[0x69], a[0x6A], a[0x6B], a[0x6C], a[0x6D], a[0x6E], a[0x6F], a[0x70], a[0x71], a[0x72], a[0x73], a[0x74], a[0x75], a[0x76], a[0x77], a[0x78], a[0x79], a[0x7A], a[0x7B], a[0x7C], a[0x7D], a[0x7E], a[0x7F], a[0x80], a[0x81], a[0x82], a[0x83], a[0x84], a[0x85], a[0x86], a[0x87], a[0x88], a[0x89], a[0x8A], a[0x8B], a[0x8C], a[0x8D], a[0x8E], a[0x8F], a[0x90], a[0x91], a[0x92], a[0x93], a[0x94], a[0x95], a[0x96], a[0x97], a[0x98], a[0x99], a[0x9A], a[0x9B], a[0x9C], a[0x9D], a[0x9E], a[0x9F], a[0xA0], a[0xA1], a[0xA2], a[0xA3], a[0xA4], a[0xA5], a[0xA6], a[0xA7], a[0xA8], a[0xA9], a[0xAA], a[0xAB], a[0xAC], a[0xAD], a[0xAE], a[0xAF], a[0xB0], a[0xB1], a[0xB2], a[0xB3], a[0xB4], a[0xB5], a[0xB6], a[0xB7], a[0xB8], a[0xB9], a[0xBA], a[0xBB], a[0xBC], a[0xBD], a[0xBE], a[0xBF], a[0xC0], a[0xC1], a[0xC2], a[0xC3], a[0xC4], a[0xC5], a[0xC6], a[0xC7], a[0xC8], a[0xC9], a[0xCA], a[0xCB], a[0xCC], a[0xCD], a[0xCE], a[0xCF], a[0xD0], a[0xD1], a[0xD2], a[0xD3], a[0xD4], a[0xD5], a[0xD6], a[0xD7], a[0xD8], a[0xD9], a[0xDA], a[0xDB], a[0xDC], a[0xDD], a[0xDE], a[0xDF], a[0xE0], a[0xE1], a[0xE2], a[0xE3], a[0xE4], a[0xE5], a[0xE6], a[0xE7], a[0xE8], a[0xE9], a[0xEA], a[0xEB], a[0xEC], a[0xED], a[0xEE], a[0xEF], a[0xF0], a[0xF1], a[0xF2], a[0xF3], a[0xF4], a[0xF5], a[0xF6], a[0xF7], // </editor-fold> a[0xF8], a[0xF9], a[0xFA], a[0xFB]); // hashArguments_252 assertEquals(r0, r); MethodType mt = MethodType.genericMethodType(ARITY); MethodHandle mh = MethodHandles.lookup().findStatic(BigArityTest.class, "hashArguments_"+ARITY, mt); test252(mh, a, r0); MethodHandle mh_CA = MH_hashArguments_VA.asFixedArity().asCollector(Object[].class, ARITY); test252(mh_CA, a, r0); }
Example 12
Source File: BigArityTest.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
@Test public void test253() throws Throwable { final int ARITY = 253; System.out.println("test"+ARITY); Object[] a = testArgs(ARITY); Object r0 = hashArguments(a); Object r; r = hashArguments_253( // <editor-fold defaultstate="collapsed" desc="a[0x00], a[0x01], a[0x02], a[0x03], a[0x04], ..."> a[0x00], a[0x01], a[0x02], a[0x03], a[0x04], a[0x05], a[0x06], a[0x07], a[0x08], a[0x09], a[0x0A], a[0x0B], a[0x0C], a[0x0D], a[0x0E], a[0x0F], a[0x10], a[0x11], a[0x12], a[0x13], a[0x14], a[0x15], a[0x16], a[0x17], a[0x18], a[0x19], a[0x1A], a[0x1B], a[0x1C], a[0x1D], a[0x1E], a[0x1F], a[0x20], a[0x21], a[0x22], a[0x23], a[0x24], a[0x25], a[0x26], a[0x27], a[0x28], a[0x29], a[0x2A], a[0x2B], a[0x2C], a[0x2D], a[0x2E], a[0x2F], a[0x30], a[0x31], a[0x32], a[0x33], a[0x34], a[0x35], a[0x36], a[0x37], a[0x38], a[0x39], a[0x3A], a[0x3B], a[0x3C], a[0x3D], a[0x3E], a[0x3F], a[0x40], a[0x41], a[0x42], a[0x43], a[0x44], a[0x45], a[0x46], a[0x47], a[0x48], a[0x49], a[0x4A], a[0x4B], a[0x4C], a[0x4D], a[0x4E], a[0x4F], a[0x50], a[0x51], a[0x52], a[0x53], a[0x54], a[0x55], a[0x56], a[0x57], a[0x58], a[0x59], a[0x5A], a[0x5B], a[0x5C], a[0x5D], a[0x5E], a[0x5F], a[0x60], a[0x61], a[0x62], a[0x63], a[0x64], a[0x65], a[0x66], a[0x67], a[0x68], a[0x69], a[0x6A], a[0x6B], a[0x6C], a[0x6D], a[0x6E], a[0x6F], a[0x70], a[0x71], a[0x72], a[0x73], a[0x74], a[0x75], a[0x76], a[0x77], a[0x78], a[0x79], a[0x7A], a[0x7B], a[0x7C], a[0x7D], a[0x7E], a[0x7F], a[0x80], a[0x81], a[0x82], a[0x83], a[0x84], a[0x85], a[0x86], a[0x87], a[0x88], a[0x89], a[0x8A], a[0x8B], a[0x8C], a[0x8D], a[0x8E], a[0x8F], a[0x90], a[0x91], a[0x92], a[0x93], a[0x94], a[0x95], a[0x96], a[0x97], a[0x98], a[0x99], a[0x9A], a[0x9B], a[0x9C], a[0x9D], a[0x9E], a[0x9F], a[0xA0], a[0xA1], a[0xA2], a[0xA3], a[0xA4], a[0xA5], a[0xA6], a[0xA7], a[0xA8], a[0xA9], a[0xAA], a[0xAB], a[0xAC], a[0xAD], a[0xAE], a[0xAF], a[0xB0], a[0xB1], a[0xB2], a[0xB3], a[0xB4], a[0xB5], a[0xB6], a[0xB7], a[0xB8], a[0xB9], a[0xBA], a[0xBB], a[0xBC], a[0xBD], a[0xBE], a[0xBF], a[0xC0], a[0xC1], a[0xC2], a[0xC3], a[0xC4], a[0xC5], a[0xC6], a[0xC7], a[0xC8], a[0xC9], a[0xCA], a[0xCB], a[0xCC], a[0xCD], a[0xCE], a[0xCF], a[0xD0], a[0xD1], a[0xD2], a[0xD3], a[0xD4], a[0xD5], a[0xD6], a[0xD7], a[0xD8], a[0xD9], a[0xDA], a[0xDB], a[0xDC], a[0xDD], a[0xDE], a[0xDF], a[0xE0], a[0xE1], a[0xE2], a[0xE3], a[0xE4], a[0xE5], a[0xE6], a[0xE7], a[0xE8], a[0xE9], a[0xEA], a[0xEB], a[0xEC], a[0xED], a[0xEE], a[0xEF], a[0xF0], a[0xF1], a[0xF2], a[0xF3], a[0xF4], a[0xF5], a[0xF6], a[0xF7], // </editor-fold> a[0xF8], a[0xF9], a[0xFA], a[0xFB], a[0xFC]); // hashArguments_253 assertEquals(r0, r); MethodType mt = MethodType.genericMethodType(ARITY); MethodHandle mh = MethodHandles.lookup().findStatic(BigArityTest.class, "hashArguments_"+ARITY, mt); test253(mh, a, r0); MethodHandle mh_CA = MH_hashArguments_VA.asFixedArity().asCollector(Object[].class, ARITY); test253(mh_CA, a, r0); }
Example 13
Source File: BigArityTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Test public void test253() throws Throwable { final int ARITY = 253; System.out.println("test"+ARITY); Object[] a = testArgs(ARITY); Object r0 = hashArguments(a); Object r; r = hashArguments_253( // <editor-fold defaultstate="collapsed" desc="a[0x00], a[0x01], a[0x02], a[0x03], a[0x04], ..."> a[0x00], a[0x01], a[0x02], a[0x03], a[0x04], a[0x05], a[0x06], a[0x07], a[0x08], a[0x09], a[0x0A], a[0x0B], a[0x0C], a[0x0D], a[0x0E], a[0x0F], a[0x10], a[0x11], a[0x12], a[0x13], a[0x14], a[0x15], a[0x16], a[0x17], a[0x18], a[0x19], a[0x1A], a[0x1B], a[0x1C], a[0x1D], a[0x1E], a[0x1F], a[0x20], a[0x21], a[0x22], a[0x23], a[0x24], a[0x25], a[0x26], a[0x27], a[0x28], a[0x29], a[0x2A], a[0x2B], a[0x2C], a[0x2D], a[0x2E], a[0x2F], a[0x30], a[0x31], a[0x32], a[0x33], a[0x34], a[0x35], a[0x36], a[0x37], a[0x38], a[0x39], a[0x3A], a[0x3B], a[0x3C], a[0x3D], a[0x3E], a[0x3F], a[0x40], a[0x41], a[0x42], a[0x43], a[0x44], a[0x45], a[0x46], a[0x47], a[0x48], a[0x49], a[0x4A], a[0x4B], a[0x4C], a[0x4D], a[0x4E], a[0x4F], a[0x50], a[0x51], a[0x52], a[0x53], a[0x54], a[0x55], a[0x56], a[0x57], a[0x58], a[0x59], a[0x5A], a[0x5B], a[0x5C], a[0x5D], a[0x5E], a[0x5F], a[0x60], a[0x61], a[0x62], a[0x63], a[0x64], a[0x65], a[0x66], a[0x67], a[0x68], a[0x69], a[0x6A], a[0x6B], a[0x6C], a[0x6D], a[0x6E], a[0x6F], a[0x70], a[0x71], a[0x72], a[0x73], a[0x74], a[0x75], a[0x76], a[0x77], a[0x78], a[0x79], a[0x7A], a[0x7B], a[0x7C], a[0x7D], a[0x7E], a[0x7F], a[0x80], a[0x81], a[0x82], a[0x83], a[0x84], a[0x85], a[0x86], a[0x87], a[0x88], a[0x89], a[0x8A], a[0x8B], a[0x8C], a[0x8D], a[0x8E], a[0x8F], a[0x90], a[0x91], a[0x92], a[0x93], a[0x94], a[0x95], a[0x96], a[0x97], a[0x98], a[0x99], a[0x9A], a[0x9B], a[0x9C], a[0x9D], a[0x9E], a[0x9F], a[0xA0], a[0xA1], a[0xA2], a[0xA3], a[0xA4], a[0xA5], a[0xA6], a[0xA7], a[0xA8], a[0xA9], a[0xAA], a[0xAB], a[0xAC], a[0xAD], a[0xAE], a[0xAF], a[0xB0], a[0xB1], a[0xB2], a[0xB3], a[0xB4], a[0xB5], a[0xB6], a[0xB7], a[0xB8], a[0xB9], a[0xBA], a[0xBB], a[0xBC], a[0xBD], a[0xBE], a[0xBF], a[0xC0], a[0xC1], a[0xC2], a[0xC3], a[0xC4], a[0xC5], a[0xC6], a[0xC7], a[0xC8], a[0xC9], a[0xCA], a[0xCB], a[0xCC], a[0xCD], a[0xCE], a[0xCF], a[0xD0], a[0xD1], a[0xD2], a[0xD3], a[0xD4], a[0xD5], a[0xD6], a[0xD7], a[0xD8], a[0xD9], a[0xDA], a[0xDB], a[0xDC], a[0xDD], a[0xDE], a[0xDF], a[0xE0], a[0xE1], a[0xE2], a[0xE3], a[0xE4], a[0xE5], a[0xE6], a[0xE7], a[0xE8], a[0xE9], a[0xEA], a[0xEB], a[0xEC], a[0xED], a[0xEE], a[0xEF], a[0xF0], a[0xF1], a[0xF2], a[0xF3], a[0xF4], a[0xF5], a[0xF6], a[0xF7], // </editor-fold> a[0xF8], a[0xF9], a[0xFA], a[0xFB], a[0xFC]); // hashArguments_253 assertEquals(r0, r); MethodType mt = MethodType.genericMethodType(ARITY); MethodHandle mh = MethodHandles.lookup().findStatic(BigArityTest.class, "hashArguments_"+ARITY, mt); test253(mh, a, r0); MethodHandle mh_CA = MH_hashArguments_VA.asFixedArity().asCollector(Object[].class, ARITY); test253(mh_CA, a, r0); }
Example 14
Source File: MethodTypeTest.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@Test public void testMakeGeneric() { System.out.println("makeGeneric"); int objectArgCount = 2; MethodType expResult = mt_OO2; MethodType result = MethodType.genericMethodType(objectArgCount); assertSame(expResult, result); }
Example 15
Source File: MethodStubResult_VarArgs.java From baratine with GNU General Public License v2.0 | 5 votes |
@Override protected MethodHandle initMethodHandle(ServicesAmp ampManager, Method method) throws IllegalAccessException { Class<?> []paramTypes = method.getParameterTypes(); int paramLen = paramTypes.length; int resultOffset = findResultOffset(method, paramTypes); method.setAccessible(true); MethodHandle mh = MethodHandles.lookup().unreflect(method); int []permute = new int[paramLen + 1]; permute[0] = 0; for (int i = 0; i < resultOffset; i++) { permute[i + 1] = i + 2; } for (int i = resultOffset + 1; i < paramLen; i++) { permute[i + 1] = i + 1; } permute[resultOffset + 1] = 1; MethodType type = MethodType.genericMethodType(paramLen + 1); type = type.changeReturnType(void.class); mh = mh.asFixedArity(); mh = mh.asType(type); mh = MethodHandles.permuteArguments(mh, type, permute); mh = mh.asSpreader(Object[].class, paramTypes.length - 1); type = MethodType.methodType(void.class, Object.class, Result.class, Object[].class); return mh.asType(type); }
Example 16
Source File: BigArityTest.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
@Test public void test252() throws Throwable { final int ARITY = 252; System.out.println("test"+ARITY); Object[] a = testArgs(ARITY); Object r0 = hashArguments(a); Object r; r = hashArguments_252( // <editor-fold defaultstate="collapsed" desc="a[0x00], a[0x01], a[0x02], a[0x03], a[0x04], ..."> a[0x00], a[0x01], a[0x02], a[0x03], a[0x04], a[0x05], a[0x06], a[0x07], a[0x08], a[0x09], a[0x0A], a[0x0B], a[0x0C], a[0x0D], a[0x0E], a[0x0F], a[0x10], a[0x11], a[0x12], a[0x13], a[0x14], a[0x15], a[0x16], a[0x17], a[0x18], a[0x19], a[0x1A], a[0x1B], a[0x1C], a[0x1D], a[0x1E], a[0x1F], a[0x20], a[0x21], a[0x22], a[0x23], a[0x24], a[0x25], a[0x26], a[0x27], a[0x28], a[0x29], a[0x2A], a[0x2B], a[0x2C], a[0x2D], a[0x2E], a[0x2F], a[0x30], a[0x31], a[0x32], a[0x33], a[0x34], a[0x35], a[0x36], a[0x37], a[0x38], a[0x39], a[0x3A], a[0x3B], a[0x3C], a[0x3D], a[0x3E], a[0x3F], a[0x40], a[0x41], a[0x42], a[0x43], a[0x44], a[0x45], a[0x46], a[0x47], a[0x48], a[0x49], a[0x4A], a[0x4B], a[0x4C], a[0x4D], a[0x4E], a[0x4F], a[0x50], a[0x51], a[0x52], a[0x53], a[0x54], a[0x55], a[0x56], a[0x57], a[0x58], a[0x59], a[0x5A], a[0x5B], a[0x5C], a[0x5D], a[0x5E], a[0x5F], a[0x60], a[0x61], a[0x62], a[0x63], a[0x64], a[0x65], a[0x66], a[0x67], a[0x68], a[0x69], a[0x6A], a[0x6B], a[0x6C], a[0x6D], a[0x6E], a[0x6F], a[0x70], a[0x71], a[0x72], a[0x73], a[0x74], a[0x75], a[0x76], a[0x77], a[0x78], a[0x79], a[0x7A], a[0x7B], a[0x7C], a[0x7D], a[0x7E], a[0x7F], a[0x80], a[0x81], a[0x82], a[0x83], a[0x84], a[0x85], a[0x86], a[0x87], a[0x88], a[0x89], a[0x8A], a[0x8B], a[0x8C], a[0x8D], a[0x8E], a[0x8F], a[0x90], a[0x91], a[0x92], a[0x93], a[0x94], a[0x95], a[0x96], a[0x97], a[0x98], a[0x99], a[0x9A], a[0x9B], a[0x9C], a[0x9D], a[0x9E], a[0x9F], a[0xA0], a[0xA1], a[0xA2], a[0xA3], a[0xA4], a[0xA5], a[0xA6], a[0xA7], a[0xA8], a[0xA9], a[0xAA], a[0xAB], a[0xAC], a[0xAD], a[0xAE], a[0xAF], a[0xB0], a[0xB1], a[0xB2], a[0xB3], a[0xB4], a[0xB5], a[0xB6], a[0xB7], a[0xB8], a[0xB9], a[0xBA], a[0xBB], a[0xBC], a[0xBD], a[0xBE], a[0xBF], a[0xC0], a[0xC1], a[0xC2], a[0xC3], a[0xC4], a[0xC5], a[0xC6], a[0xC7], a[0xC8], a[0xC9], a[0xCA], a[0xCB], a[0xCC], a[0xCD], a[0xCE], a[0xCF], a[0xD0], a[0xD1], a[0xD2], a[0xD3], a[0xD4], a[0xD5], a[0xD6], a[0xD7], a[0xD8], a[0xD9], a[0xDA], a[0xDB], a[0xDC], a[0xDD], a[0xDE], a[0xDF], a[0xE0], a[0xE1], a[0xE2], a[0xE3], a[0xE4], a[0xE5], a[0xE6], a[0xE7], a[0xE8], a[0xE9], a[0xEA], a[0xEB], a[0xEC], a[0xED], a[0xEE], a[0xEF], a[0xF0], a[0xF1], a[0xF2], a[0xF3], a[0xF4], a[0xF5], a[0xF6], a[0xF7], // </editor-fold> a[0xF8], a[0xF9], a[0xFA], a[0xFB]); // hashArguments_252 assertEquals(r0, r); MethodType mt = MethodType.genericMethodType(ARITY); MethodHandle mh = MethodHandles.lookup().findStatic(BigArityTest.class, "hashArguments_"+ARITY, mt); test252(mh, a, r0); MethodHandle mh_CA = MH_hashArguments_VA.asFixedArity().asCollector(Object[].class, ARITY); test252(mh_CA, a, r0); }
Example 17
Source File: MethodTypeTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@BeforeMethod public void setUp() throws Exception { rtype = void.class; ptypes = new Class<?>[] { int.class, String.class }; mt_viS = MethodType.methodType(void.class, int.class, String.class); mt_OO = MethodType.methodType(Object.class, Object.class); mt_OO2 = MethodType.methodType(Object.class, Object.class, Object.class); mt_vv = MethodType.methodType(void.class); mt_Vv = MethodType.methodType(Void.class); mt_Ov = MethodType.methodType(Object.class); mt_iSI = MethodType.methodType(int.class, String.class, Integer.class); mt_ISi = MethodType.methodType(Integer.class, String.class, int.class); mt_ISI = MethodType.methodType(Integer.class, String.class, Integer.class); mt_iSi = MethodType.methodType(int.class, String.class, int.class); compareTo = String.class.getDeclaredMethod("compareTo", String.class); mt_viO = MethodType.methodType(void.class, int.class, Object.class); mt_iO2 = MethodType.methodType(int.class, Object.class, Object.class); mt_OOi = MethodType.methodType(Object.class, Object.class, int.class); mt_iOi = MethodType.methodType(int.class, Object.class, int.class); mt_VIO = MethodType.methodType(Void.class, Integer.class, Object.class); mt_IO2 = MethodType.methodType(Integer.class, Object.class, Object.class); mt_OOI = MethodType.methodType(Object.class, Object.class, Integer.class); mt_IOI = MethodType.methodType(Integer.class, Object.class, Integer.class); mt_VIS = MethodType.methodType(Void.class, Integer.class, String.class); mt_vOiSzA = MethodType.methodType(void.class, Object.class, int.class, String.class, boolean.class, Object[].class); mt_OO99 = MethodType.genericMethodType(99); GALLERY = new MethodType[] { mt_viS, mt_OO, mt_OO2, mt_vv, mt_Vv, mt_Ov, mt_iSI, mt_ISi, mt_ISI, mt_iSi, mt_viO, mt_iO2, mt_OOi, mt_iOi, mt_VIO, mt_IO2, mt_OOI, mt_IOI, mt_VIS, mt_vOiSzA, mt_OO99 }; }
Example 18
Source File: MethodTypeTest.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@Test public void testMakeGeneric() { System.out.println("makeGeneric"); int objectArgCount = 2; MethodType expResult = mt_OO2; MethodType result = MethodType.genericMethodType(objectArgCount); assertSame(expResult, result); }
Example 19
Source File: BigArityTest.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
static MethodHandle MH_hashArguments(int arity) { MethodType mt = MethodType.genericMethodType(arity); return MH_hashArguments_VA.asType(mt); }
Example 20
Source File: MethodStubResult_N.java From baratine with GNU General Public License v2.0 | 4 votes |
protected MethodHandle initMethodHandle(ServicesAmp ampManager, Method method) throws IllegalAccessException { Class<?> []paramTypes = method.getParameterTypes(); int paramLen = paramTypes.length; int resultOffset = findResultOffset(paramTypes); method.setAccessible(true); MethodHandle mh = MethodHandles.lookup().unreflect(method); int []permute = new int[paramLen + 1]; permute[0] = 0; for (int i = 0; i < resultOffset; i++) { permute[i + 1] = i + 2; } for (int i = resultOffset + 1; i < paramLen; i++) { permute[i + 1] = i + 1; } permute[resultOffset + 1] = 1; MethodType type = MethodType.genericMethodType(paramLen + 1); type = type.changeReturnType(void.class); mh = mh.asType(type); mh = filterMethod(ampManager, mh, method); mh = MethodHandles.permuteArguments(mh, type, permute); /* if (paramLen > 0 && ! Object[].class.equals(paramTypes[paramLen - 1])) { } */ mh = mh.asSpreader(Object[].class, paramLen - 1); type = MethodType.methodType(void.class, Object.class, getResultClass(), Object[].class); return mh.asType(type); }