Package java.lang.invoke.MethodHandles

Examples of java.lang.invoke.MethodHandles.Lookup


        }
    }

    private static ReflectiveCodeInfo[] getCodeInfo(Class<?> cls) {
        ArrayList<ReflectiveCodeInfo> ret = new ArrayList< >();
        Lookup l = MethodHandles.lookup();
        for (Method m : cls.getDeclaredMethods()) {
            CodeRefAnnotation cra = m.getAnnotation(CodeRefAnnotation.class);
            if (cra != null) ret.add(new ReflectiveCodeInfo(l, m, cra));
        }
        return ret.toArray(new ReflectiveCodeInfo[0]);
View Full Code Here


    try {
      Class<?>[] parameterTypes = method.getParameterTypes();

      MethodType description = MethodType.methodType(method.getReturnType(), parameterTypes);

      Lookup lookup = MethodHandles.lookup();

      MethodHandle originalHandle = lookup.findVirtual(type, method.getName(), description);

      Binder binder = createBinder(method, parameterTypes.length).cast(originalHandle.type());

      return binder.invokeVirtual(lookup, method.getName());
    } catch (Exception e) {
View Full Code Here

     * It will make an up-call to this method.  (Do not change the name or signature.)
     */
    static MethodHandle linkMethodHandleConstant(Class<?> callerClass, int refKind,
                                                 Class<?> defc, String name, Object type) {
        try {
            Lookup lookup = IMPL_LOOKUP.in(callerClass);
            return lookup.linkMethodHandleConstant(refKind, defc, name, type);
        } catch (ReflectiveOperationException ex) {
            Error err = new IncompatibleClassChangeError();
            err.initCause(ex);
            throw err;
        }
View Full Code Here

     * It will make an up-call to this method.  (Do not change the name or signature.)
     */
    static MethodHandle linkMethodHandleConstant(Class<?> callerClass, int refKind,
                                                 Class<?> defc, String name, Object type) {
        try {
            Lookup lookup = IMPL_LOOKUP.in(callerClass);
            return lookup.linkMethodHandleConstant(refKind, defc, name, type);
        } catch (ReflectiveOperationException ex) {
            Error err = new IncompatibleClassChangeError();
            err.initCause(ex);
            throw err;
        }
View Full Code Here

TOP

Related Classes of java.lang.invoke.MethodHandles.Lookup

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.