jdk.nashorn.internal.lookup.MethodHandleFactory Java Examples

The following examples show how to use jdk.nashorn.internal.lookup.MethodHandleFactory. 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: ScriptObject.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) {
    final Class<?>   own = ScriptObject.class;
    final MethodType mt  = MH.type(rtype, types);
    try {
        return MH.findStatic(MethodHandles.lookup(), own, name, mt);
    } catch (final MethodHandleFactory.LookupException e) {
        return MH.findVirtual(MethodHandles.lookup(), own, name, mt);
    }
}
 
Example #2
Source File: LinkerCallSite.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) {
    try {
        return MH.findStatic(MethodHandles.lookup(), LinkerCallSite.class, name, MH.type(rtype, types));
    } catch (final MethodHandleFactory.LookupException e) {
        return MH.findVirtual(MethodHandles.lookup(), LinkerCallSite.class, name, MH.type(rtype, types));
    }
}
 
Example #3
Source File: GlobalConstants.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private MethodHandle constantGetter(final Object c) {
    final MethodHandle mh = staticConstantGetter(c);
    if (log.isEnabled()) {
        return MethodHandleFactory.addDebugPrintout(log, Level.FINEST, mh, "getting as constant");
    }
    return mh;
}
 
Example #4
Source File: JSObjectLinker.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private static MethodHandle findMH(final String name, final Class<?> target, final Class<?> rtype, final Class<?>... types) {
    final MethodType mt  = MH.type(rtype, types);
    try {
        return MH.findStatic(MethodHandles.lookup(), target, name, mt);
    } catch (final MethodHandleFactory.LookupException e) {
        return MH.findVirtual(MethodHandles.lookup(), target, name, mt);
    }
}
 
Example #5
Source File: AccessorProperty.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private MethodHandle debug(final MethodHandle mh, final Class<?> forType, final Class<?> type, final String tag) {
    if (DEBUG_FIELDS) {
       return MethodHandleFactory.addDebugPrintout(
           LOG,
           mh,
           tag + " '" + getKey() + "' (property="+ Debug.id(this) + ", forType=" + stripName(forType) + ", type=" + stripName(type) + ')');
    }
    return mh;
}
 
Example #6
Source File: ScriptObject.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) {
    final Class<?>   own = ScriptObject.class;
    final MethodType mt  = MH.type(rtype, types);
    try {
        return MH.findStatic(MethodHandles.lookup(), own, name, mt);
    } catch (final MethodHandleFactory.LookupException e) {
        return MH.findVirtual(MethodHandles.lookup(), own, name, mt);
    }
}
 
Example #7
Source File: ScriptFunction.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) {
    final Class<?>   own = ScriptFunction.class;
    final MethodType mt  = MH.type(rtype, types);
    try {
        return MH.findStatic(MethodHandles.lookup(), own, name, mt);
    } catch (final MethodHandleFactory.LookupException e) {
        return MH.findVirtual(MethodHandles.lookup(), own, name, mt);
    }
}
 
Example #8
Source File: RuntimeCallSite.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) {
    try {
        return MH.findStatic(MethodHandles.lookup(), RuntimeCallSite.class, name, MH.type(rtype, types));
    } catch (final MethodHandleFactory.LookupException e) {
        return MH.findVirtual(MethodHandles.lookup(), RuntimeCallSite.class, name, MH.type(rtype, types));
    }
}
 
Example #9
Source File: LinkerCallSite.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) {
    try {
        return MH.findStatic(MethodHandles.lookup(), LinkerCallSite.class, name, MH.type(rtype, types));
    } catch (final MethodHandleFactory.LookupException e) {
        return MH.findVirtual(MethodHandles.lookup(), LinkerCallSite.class, name, MH.type(rtype, types));
    }
}
 
Example #10
Source File: LinkerCallSite.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) {
    try {
        return MH.findStatic(MethodHandles.lookup(), TracingLinkerCallSite.class, name, MH.type(rtype, types));
    } catch (final MethodHandleFactory.LookupException e) {
        return MH.findVirtual(MethodHandles.lookup(), TracingLinkerCallSite.class, name, MH.type(rtype, types));
    }
}
 
