Java Code Examples for java.lang.invoke.MethodHandles#throwException()
The following examples show how to use
java.lang.invoke.MethodHandles#throwException() .
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: Validation.java From dynamic-object with Creative Commons Zero v1.0 Universal | 5 votes |
private static MethodHandle throwException(Supplier<Throwable> supplier, MethodType type) throws Exception { MethodHandle makeExn = PRIVATE_LOOKUP.findVirtual(Supplier.class, "get", methodType(Object.class)); makeExn = makeExn.bindTo(supplier); makeExn = makeExn.asType(methodType(Throwable.class)); MethodHandle throwExn = MethodHandles.throwException(type.returnType(), Throwable.class); throwExn = MethodHandles.foldArguments(throwExn, makeExn); // discard arguments specified by the provided type return MethodHandles.dropArguments(throwExn, 0, type.parameterArray()); }
Example 2
Source File: MethodHandleFactory.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
@Override public MethodHandle throwException(final Class<?> returnType, final Class<? extends Throwable> exType) { final MethodHandle mh = MethodHandles.throwException(returnType, exType); return debug(mh, "throwException", returnType, exType); }
Example 3
Source File: MethodHandleFactory.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
@Override public MethodHandle throwException(final Class<?> returnType, final Class<? extends Throwable> exType) { final MethodHandle mh = MethodHandles.throwException(returnType, exType); return debug(mh, "throwException", returnType, exType); }
Example 4
Source File: MethodHandleFactory.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
@Override public MethodHandle throwException(final Class<?> returnType, final Class<? extends Throwable> exType) { final MethodHandle mh = MethodHandles.throwException(returnType, exType); return debug(mh, "throwException", returnType, exType); }
Example 5
Source File: MethodHandleFactory.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
@Override public MethodHandle throwException(final Class<?> returnType, final Class<? extends Throwable> exType) { final MethodHandle mh = MethodHandles.throwException(returnType, exType); return debug(mh, "throwException", returnType, exType); }
Example 6
Source File: MethodHandleFactory.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
@Override public MethodHandle throwException(final Class<?> returnType, final Class<? extends Throwable> exType) { final MethodHandle mh = MethodHandles.throwException(returnType, exType); return debug(mh, "throwException", returnType, exType); }
Example 7
Source File: MethodHandleFactory.java From hottub with GNU General Public License v2.0 | 4 votes |
@Override public MethodHandle throwException(final Class<?> returnType, final Class<? extends Throwable> exType) { final MethodHandle mh = MethodHandles.throwException(returnType, exType); return debug(mh, "throwException", returnType, exType); }
Example 8
Source File: MethodHandleFactory.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
@Override public MethodHandle throwException(final Class<?> returnType, final Class<? extends Throwable> exType) { return MethodHandles.throwException(returnType, exType); }
Example 9
Source File: MethodHandleFactory.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
@Override public MethodHandle throwException(final Class<?> returnType, final Class<? extends Throwable> exType) { return MethodHandles.throwException(returnType, exType); }
Example 10
Source File: MethodHandleFactory.java From jdk8u_nashorn with GNU General Public License v2.0 | 4 votes |
@Override public MethodHandle throwException(final Class<?> returnType, final Class<? extends Throwable> exType) { final MethodHandle mh = MethodHandles.throwException(returnType, exType); return debug(mh, "throwException", returnType, exType); }
Example 11
Source File: MethodHandleFactory.java From nashorn with GNU General Public License v2.0 | 4 votes |
@Override public MethodHandle throwException(final Class<?> returnType, final Class<? extends Throwable> exType) { return MethodHandles.throwException(returnType, exType); }
Example 12
Source File: Properties.java From es6draft with MIT License | 4 votes |
private static MethodHandle catchExceptions(MethodHandle handle, Converter converter) { MethodHandle thrower = MethodHandles.throwException(handle.type().returnType(), ScriptException.class); thrower = MethodHandles.filterArguments(thrower, 0, converter.toScriptException()); return MethodHandles.catchException(handle, Exception.class, thrower); }