Jeff Hao | 1133db7 | 2016-04-04 19:50:14 -0700 | [diff] [blame] | 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 | |
Neil Fuller | 0e84439 | 2016-09-08 13:43:31 +0100 | [diff] [blame] | 17 | #include "java_lang_reflect_Executable.h" |
Jeff Hao | 1133db7 | 2016-04-04 19:50:14 -0700 | [diff] [blame] | 18 | |
Andreas Gampe | 46ee31b | 2016-12-14 10:11:49 -0800 | [diff] [blame] | 19 | #include "android-base/stringprintf.h" |
Andreas Gampe | a14100c | 2017-04-24 15:09:56 -0700 | [diff] [blame] | 20 | #include "nativehelper/jni_macros.h" |
Andreas Gampe | 46ee31b | 2016-12-14 10:11:49 -0800 | [diff] [blame] | 21 | |
Jeff Hao | 1133db7 | 2016-04-04 19:50:14 -0700 | [diff] [blame] | 22 | #include "art_method-inl.h" |
David Sehr | 9323e6e | 2016-09-13 08:58:35 -0700 | [diff] [blame] | 23 | #include "dex_file_annotations.h" |
Neil Fuller | 79a21e7 | 2016-09-09 14:24:51 +0100 | [diff] [blame] | 24 | #include "handle.h" |
Jeff Hao | 1133db7 | 2016-04-04 19:50:14 -0700 | [diff] [blame] | 25 | #include "jni_internal.h" |
| 26 | #include "mirror/class-inl.h" |
Neil Fuller | 79a21e7 | 2016-09-09 14:24:51 +0100 | [diff] [blame] | 27 | #include "mirror/method.h" |
Jeff Hao | 1133db7 | 2016-04-04 19:50:14 -0700 | [diff] [blame] | 28 | #include "mirror/object-inl.h" |
| 29 | #include "mirror/object_array-inl.h" |
| 30 | #include "reflection.h" |
Mathieu Chartier | 0795f23 | 2016-09-27 18:43:30 -0700 | [diff] [blame] | 31 | #include "scoped_fast_native_object_access-inl.h" |
Jeff Hao | 1133db7 | 2016-04-04 19:50:14 -0700 | [diff] [blame] | 32 | #include "well_known_classes.h" |
| 33 | |
| 34 | namespace art { |
| 35 | |
Andreas Gampe | 46ee31b | 2016-12-14 10:11:49 -0800 | [diff] [blame] | 36 | using android::base::StringPrintf; |
| 37 | |
Neil Fuller | 0e84439 | 2016-09-08 13:43:31 +0100 | [diff] [blame] | 38 | static jobjectArray Executable_getDeclaredAnnotationsNative(JNIEnv* env, jobject javaMethod) { |
Jeff Hao | 1133db7 | 2016-04-04 19:50:14 -0700 | [diff] [blame] | 39 | ScopedFastNativeObjectAccess soa(env); |
| 40 | ArtMethod* method = ArtMethod::FromReflectedMethod(soa, javaMethod); |
| 41 | if (method->GetDeclaringClass()->IsProxyClass()) { |
| 42 | // Return an empty array instead of a null pointer. |
Mathieu Chartier | 0795f23 | 2016-09-27 18:43:30 -0700 | [diff] [blame] | 43 | ObjPtr<mirror::Class> annotation_array_class = |
| 44 | soa.Decode<mirror::Class>(WellKnownClasses::java_lang_annotation_Annotation__array); |
| 45 | ObjPtr<mirror::ObjectArray<mirror::Object>> empty_array = |
Mathieu Chartier | 1a5337f | 2016-10-13 13:48:23 -0700 | [diff] [blame] | 46 | mirror::ObjectArray<mirror::Object>::Alloc(soa.Self(), annotation_array_class, 0); |
Jeff Hao | 1133db7 | 2016-04-04 19:50:14 -0700 | [diff] [blame] | 47 | return soa.AddLocalReference<jobjectArray>(empty_array); |
| 48 | } |
David Sehr | 9323e6e | 2016-09-13 08:58:35 -0700 | [diff] [blame] | 49 | return soa.AddLocalReference<jobjectArray>(annotations::GetAnnotationsForMethod(method)); |
Jeff Hao | 1133db7 | 2016-04-04 19:50:14 -0700 | [diff] [blame] | 50 | } |
| 51 | |
Neil Fuller | 0e84439 | 2016-09-08 13:43:31 +0100 | [diff] [blame] | 52 | static jobject Executable_getAnnotationNative(JNIEnv* env, |
Neil Fuller | 79a21e7 | 2016-09-09 14:24:51 +0100 | [diff] [blame] | 53 | jobject javaMethod, |
| 54 | jclass annotationType) { |
Neil Fuller | 16b21cd | 2016-08-12 09:37:02 +0100 | [diff] [blame] | 55 | ScopedFastNativeObjectAccess soa(env); |
| 56 | StackHandleScope<1> hs(soa.Self()); |
| 57 | ArtMethod* method = ArtMethod::FromReflectedMethod(soa, javaMethod); |
| 58 | if (method->IsProxyMethod()) { |
| 59 | return nullptr; |
| 60 | } else { |
Mathieu Chartier | 0795f23 | 2016-09-27 18:43:30 -0700 | [diff] [blame] | 61 | Handle<mirror::Class> klass(hs.NewHandle(soa.Decode<mirror::Class>(annotationType))); |
David Sehr | 9323e6e | 2016-09-13 08:58:35 -0700 | [diff] [blame] | 62 | return soa.AddLocalReference<jobject>(annotations::GetAnnotationForMethod(method, klass)); |
Neil Fuller | 16b21cd | 2016-08-12 09:37:02 +0100 | [diff] [blame] | 63 | } |
| 64 | } |
| 65 | |
Neil Fuller | 0e84439 | 2016-09-08 13:43:31 +0100 | [diff] [blame] | 66 | static jobjectArray Executable_getSignatureAnnotation(JNIEnv* env, jobject javaMethod) { |
Jeff Hao | 1133db7 | 2016-04-04 19:50:14 -0700 | [diff] [blame] | 67 | ScopedFastNativeObjectAccess soa(env); |
| 68 | ArtMethod* method = ArtMethod::FromReflectedMethod(soa, javaMethod); |
| 69 | if (method->GetDeclaringClass()->IsProxyClass()) { |
| 70 | return nullptr; |
| 71 | } |
| 72 | StackHandleScope<1> hs(soa.Self()); |
David Sehr | 9323e6e | 2016-09-13 08:58:35 -0700 | [diff] [blame] | 73 | return soa.AddLocalReference<jobjectArray>(annotations::GetSignatureAnnotationForMethod(method)); |
Jeff Hao | 1133db7 | 2016-04-04 19:50:14 -0700 | [diff] [blame] | 74 | } |
| 75 | |
| 76 | |
Neil Fuller | 0e84439 | 2016-09-08 13:43:31 +0100 | [diff] [blame] | 77 | static jobjectArray Executable_getParameterAnnotationsNative(JNIEnv* env, jobject javaMethod) { |
Neil Fuller | 16b21cd | 2016-08-12 09:37:02 +0100 | [diff] [blame] | 78 | ScopedFastNativeObjectAccess soa(env); |
| 79 | ArtMethod* method = ArtMethod::FromReflectedMethod(soa, javaMethod); |
| 80 | if (method->IsProxyMethod()) { |
| 81 | return nullptr; |
| 82 | } else { |
David Sehr | 9323e6e | 2016-09-13 08:58:35 -0700 | [diff] [blame] | 83 | return soa.AddLocalReference<jobjectArray>(annotations::GetParameterAnnotations(method)); |
Neil Fuller | 16b21cd | 2016-08-12 09:37:02 +0100 | [diff] [blame] | 84 | } |
| 85 | } |
| 86 | |
Neil Fuller | 79a21e7 | 2016-09-09 14:24:51 +0100 | [diff] [blame] | 87 | static jobjectArray Executable_getParameters0(JNIEnv* env, jobject javaMethod) { |
| 88 | ScopedFastNativeObjectAccess soa(env); |
| 89 | Thread* self = soa.Self(); |
| 90 | StackHandleScope<8> hs(self); |
| 91 | |
Mathieu Chartier | 0795f23 | 2016-09-27 18:43:30 -0700 | [diff] [blame] | 92 | Handle<mirror::Method> executable = hs.NewHandle(soa.Decode<mirror::Method>(javaMethod)); |
Neil Fuller | 79a21e7 | 2016-09-09 14:24:51 +0100 | [diff] [blame] | 93 | ArtMethod* art_method = executable.Get()->GetArtMethod(); |
| 94 | if (art_method->GetDeclaringClass()->IsProxyClass()) { |
| 95 | return nullptr; |
| 96 | } |
| 97 | |
| 98 | // Find the MethodParameters system annotation. |
| 99 | MutableHandle<mirror::ObjectArray<mirror::String>> names = |
| 100 | hs.NewHandle<mirror::ObjectArray<mirror::String>>(nullptr); |
| 101 | MutableHandle<mirror::IntArray> access_flags = hs.NewHandle<mirror::IntArray>(nullptr); |
| 102 | if (!annotations::GetParametersMetadataForMethod(art_method, &names, &access_flags)) { |
| 103 | return nullptr; |
| 104 | } |
| 105 | |
| 106 | // Validate the MethodParameters system annotation data. |
Andreas Gampe | fa4333d | 2017-02-14 11:10:34 -0800 | [diff] [blame] | 107 | if (UNLIKELY(names == nullptr || access_flags == nullptr)) { |
Neil Fuller | 79a21e7 | 2016-09-09 14:24:51 +0100 | [diff] [blame] | 108 | ThrowIllegalArgumentException( |
| 109 | StringPrintf("Missing parameter metadata for names or access flags for %s", |
David Sehr | 709b070 | 2016-10-13 09:12:37 -0700 | [diff] [blame] | 110 | art_method->PrettyMethod().c_str()).c_str()); |
Neil Fuller | 79a21e7 | 2016-09-09 14:24:51 +0100 | [diff] [blame] | 111 | return nullptr; |
| 112 | } |
| 113 | |
| 114 | // Check array sizes match each other |
| 115 | int32_t names_count = names.Get()->GetLength(); |
| 116 | int32_t access_flags_count = access_flags.Get()->GetLength(); |
| 117 | if (names_count != access_flags_count) { |
| 118 | ThrowIllegalArgumentException( |
| 119 | StringPrintf( |
| 120 | "Inconsistent parameter metadata for %s. names length: %d, access flags length: %d", |
David Sehr | 709b070 | 2016-10-13 09:12:37 -0700 | [diff] [blame] | 121 | art_method->PrettyMethod().c_str(), |
Neil Fuller | 79a21e7 | 2016-09-09 14:24:51 +0100 | [diff] [blame] | 122 | names_count, |
| 123 | access_flags_count).c_str()); |
| 124 | return nullptr; |
| 125 | } |
| 126 | |
| 127 | // Instantiate a Parameter[] to hold the result. |
| 128 | Handle<mirror::Class> parameter_array_class = |
| 129 | hs.NewHandle( |
Mathieu Chartier | 0795f23 | 2016-09-27 18:43:30 -0700 | [diff] [blame] | 130 | soa.Decode<mirror::Class>(WellKnownClasses::java_lang_reflect_Parameter__array)); |
Neil Fuller | 79a21e7 | 2016-09-09 14:24:51 +0100 | [diff] [blame] | 131 | Handle<mirror::ObjectArray<mirror::Object>> parameter_array = |
| 132 | hs.NewHandle( |
| 133 | mirror::ObjectArray<mirror::Object>::Alloc(self, |
| 134 | parameter_array_class.Get(), |
| 135 | names_count)); |
Andreas Gampe | fa4333d | 2017-02-14 11:10:34 -0800 | [diff] [blame] | 136 | if (UNLIKELY(parameter_array == nullptr)) { |
Neil Fuller | 79a21e7 | 2016-09-09 14:24:51 +0100 | [diff] [blame] | 137 | self->AssertPendingException(); |
| 138 | return nullptr; |
| 139 | } |
| 140 | |
| 141 | Handle<mirror::Class> parameter_class = |
Mathieu Chartier | 0795f23 | 2016-09-27 18:43:30 -0700 | [diff] [blame] | 142 | hs.NewHandle(soa.Decode<mirror::Class>(WellKnownClasses::java_lang_reflect_Parameter)); |
Neil Fuller | 79a21e7 | 2016-09-09 14:24:51 +0100 | [diff] [blame] | 143 | ArtMethod* parameter_init = |
Andreas Gampe | 13b2784 | 2016-11-07 16:48:23 -0800 | [diff] [blame] | 144 | jni::DecodeArtMethod(WellKnownClasses::java_lang_reflect_Parameter_init); |
Neil Fuller | 79a21e7 | 2016-09-09 14:24:51 +0100 | [diff] [blame] | 145 | |
| 146 | // Mutable handles used in the loop below to ensure cleanup without scaling the number of |
| 147 | // handles by the number of parameters. |
| 148 | MutableHandle<mirror::String> name = hs.NewHandle<mirror::String>(nullptr); |
| 149 | MutableHandle<mirror::Object> parameter = hs.NewHandle<mirror::Object>(nullptr); |
| 150 | |
| 151 | // Populate the Parameter[] to return. |
| 152 | for (int32_t parameter_index = 0; parameter_index < names_count; parameter_index++) { |
| 153 | name.Assign(names.Get()->Get(parameter_index)); |
| 154 | int32_t modifiers = access_flags.Get()->Get(parameter_index); |
| 155 | |
| 156 | // Allocate / initialize the Parameter to add to parameter_array. |
| 157 | parameter.Assign(parameter_class->AllocObject(self)); |
Andreas Gampe | fa4333d | 2017-02-14 11:10:34 -0800 | [diff] [blame] | 158 | if (UNLIKELY(parameter == nullptr)) { |
Neil Fuller | 79a21e7 | 2016-09-09 14:24:51 +0100 | [diff] [blame] | 159 | self->AssertPendingOOMException(); |
| 160 | return nullptr; |
| 161 | } |
| 162 | |
| 163 | uint32_t args[5] = { PointerToLowMemUInt32(parameter.Get()), |
| 164 | PointerToLowMemUInt32(name.Get()), |
| 165 | static_cast<uint32_t>(modifiers), |
| 166 | PointerToLowMemUInt32(executable.Get()), |
| 167 | static_cast<uint32_t>(parameter_index) |
| 168 | }; |
| 169 | JValue result; |
| 170 | static const char* method_signature = "VLILI"; // return + parameter types |
| 171 | parameter_init->Invoke(self, args, sizeof(args), &result, method_signature); |
| 172 | if (UNLIKELY(self->IsExceptionPending())) { |
| 173 | return nullptr; |
| 174 | } |
| 175 | |
| 176 | // Store the Parameter in the Parameter[]. |
| 177 | parameter_array.Get()->Set(parameter_index, parameter.Get()); |
| 178 | if (UNLIKELY(self->IsExceptionPending())) { |
| 179 | return nullptr; |
| 180 | } |
| 181 | } |
| 182 | return soa.AddLocalReference<jobjectArray>(parameter_array.Get()); |
| 183 | } |
| 184 | |
Neil Fuller | 0e84439 | 2016-09-08 13:43:31 +0100 | [diff] [blame] | 185 | static jboolean Executable_isAnnotationPresentNative(JNIEnv* env, |
Neil Fuller | 79a21e7 | 2016-09-09 14:24:51 +0100 | [diff] [blame] | 186 | jobject javaMethod, |
| 187 | jclass annotationType) { |
Jeff Hao | 1133db7 | 2016-04-04 19:50:14 -0700 | [diff] [blame] | 188 | ScopedFastNativeObjectAccess soa(env); |
| 189 | ArtMethod* method = ArtMethod::FromReflectedMethod(soa, javaMethod); |
| 190 | if (method->GetDeclaringClass()->IsProxyClass()) { |
| 191 | return false; |
| 192 | } |
| 193 | StackHandleScope<1> hs(soa.Self()); |
Mathieu Chartier | 0795f23 | 2016-09-27 18:43:30 -0700 | [diff] [blame] | 194 | Handle<mirror::Class> klass(hs.NewHandle(soa.Decode<mirror::Class>(annotationType))); |
David Sehr | 9323e6e | 2016-09-13 08:58:35 -0700 | [diff] [blame] | 195 | return annotations::IsMethodAnnotationPresent(method, klass); |
Jeff Hao | 1133db7 | 2016-04-04 19:50:14 -0700 | [diff] [blame] | 196 | } |
| 197 | |
Narayan Kamath | 6b2dc31 | 2017-03-14 13:26:12 +0000 | [diff] [blame] | 198 | static jint Executable_compareMethodParametersInternal(JNIEnv* env, |
| 199 | jobject thisMethod, |
| 200 | jobject otherMethod) { |
| 201 | ScopedFastNativeObjectAccess soa(env); |
| 202 | ArtMethod* this_method = ArtMethod::FromReflectedMethod(soa, thisMethod); |
| 203 | ArtMethod* other_method = ArtMethod::FromReflectedMethod(soa, otherMethod); |
| 204 | |
| 205 | this_method = this_method->GetInterfaceMethodIfProxy(kRuntimePointerSize); |
| 206 | other_method = other_method->GetInterfaceMethodIfProxy(kRuntimePointerSize); |
| 207 | |
| 208 | const DexFile::TypeList* this_list = this_method->GetParameterTypeList(); |
| 209 | const DexFile::TypeList* other_list = other_method->GetParameterTypeList(); |
| 210 | |
| 211 | if (this_list == other_list) { |
| 212 | return 0; |
| 213 | } |
| 214 | |
| 215 | if (this_list == nullptr && other_list != nullptr) { |
| 216 | return -1; |
| 217 | } |
| 218 | |
| 219 | if (other_list == nullptr && this_list != nullptr) { |
| 220 | return 1; |
| 221 | } |
| 222 | |
| 223 | const int32_t this_size = this_list->Size(); |
| 224 | const int32_t other_size = other_list->Size(); |
| 225 | |
| 226 | if (this_size != other_size) { |
| 227 | return (this_size - other_size); |
| 228 | } |
| 229 | |
| 230 | for (int32_t i = 0; i < this_size; ++i) { |
| 231 | const DexFile::TypeId& lhs = this_method->GetDexFile()->GetTypeId( |
| 232 | this_list->GetTypeItem(i).type_idx_); |
| 233 | const DexFile::TypeId& rhs = other_method->GetDexFile()->GetTypeId( |
| 234 | other_list->GetTypeItem(i).type_idx_); |
| 235 | |
| 236 | uint32_t lhs_len, rhs_len; |
| 237 | const char* lhs_data = this_method->GetDexFile()->StringDataAndUtf16LengthByIdx( |
| 238 | lhs.descriptor_idx_, &lhs_len); |
| 239 | const char* rhs_data = other_method->GetDexFile()->StringDataAndUtf16LengthByIdx( |
| 240 | rhs.descriptor_idx_, &rhs_len); |
| 241 | |
| 242 | int cmp = strcmp(lhs_data, rhs_data); |
| 243 | if (cmp != 0) { |
| 244 | return (cmp < 0) ? -1 : 1; |
| 245 | } |
| 246 | } |
| 247 | |
| 248 | return 0; |
| 249 | } |
| 250 | |
| 251 | static jobject Executable_getMethodNameInternal(JNIEnv* env, jobject javaMethod) { |
| 252 | ScopedFastNativeObjectAccess soa(env); |
| 253 | ArtMethod* method = ArtMethod::FromReflectedMethod(soa, javaMethod); |
| 254 | method = method->GetInterfaceMethodIfProxy(kRuntimePointerSize); |
| 255 | return soa.AddLocalReference<jobject>(method->GetNameAsString(soa.Self())); |
| 256 | } |
| 257 | |
| 258 | static jobject Executable_getMethodReturnTypeInternal(JNIEnv* env, jobject javaMethod) { |
| 259 | ScopedFastNativeObjectAccess soa(env); |
| 260 | ArtMethod* method = ArtMethod::FromReflectedMethod(soa, javaMethod); |
| 261 | method = method->GetInterfaceMethodIfProxy(kRuntimePointerSize); |
| 262 | ObjPtr<mirror::Class> return_type(method->GetReturnType(true /* resolve */)); |
| 263 | if (return_type.IsNull()) { |
| 264 | CHECK(soa.Self()->IsExceptionPending()); |
| 265 | return nullptr; |
| 266 | } |
| 267 | |
| 268 | return soa.AddLocalReference<jobject>(return_type); |
| 269 | } |
| 270 | |
| 271 | // TODO: Move this to mirror::Class ? Other mirror types that commonly appear |
| 272 | // as arrays have a GetArrayClass() method. This is duplicated in |
| 273 | // java_lang_Class.cc as well. |
| 274 | static ObjPtr<mirror::Class> GetClassArrayClass(Thread* self) |
| 275 | REQUIRES_SHARED(Locks::mutator_lock_) { |
| 276 | ObjPtr<mirror::Class> class_class = mirror::Class::GetJavaLangClass(); |
| 277 | return Runtime::Current()->GetClassLinker()->FindArrayClass(self, &class_class); |
| 278 | } |
| 279 | |
| 280 | static jobjectArray Executable_getParameterTypesInternal(JNIEnv* env, jobject javaMethod) { |
| 281 | ScopedFastNativeObjectAccess soa(env); |
| 282 | ArtMethod* method = ArtMethod::FromReflectedMethod(soa, javaMethod); |
| 283 | method = method->GetInterfaceMethodIfProxy(kRuntimePointerSize); |
| 284 | |
| 285 | const DexFile::TypeList* params = method->GetParameterTypeList(); |
| 286 | if (params == nullptr) { |
| 287 | return nullptr; |
| 288 | } |
| 289 | |
| 290 | const uint32_t num_params = params->Size(); |
| 291 | |
| 292 | StackHandleScope<3> hs(soa.Self()); |
| 293 | Handle<mirror::Class> class_array_class = hs.NewHandle(GetClassArrayClass(soa.Self())); |
| 294 | Handle<mirror::ObjectArray<mirror::Class>> ptypes = hs.NewHandle( |
| 295 | mirror::ObjectArray<mirror::Class>::Alloc(soa.Self(), class_array_class.Get(), num_params)); |
| 296 | if (ptypes.IsNull()) { |
| 297 | DCHECK(soa.Self()->IsExceptionPending()); |
| 298 | return nullptr; |
| 299 | } |
| 300 | |
| 301 | MutableHandle<mirror::Class> param(hs.NewHandle<mirror::Class>(nullptr)); |
| 302 | for (uint32_t i = 0; i < num_params; ++i) { |
| 303 | const dex::TypeIndex type_idx = params->GetTypeItem(i).type_idx_; |
| 304 | param.Assign(Runtime::Current()->GetClassLinker()->ResolveType(type_idx, method)); |
| 305 | if (param.Get() == nullptr) { |
| 306 | DCHECK(soa.Self()->IsExceptionPending()); |
| 307 | return nullptr; |
| 308 | } |
| 309 | ptypes->SetWithoutChecks<false>(i, param.Get()); |
| 310 | } |
| 311 | |
| 312 | return soa.AddLocalReference<jobjectArray>(ptypes.Get()); |
| 313 | } |
| 314 | |
| 315 | static jint Executable_getParameterCountInternal(JNIEnv* env, jobject javaMethod) { |
| 316 | ScopedFastNativeObjectAccess soa(env); |
| 317 | ArtMethod* method = ArtMethod::FromReflectedMethod(soa, javaMethod); |
| 318 | method = method->GetInterfaceMethodIfProxy(kRuntimePointerSize); |
| 319 | |
| 320 | const DexFile::TypeList* params = method->GetParameterTypeList(); |
| 321 | return (params == nullptr) ? 0 : params->Size(); |
| 322 | } |
| 323 | |
| 324 | |
Jeff Hao | 1133db7 | 2016-04-04 19:50:14 -0700 | [diff] [blame] | 325 | static JNINativeMethod gMethods[] = { |
Narayan Kamath | 6b2dc31 | 2017-03-14 13:26:12 +0000 | [diff] [blame] | 326 | FAST_NATIVE_METHOD(Executable, compareMethodParametersInternal, |
| 327 | "(Ljava/lang/reflect/Method;)I"), |
Igor Murashkin | 3b6f440 | 2017-02-16 16:13:17 -0800 | [diff] [blame] | 328 | FAST_NATIVE_METHOD(Executable, getAnnotationNative, |
Narayan Kamath | 6b2dc31 | 2017-03-14 13:26:12 +0000 | [diff] [blame] | 329 | "(Ljava/lang/Class;)Ljava/lang/annotation/Annotation;"), |
| 330 | FAST_NATIVE_METHOD(Executable, getDeclaredAnnotationsNative, |
| 331 | "()[Ljava/lang/annotation/Annotation;"), |
Igor Murashkin | 3b6f440 | 2017-02-16 16:13:17 -0800 | [diff] [blame] | 332 | FAST_NATIVE_METHOD(Executable, getParameterAnnotationsNative, |
Narayan Kamath | 6b2dc31 | 2017-03-14 13:26:12 +0000 | [diff] [blame] | 333 | "()[[Ljava/lang/annotation/Annotation;"), |
| 334 | FAST_NATIVE_METHOD(Executable, getMethodNameInternal, "()Ljava/lang/String;"), |
| 335 | FAST_NATIVE_METHOD(Executable, getMethodReturnTypeInternal, "()Ljava/lang/Class;"), |
| 336 | FAST_NATIVE_METHOD(Executable, getParameterTypesInternal, "()[Ljava/lang/Class;"), |
| 337 | FAST_NATIVE_METHOD(Executable, getParameterCountInternal, "()I"), |
Igor Murashkin | 3b6f440 | 2017-02-16 16:13:17 -0800 | [diff] [blame] | 338 | FAST_NATIVE_METHOD(Executable, getParameters0, "()[Ljava/lang/reflect/Parameter;"), |
| 339 | FAST_NATIVE_METHOD(Executable, getSignatureAnnotation, "()[Ljava/lang/String;"), |
| 340 | FAST_NATIVE_METHOD(Executable, isAnnotationPresentNative, "(Ljava/lang/Class;)Z"), |
Jeff Hao | 1133db7 | 2016-04-04 19:50:14 -0700 | [diff] [blame] | 341 | }; |
| 342 | |
Neil Fuller | 0e84439 | 2016-09-08 13:43:31 +0100 | [diff] [blame] | 343 | void register_java_lang_reflect_Executable(JNIEnv* env) { |
| 344 | REGISTER_NATIVE_METHODS("java/lang/reflect/Executable"); |
Jeff Hao | 1133db7 | 2016-04-04 19:50:14 -0700 | [diff] [blame] | 345 | } |
| 346 | |
| 347 | } // namespace art |