Example #11
Source File: JSObjectLinker.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private static MethodHandle findMH(final String name, final Class<?> target, final Class<?> rtype, final Class<?>... types) {
    final MethodType mt  = MH.type(rtype, types);
    try {
        return MH.findStatic(MethodHandles.lookup(), target, name, mt);
    } catch (final MethodHandleFactory.LookupException e) {
        return MH.findVirtual(MethodHandles.lookup(), target, name, mt);
    }
}
 
Example #12
Source File: AccessorProperty.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private MethodHandle debug(final MethodHandle mh, final Class<?> forType, final Class<?> type, final String tag) {
    if (DEBUG_FIELDS) {
       return MethodHandleFactory.addDebugPrintout(
           LOG,
           mh,
           tag + " '" + getKey() + "' (property="+ Debug.id(this) + ", forType=" + stripName(forType) + ", type=" + stripName(type) + ')');
    }
    return mh;
}
 
Example #13
Source File: LinkerCallSite.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) {
    try {
        return MH.findStatic(MethodHandles.lookup(), TracingLinkerCallSite.class, name, MH.type(rtype, types));
    } catch (final MethodHandleFactory.LookupException e) {
        return MH.findVirtual(MethodHandles.lookup(), TracingLinkerCallSite.class, name, MH.type(rtype, types));
    }
}
 
Example #14
Source File: ScriptFunction.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) {
    final Class<?>   own = ScriptFunction.class;
    final MethodType mt  = MH.type(rtype, types);
    try {
        return MH.findStatic(MethodHandles.lookup(), own, name, mt);
    } catch (final MethodHandleFactory.LookupException e) {
        return MH.findVirtual(MethodHandles.lookup(), own, name, mt);
    }
}
 
Example #15
Source File: RuntimeCallSite.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) {
    try {
        return MH.findStatic(MethodHandles.lookup(), RuntimeCallSite.class, name, MH.type(rtype, types));
    } catch (final MethodHandleFactory.LookupException e) {
        return MH.findVirtual(MethodHandles.lookup(), RuntimeCallSite.class, name, MH.type(rtype, types));
    }
}
 
Example #16
Source File: GlobalConstants.java    From jdk8u_nashorn with GNU General Public License v2.0 5 votes vote down vote up
private MethodHandle constantGetter(final Object c) {
    final MethodHandle mh = staticConstantGetter(c);
    if (log.isEnabled()) {
        return MethodHandleFactory.addDebugPrintout(log, Level.FINEST, mh, "getting as constant");
    }
    return mh;
}
 
Example #17
Source File: LinkerCallSite.java    From nashorn with GNU General Public License v2.0 5 votes vote down vote up
private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) {
    try {
        return MH.findStatic(MethodHandles.lookup(), LinkerCallSite.class, name, MH.type(rtype, types));
    } catch (final MethodHandleFactory.LookupException e) {
        return MH.findVirtual(MethodHandles.lookup(), LinkerCallSite.class, name, MH.type(rtype, types));
    }
}
 
Example #18
Source File: LinkerCallSite.java    From nashorn with GNU General Public License v2.0 5 votes vote down vote up
private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) {
    try {
        return MH.findStatic(MethodHandles.lookup(), TracingLinkerCallSite.class, name, MH.type(rtype, types));
    } catch (final MethodHandleFactory.LookupException e) {
        return MH.findVirtual(MethodHandles.lookup(), TracingLinkerCallSite.class, name, MH.type(rtype, types));
    }
}
 
Example #19
Source File: JSObjectLinker.java    From nashorn with GNU General Public License v2.0 5 votes vote down vote up
private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) {
    final Class<?>   own = JSObjectLinker.class;
    final MethodType mt  = MH.type(rtype, types);
    try {
        return MH.findStatic(MethodHandles.lookup(), own, name, mt);
    } catch (final MethodHandleFactory.LookupException e) {
        return MH.findVirtual(MethodHandles.lookup(), own, name, mt);
    }
}
 
