1 /*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #include <nativehelper/JniConstants.h>
18 #include <nativehelper/JNIHelp.h>
19
MethodHandle_invokeExact(JNIEnv * env,jobject,jobjectArray)20 static void MethodHandle_invokeExact(JNIEnv* env, jobject, jobjectArray) {
21 jniThrowException(env, "java/lang/UnsupportedOperationException",
22 "MethodHandle.invokeExact cannot be invoked reflectively.");
23 }
24
MethodHandle_invoke(JNIEnv * env,jobject,jobjectArray)25 static void MethodHandle_invoke(JNIEnv* env, jobject, jobjectArray) {
26 jniThrowException(env, "java/lang/UnsupportedOperationException",
27 "MethodHandle.invoke cannot be invoked reflectively.");
28 }
29
30 static JNINativeMethod gMethods[] = {
31 NATIVE_METHOD(MethodHandle, invokeExact, "([Ljava/lang/Object;)Ljava/lang/Object;"),
32 NATIVE_METHOD(MethodHandle, invoke, "([Ljava/lang/Object;)Ljava/lang/Object;"),
33 };
34
register_java_lang_invoke_MethodHandle(JNIEnv * env)35 void register_java_lang_invoke_MethodHandle(JNIEnv* env) {
36 jniRegisterNativeMethods(env, "java/lang/invoke/MethodHandle", gMethods, NELEM(gMethods));
37 }
38