Freigeben über


MethodHandles.ThrowException(Class, Class) Method

Definition

Produces a method handle which will throw exceptions of the given exType.

[Android.Runtime.Register("throwException", "(Ljava/lang/Class;Ljava/lang/Class;)Ljava/lang/invoke/MethodHandle;", "", ApiSince=26)]
public static Java.Lang.Invoke.MethodHandle? ThrowException (Java.Lang.Class? returnType, Java.Lang.Class? exType);
[<Android.Runtime.Register("throwException", "(Ljava/lang/Class;Ljava/lang/Class;)Ljava/lang/invoke/MethodHandle;", "", ApiSince=26)>]
static member ThrowException : Java.Lang.Class * Java.Lang.Class -> Java.Lang.Invoke.MethodHandle

Parameters

returnType
Class

the return type of the desired method handle

exType
Class

the parameter type of the desired method handle

Returns

method handle which can throw the given exceptions

Attributes

Remarks

Produces a method handle which will throw exceptions of the given exType. The method handle will accept a single argument of exType, and immediately throw it as an exception. The method type will nominally specify a return of returnType. The return type may be anything convenient: It doesn't matter to the method handle's behavior, since it will never return normally.

Java documentation for java.lang.invoke.MethodHandles.throwException(java.lang.Class<?>, java.lang.Class<? extends java.lang.Throwable>).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to