Example #20
Source File: JSObjectLinker.java    From nashorn with GNU General Public License v2.0 5 votes vote down vote up
private static MethodHandle findJSObjectMH(final String name, final Class<?> rtype, final Class<?>... types) {
    final Class<?>   own = JSObject.class;
    final MethodType mt  = MH.type(rtype, types);
    try {
        return MH.findVirtual(MethodHandles.publicLookup(), own, name, mt);
    } catch (final MethodHandleFactory.LookupException e) {
        return MH.findVirtual(MethodHandles.lookup(), own, name, mt);
    }
}
 
Example #21
Source File: AccessorProperty.java    From nashorn with GNU General Public License v2.0 5 votes vote down vote up
private MethodHandle debug(final MethodHandle mh, final Class<?> forType, final Class<?> type, final String tag) {
    if (DEBUG_FIELDS) {
       return MethodHandleFactory.addDebugPrintout(
           LOG,
           mh,
           tag + " '" + getKey() + "' (property="+ Debug.id(this) + ", forType=" + stripName(forType) + ", type=" + stripName(type) + ')');
    }
    return mh;
}
 
Example #22
Source File: ScriptObject.java    From nashorn with GNU General Public License v2.0 5 votes vote down vote up
private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) {
    final Class<?>   own = ScriptObject.class;
    final MethodType mt  = MH.type(rtype, types);
    try {
        return MH.findStatic(MethodHandles.lookup(), own, name, mt);
    } catch (final MethodHandleFactory.LookupException e) {
        return MH.findVirtual(MethodHandles.lookup(), own, name, mt);
    }
}
 
Example #23
Source File: ScriptFunction.java    From nashorn with GNU General Public License v2.0 5 votes vote down vote up
private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) {
    final Class<?>   own = ScriptFunction.class;
    final MethodType mt  = MH.type(rtype, types);
    try {
        return MH.findStatic(MethodHandles.lookup(), own, name, mt);
    } catch (final MethodHandleFactory.LookupException e) {
        return MH.findVirtual(MethodHandles.lookup(), own, name, mt);
    }
}
 
Example #24
Source File: RuntimeCallSite.java    From nashorn with GNU General Public License v2.0 5 votes vote down vote up
private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) {
    try {
        return MH.findStatic(MethodHandles.lookup(), RuntimeCallSite.class, name, MH.type(rtype, types));
    } catch (final MethodHandleFactory.LookupException e) {
        return MH.findVirtual(MethodHandles.lookup(), RuntimeCallSite.class, name, MH.type(rtype, types));
    }
}
 
Example #25
Source File: GlobalConstants.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private MethodHandle constantGetter(final Object c) {
    final MethodHandle mh = staticConstantGetter(c);
    if (log.isEnabled()) {
        return MethodHandleFactory.addDebugPrintout(log, Level.FINEST, mh, "getting as constant");
    }
    return mh;
}
 
Example #26
Source File: GlobalConstants.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private MethodHandle constantGetter(final Object c) {
    final MethodHandle mh = staticConstantGetter(c);
    if (log.isEnabled()) {
        return MethodHandleFactory.addDebugPrintout(log, Level.FINEST, mh, "getting as constant");
    }
    return mh;
}
 
Example #27
Source File: GlobalConstants.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private MethodHandle constantGetter(final Object c) {
    final MethodHandle mh = staticConstantGetter(c);
    if (log.isEnabled()) {
        return MethodHandleFactory.addDebugPrintout(log, Level.FINEST, mh, "getting as constant");
    }
    return mh;
}
 
Example #28
Source File: GlobalConstants.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private MethodHandle constantGetter(final Object c) {
    final MethodHandle mh = staticConstantGetter(c);
    if (log.isEnabled()) {
        return MethodHandleFactory.addDebugPrintout(log, Level.FINEST, mh, "getting as constant");
    }
    return mh;
}
 
Example #29
Source File: GlobalConstants.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private MethodHandle constantGetter(final Object c) {
    final MethodHandle mh = staticConstantGetter(c);
    if (log.isEnabled()) {
        return MethodHandleFactory.addDebugPrintout(log, Level.FINEST, mh, "getting as constant");
    }
    return mh;
}
 
Example #30
Source File: Context.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private void initLoggers() {
    ((Loggable)MethodHandleFactory.getFunctionality()).initLogger(this);
}