Java Code Examples for sun.invoke.util.Wrapper#ordinal()
The following examples show how to use
sun.invoke.util.Wrapper#ordinal() .
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: MethodHandles.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
/** * Produces a method handle which returns its sole argument when invoked. * @param type the type of the sole parameter and return value of the desired method handle * @return a unary method handle which accepts and returns the given type * @throws NullPointerException if the argument is null * @throws IllegalArgumentException if the given type is {@code void.class} */ public static MethodHandle identity(Class<?> type) { Wrapper btw = (type.isPrimitive() ? Wrapper.forPrimitiveType(type) : Wrapper.OBJECT); int pos = btw.ordinal(); MethodHandle ident = IDENTITY_MHS[pos]; if (ident == null) { ident = setCachedMethodHandle(IDENTITY_MHS, pos, makeIdentity(btw.primitiveType())); } if (ident.type().returnType() == type) return ident; // something like identity(Foo.class); do not bother to intern these assert(btw == Wrapper.OBJECT); return makeIdentity(type); }
Example 2
Source File: TypeConvertingMethodAdapter.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
void widen(Wrapper ws, Wrapper wt) { if (ws != wt) { int opcode = wideningOpcodes[ws.ordinal()][wt.ordinal()]; if (opcode != Opcodes.NOP) { visitInsn(opcode); } } }
Example 3
Source File: TypeConvertingMethodAdapter.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
void widen(Wrapper ws, Wrapper wt) { if (ws != wt) { int opcode = wideningOpcodes[ws.ordinal()][wt.ordinal()]; if (opcode != Opcodes.NOP) { visitInsn(opcode); } } }
Example 4
Source File: TypeConvertingMethodAdapter.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
void widen(Wrapper ws, Wrapper wt) { if (ws != wt) { int opcode = wideningOpcodes[ws.ordinal()][wt.ordinal()]; if (opcode != Opcodes.NOP) { visitInsn(opcode); } } }
Example 5
Source File: MethodHandles.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** * Produces a method handle which returns its sole argument when invoked. * @param type the type of the sole parameter and return value of the desired method handle * @return a unary method handle which accepts and returns the given type * @throws NullPointerException if the argument is null * @throws IllegalArgumentException if the given type is {@code void.class} */ public static MethodHandle identity(Class<?> type) { Wrapper btw = (type.isPrimitive() ? Wrapper.forPrimitiveType(type) : Wrapper.OBJECT); int pos = btw.ordinal(); MethodHandle ident = IDENTITY_MHS[pos]; if (ident == null) { ident = setCachedMethodHandle(IDENTITY_MHS, pos, makeIdentity(btw.primitiveType())); } if (ident.type().returnType() == type) return ident; // something like identity(Foo.class); do not bother to intern these assert(btw == Wrapper.OBJECT); return makeIdentity(type); }
Example 6
Source File: MethodHandles.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Produces a method handle which returns its sole argument when invoked. * @param type the type of the sole parameter and return value of the desired method handle * @return a unary method handle which accepts and returns the given type * @throws NullPointerException if the argument is null * @throws IllegalArgumentException if the given type is {@code void.class} */ public static MethodHandle identity(Class<?> type) { Wrapper btw = (type.isPrimitive() ? Wrapper.forPrimitiveType(type) : Wrapper.OBJECT); int pos = btw.ordinal(); MethodHandle ident = IDENTITY_MHS[pos]; if (ident == null) { ident = setCachedMethodHandle(IDENTITY_MHS, pos, makeIdentity(btw.primitiveType())); } if (ident.type().returnType() == type) return ident; // something like identity(Foo.class); do not bother to intern these assert(btw == Wrapper.OBJECT); return makeIdentity(type); }
Example 7
Source File: TypeConvertingMethodAdapter.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
void widen(Wrapper ws, Wrapper wt) { if (ws != wt) { int opcode = wideningOpcodes[ws.ordinal()][wt.ordinal()]; if (opcode != Opcodes.NOP) { visitInsn(opcode); } } }
Example 8
Source File: TypeConvertingMethodAdapter.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
void widen(Wrapper ws, Wrapper wt) { if (ws != wt) { int opcode = wideningOpcodes[ws.ordinal()][wt.ordinal()]; if (opcode != Opcodes.NOP) { visitInsn(opcode); } } }
Example 9
Source File: MethodHandles.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * Produces a method handle which returns its sole argument when invoked. * @param type the type of the sole parameter and return value of the desired method handle * @return a unary method handle which accepts and returns the given type * @throws NullPointerException if the argument is null * @throws IllegalArgumentException if the given type is {@code void.class} */ public static MethodHandle identity(Class<?> type) { Wrapper btw = (type.isPrimitive() ? Wrapper.forPrimitiveType(type) : Wrapper.OBJECT); int pos = btw.ordinal(); MethodHandle ident = IDENTITY_MHS[pos]; if (ident == null) { ident = setCachedMethodHandle(IDENTITY_MHS, pos, makeIdentity(btw.primitiveType())); } if (ident.type().returnType() == type) return ident; // something like identity(Foo.class); do not bother to intern these assert(btw == Wrapper.OBJECT); return makeIdentity(type); }
Example 10
Source File: TypeConvertingMethodAdapter.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
void widen(Wrapper ws, Wrapper wt) { if (ws != wt) { int opcode = wideningOpcodes[ws.ordinal()][wt.ordinal()]; if (opcode != Opcodes.NOP) { visitInsn(opcode); } } }
Example 11
Source File: TypeConvertingMethodAdapter.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
void widen(Wrapper ws, Wrapper wt) { if (ws != wt) { int opcode = wideningOpcodes[ws.ordinal()][wt.ordinal()]; if (opcode != Opcodes.NOP) { visitInsn(opcode); } } }
Example 12
Source File: MethodHandles.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Produces a method handle which returns its sole argument when invoked. * @param type the type of the sole parameter and return value of the desired method handle * @return a unary method handle which accepts and returns the given type * @throws NullPointerException if the argument is null * @throws IllegalArgumentException if the given type is {@code void.class} */ public static MethodHandle identity(Class<?> type) { Wrapper btw = (type.isPrimitive() ? Wrapper.forPrimitiveType(type) : Wrapper.OBJECT); int pos = btw.ordinal(); MethodHandle ident = IDENTITY_MHS[pos]; if (ident == null) { ident = setCachedMethodHandle(IDENTITY_MHS, pos, makeIdentity(btw.primitiveType())); } if (ident.type().returnType() == type) return ident; // something like identity(Foo.class); do not bother to intern these assert(btw == Wrapper.OBJECT); return makeIdentity(type); }
Example 13
Source File: TypeConvertingMethodAdapter.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
private static void initWidening(Wrapper to, int opcode, Wrapper... from) { for (Wrapper f : from) { wideningOpcodes[f.ordinal()][to.ordinal()] = opcode; } }
Example 14
Source File: TypeConvertingMethodAdapter.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
private static void initWidening(Wrapper to, int opcode, Wrapper... from) { for (Wrapper f : from) { wideningOpcodes[f.ordinal()][to.ordinal()] = opcode; } }
Example 15
Source File: TypeConvertingMethodAdapter.java From jdk1.8-source-analysis with Apache License 2.0 | 4 votes |
private static void initWidening(Wrapper to, int opcode, Wrapper... from) { for (Wrapper f : from) { wideningOpcodes[f.ordinal()][to.ordinal()] = opcode; } }
Example 16
Source File: TypeConvertingMethodAdapter.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
private static void initWidening(Wrapper to, int opcode, Wrapper... from) { for (Wrapper f : from) { wideningOpcodes[f.ordinal()][to.ordinal()] = opcode; } }
Example 17
Source File: TypeConvertingMethodAdapter.java From hottub with GNU General Public License v2.0 | 4 votes |
private static void initWidening(Wrapper to, int opcode, Wrapper... from) { for (Wrapper f : from) { wideningOpcodes[f.ordinal()][to.ordinal()] = opcode; } }
Example 18
Source File: TypeConvertingMethodAdapter.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
private static void initWidening(Wrapper to, int opcode, Wrapper... from) { for (Wrapper f : from) { wideningOpcodes[f.ordinal()][to.ordinal()] = opcode; } }
Example 19
Source File: TypeConvertingMethodAdapter.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
private static void initWidening(Wrapper to, int opcode, Wrapper... from) { for (Wrapper f : from) { wideningOpcodes[f.ordinal()][to.ordinal()] = opcode; } }
Example 20
Source File: TypeConvertingMethodAdapter.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
private static void initWidening(Wrapper to, int opcode, Wrapper... from) { for (Wrapper f : from) { wideningOpcodes[f.ordinal()][to.ordinal()] = opcode; } }