blob: 7cc41664a38ad52ddc08c5e4e4a179bd168004b7 [file] [log] [blame]
Brian Carlstromf867b6f2011-09-16 12:17:25 -07001/*
2 * Copyright (C) 2008 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 "jni_internal.h"
18#include "class_linker.h"
19#include "object.h"
Ian Rogers6d4d9fc2011-11-30 16:24:48 -080020#include "object_utils.h"
Elliott Hughes418d20f2011-09-22 14:00:39 -070021#include "reflection.h"
Brian Carlstromf867b6f2011-09-16 12:17:25 -070022
23#include "JniConstants.h" // Last to avoid problems with LOG redefinition.
24
25namespace art {
26
Elliott Hughes0512f022012-03-15 22:10:52 -070027static bool GetFieldValue(Object* o, Field* f, JValue& value, bool allow_references) {
Ian Rogersd8a68a62012-04-11 14:39:38 -070028 DCHECK_EQ(value.j, 0LL);
Elliott Hughes34e06962012-04-09 13:55:55 -070029 ScopedThreadStateChange tsc(Thread::Current(), kRunnable);
Ian Rogers0045a292012-03-31 21:08:41 -070030 if (!Runtime::Current()->GetClassLinker()->EnsureInitialized(f->GetDeclaringClass(), true, true)) {
Elliott Hughes923e8b82012-03-23 11:44:07 -070031 return false;
32 }
Ian Rogers6d4d9fc2011-11-30 16:24:48 -080033 switch (FieldHelper(f).GetTypeAsPrimitiveType()) {
Brian Carlstrom6b4ef022011-10-23 14:59:04 -070034 case Primitive::kPrimBoolean:
Elliott Hughes33203b52011-09-20 19:42:01 -070035 value.z = f->GetBoolean(o);
36 return true;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -070037 case Primitive::kPrimByte:
Ian Rogersd8a68a62012-04-11 14:39:38 -070038 // Read byte and ensure it is fully sign-extended to an int.
39 value.i = ((int32_t)f->GetByte(o) << 24) >> 24;
Elliott Hughes33203b52011-09-20 19:42:01 -070040 return true;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -070041 case Primitive::kPrimChar:
Elliott Hughes33203b52011-09-20 19:42:01 -070042 value.c = f->GetChar(o);
43 return true;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -070044 case Primitive::kPrimDouble:
Elliott Hughes33203b52011-09-20 19:42:01 -070045 value.d = f->GetDouble(o);
46 return true;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -070047 case Primitive::kPrimFloat:
Elliott Hughes33203b52011-09-20 19:42:01 -070048 value.f = f->GetFloat(o);
49 return true;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -070050 case Primitive::kPrimInt:
Elliott Hughes33203b52011-09-20 19:42:01 -070051 value.i = f->GetInt(o);
52 return true;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -070053 case Primitive::kPrimLong:
Elliott Hughes33203b52011-09-20 19:42:01 -070054 value.j = f->GetLong(o);
55 return true;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -070056 case Primitive::kPrimShort:
Ian Rogersd8a68a62012-04-11 14:39:38 -070057 // Read short and ensure it is fully sign-extended to an int.
58 value.i = ((int32_t)f->GetShort(o) << 16) >> 16;
Elliott Hughes33203b52011-09-20 19:42:01 -070059 return true;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -070060 case Primitive::kPrimNot:
Elliott Hughes33203b52011-09-20 19:42:01 -070061 if (allow_references) {
62 value.l = f->GetObject(o);
63 return true;
64 }
65 // Else break to report an error.
66 break;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -070067 case Primitive::kPrimVoid:
Elliott Hughes33203b52011-09-20 19:42:01 -070068 // Never okay.
69 break;
70 }
Elliott Hughes5cb5ad22011-10-02 12:13:39 -070071 Thread::Current()->ThrowNewExceptionF("Ljava/lang/IllegalArgumentException;",
Elliott Hughes33203b52011-09-20 19:42:01 -070072 "Not a primitive field: %s", PrettyField(f).c_str());
73 return false;
74}
75
Elliott Hughes0512f022012-03-15 22:10:52 -070076static bool CheckReceiver(JNIEnv* env, jobject javaObj, Field* f, Object*& o) {
Elliott Hughesed1c1e32011-10-02 14:31:05 -070077 if (f->IsStatic()) {
78 o = NULL;
79 return true;
80 }
81
82 o = Decode<Object*>(env, javaObj);
Ian Rogers6d4d9fc2011-11-30 16:24:48 -080083 Class* declaringClass = f->GetDeclaringClass();
Elliott Hughesed1c1e32011-10-02 14:31:05 -070084 if (!VerifyObjectInClass(env, o, declaringClass)) {
85 return false;
86 }
87 return true;
88}
89
Elliott Hughes0512f022012-03-15 22:10:52 -070090static jobject Field_get(JNIEnv* env, jobject javaField, jobject javaObj) {
Elliott Hughes418d20f2011-09-22 14:00:39 -070091 Field* f = DecodeField(env->FromReflectedField(javaField));
Elliott Hughesed1c1e32011-10-02 14:31:05 -070092 Object* o = NULL;
Ian Rogers6d4d9fc2011-11-30 16:24:48 -080093 if (!CheckReceiver(env, javaObj, f, o)) {
94 return NULL;
95 }
96
97 // Get the field's value, boxing if necessary.
Elliott Hughes1d878f32012-04-11 15:17:54 -070098 JValue value;
Ian Rogers6d4d9fc2011-11-30 16:24:48 -080099 if (!GetFieldValue(o, f, value, true)) {
100 return NULL;
101 }
Elliott Hughesdbac3092012-03-16 18:00:30 -0700102 BoxPrimitive(FieldHelper(f).GetTypeAsPrimitiveType(), value);
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800103
104 return AddLocalReference<jobject>(env, value.l);
105}
106
Elliott Hughes0512f022012-03-15 22:10:52 -0700107static JValue GetPrimitiveField(JNIEnv* env, jobject javaField, jobject javaObj, char dst_descriptor) {
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800108 Field* f = DecodeField(env->FromReflectedField(javaField));
109 Object* o = NULL;
110 if (!CheckReceiver(env, javaObj, f, o)) {
Elliott Hughesed1c1e32011-10-02 14:31:05 -0700111 return JValue();
Elliott Hughes33203b52011-09-20 19:42:01 -0700112 }
113
114 // Read the value.
Elliott Hughes1d878f32012-04-11 15:17:54 -0700115 JValue field_value;
Elliott Hughes33203b52011-09-20 19:42:01 -0700116 if (!GetFieldValue(o, f, field_value, false)) {
117 return JValue();
118 }
119
120 // Widen it if necessary (and possible).
121 JValue wide_value;
Elliott Hughes582a7d12011-10-10 18:38:42 -0700122 Class* dst_type = Runtime::Current()->GetClassLinker()->FindPrimitiveClass(dst_descriptor);
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800123 if (!ConvertPrimitiveValue(FieldHelper(f).GetTypeAsPrimitiveType(), dst_type->GetPrimitiveType(),
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700124 field_value, wide_value)) {
Elliott Hughes33203b52011-09-20 19:42:01 -0700125 return JValue();
126 }
127 return wide_value;
128}
129
Elliott Hughes0512f022012-03-15 22:10:52 -0700130static jboolean Field_getBoolean(JNIEnv* env, jobject javaField, jobject javaObj) {
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800131 return GetPrimitiveField(env, javaField, javaObj, 'Z').z;
Elliott Hughes33203b52011-09-20 19:42:01 -0700132}
133
Elliott Hughes0512f022012-03-15 22:10:52 -0700134static jbyte Field_getByte(JNIEnv* env, jobject javaField, jobject javaObj) {
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800135 return GetPrimitiveField(env, javaField, javaObj, 'B').b;
Elliott Hughes33203b52011-09-20 19:42:01 -0700136}
137
Elliott Hughes0512f022012-03-15 22:10:52 -0700138static jchar Field_getChar(JNIEnv* env, jobject javaField, jobject javaObj) {
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800139 return GetPrimitiveField(env, javaField, javaObj, 'C').c;
Elliott Hughes33203b52011-09-20 19:42:01 -0700140}
141
Elliott Hughes0512f022012-03-15 22:10:52 -0700142static jdouble Field_getDouble(JNIEnv* env, jobject javaField, jobject javaObj) {
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800143 return GetPrimitiveField(env, javaField, javaObj, 'D').d;
Elliott Hughes33203b52011-09-20 19:42:01 -0700144}
145
Elliott Hughes0512f022012-03-15 22:10:52 -0700146static jfloat Field_getFloat(JNIEnv* env, jobject javaField, jobject javaObj) {
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800147 return GetPrimitiveField(env, javaField, javaObj, 'F').f;
Elliott Hughes33203b52011-09-20 19:42:01 -0700148}
149
Elliott Hughes0512f022012-03-15 22:10:52 -0700150static jint Field_getInt(JNIEnv* env, jobject javaField, jobject javaObj) {
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800151 return GetPrimitiveField(env, javaField, javaObj, 'I').i;
Elliott Hughes33203b52011-09-20 19:42:01 -0700152}
153
Elliott Hughes0512f022012-03-15 22:10:52 -0700154static jlong Field_getLong(JNIEnv* env, jobject javaField, jobject javaObj) {
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800155 return GetPrimitiveField(env, javaField, javaObj, 'J').j;
Elliott Hughes33203b52011-09-20 19:42:01 -0700156}
157
Elliott Hughes0512f022012-03-15 22:10:52 -0700158static jshort Field_getShort(JNIEnv* env, jobject javaField, jobject javaObj) {
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800159 return GetPrimitiveField(env, javaField, javaObj, 'S').s;
Elliott Hughes33203b52011-09-20 19:42:01 -0700160}
161
Elliott Hughes0512f022012-03-15 22:10:52 -0700162static void SetFieldValue(Object* o, Field* f, const JValue& new_value, bool allow_references) {
Ian Rogers0045a292012-03-31 21:08:41 -0700163 if (!Runtime::Current()->GetClassLinker()->EnsureInitialized(f->GetDeclaringClass(), true, true)) {
Elliott Hughes923e8b82012-03-23 11:44:07 -0700164 return;
165 }
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800166 switch (FieldHelper(f).GetTypeAsPrimitiveType()) {
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700167 case Primitive::kPrimBoolean:
Elliott Hughes33203b52011-09-20 19:42:01 -0700168 f->SetBoolean(o, new_value.z);
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700169 break;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700170 case Primitive::kPrimByte:
Elliott Hughes33203b52011-09-20 19:42:01 -0700171 f->SetByte(o, new_value.b);
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700172 break;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700173 case Primitive::kPrimChar:
Elliott Hughes33203b52011-09-20 19:42:01 -0700174 f->SetChar(o, new_value.c);
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700175 break;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700176 case Primitive::kPrimDouble:
Elliott Hughes33203b52011-09-20 19:42:01 -0700177 f->SetDouble(o, new_value.d);
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700178 break;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700179 case Primitive::kPrimFloat:
Elliott Hughes33203b52011-09-20 19:42:01 -0700180 f->SetFloat(o, new_value.f);
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700181 break;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700182 case Primitive::kPrimInt:
Elliott Hughes33203b52011-09-20 19:42:01 -0700183 f->SetInt(o, new_value.i);
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700184 break;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700185 case Primitive::kPrimLong:
Elliott Hughes33203b52011-09-20 19:42:01 -0700186 f->SetLong(o, new_value.j);
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700187 break;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700188 case Primitive::kPrimShort:
Elliott Hughes33203b52011-09-20 19:42:01 -0700189 f->SetShort(o, new_value.s);
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700190 break;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700191 case Primitive::kPrimNot:
Elliott Hughes33203b52011-09-20 19:42:01 -0700192 if (allow_references) {
193 f->SetObject(o, new_value.l);
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700194 break;
Elliott Hughes33203b52011-09-20 19:42:01 -0700195 }
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700196 // Else fall through to report an error.
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700197 case Primitive::kPrimVoid:
Elliott Hughes33203b52011-09-20 19:42:01 -0700198 // Never okay.
Elliott Hughes5cb5ad22011-10-02 12:13:39 -0700199 Thread::Current()->ThrowNewExceptionF("Ljava/lang/IllegalArgumentException;",
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700200 "Not a primitive field: %s", PrettyField(f).c_str());
201 return;
Elliott Hughes33203b52011-09-20 19:42:01 -0700202 }
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700203
204 // Special handling for final fields on SMP systems.
205 // We need a store/store barrier here (JMM requirement).
206 if (f->IsFinal()) {
207 ANDROID_MEMBAR_STORE();
208 }
Elliott Hughes33203b52011-09-20 19:42:01 -0700209}
210
Elliott Hughes0512f022012-03-15 22:10:52 -0700211static void Field_set(JNIEnv* env, jobject javaField, jobject javaObj, jobject javaValue) {
Elliott Hughes34e06962012-04-09 13:55:55 -0700212 ScopedThreadStateChange tsc(Thread::Current(), kRunnable);
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800213 Field* f = DecodeField(env->FromReflectedField(javaField));
214
215 // Unbox the value, if necessary.
216 Object* boxed_value = Decode<Object*>(env, javaValue);
217 JValue unboxed_value;
Elliott Hughesdbac3092012-03-16 18:00:30 -0700218 if (!UnboxPrimitive(boxed_value, FieldHelper(f).GetType(), unboxed_value, "field")) {
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800219 return;
220 }
221
222 // Check that the receiver is non-null and an instance of the field's declaring class.
223 Object* o = NULL;
224 if (!CheckReceiver(env, javaObj, f, o)) {
225 return;
226 }
227
228 SetFieldValue(o, f, unboxed_value, true);
229}
230
Elliott Hughes0512f022012-03-15 22:10:52 -0700231static void SetPrimitiveField(JNIEnv* env, jobject javaField, jobject javaObj, char src_descriptor,
232 const JValue& new_value) {
Elliott Hughes34e06962012-04-09 13:55:55 -0700233 ScopedThreadStateChange tsc(Thread::Current(), kRunnable);
Elliott Hughes418d20f2011-09-22 14:00:39 -0700234 Field* f = DecodeField(env->FromReflectedField(javaField));
Elliott Hughesed1c1e32011-10-02 14:31:05 -0700235 Object* o = NULL;
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800236 if (!CheckReceiver(env, javaObj, f, o)) {
Elliott Hughesed1c1e32011-10-02 14:31:05 -0700237 return;
Elliott Hughes33203b52011-09-20 19:42:01 -0700238 }
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800239 FieldHelper fh(f);
240 if (!fh.IsPrimitiveType()) {
Jesse Wilsonc129a6b2011-11-24 14:47:46 -0500241 Thread::Current()->ThrowNewExceptionF("Ljava/lang/IllegalArgumentException;",
242 "Not a primitive field: %s", PrettyField(f).c_str());
243 return;
244 }
Elliott Hughes33203b52011-09-20 19:42:01 -0700245
246 // Widen the value if necessary (and possible).
247 JValue wide_value;
Elliott Hughes582a7d12011-10-10 18:38:42 -0700248 Class* src_type = Runtime::Current()->GetClassLinker()->FindPrimitiveClass(src_descriptor);
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800249 if (!ConvertPrimitiveValue(src_type->GetPrimitiveType(), fh.GetTypeAsPrimitiveType(),
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700250 new_value, wide_value)) {
Elliott Hughes33203b52011-09-20 19:42:01 -0700251 return;
252 }
253
254 // Write the value.
255 SetFieldValue(o, f, wide_value, false);
256}
257
Elliott Hughes0512f022012-03-15 22:10:52 -0700258static void Field_setBoolean(JNIEnv* env, jobject javaField, jobject javaObj, jboolean value) {
Elliott Hughes1d878f32012-04-11 15:17:54 -0700259 JValue v;
Elliott Hughes33203b52011-09-20 19:42:01 -0700260 v.z = value;
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800261 SetPrimitiveField(env, javaField, javaObj, 'Z', v);
Elliott Hughes33203b52011-09-20 19:42:01 -0700262}
263
Elliott Hughes0512f022012-03-15 22:10:52 -0700264static void Field_setByte(JNIEnv* env, jobject javaField, jobject javaObj, jbyte value) {
Elliott Hughes1d878f32012-04-11 15:17:54 -0700265 JValue v;
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800266 v.b = value;
267 SetPrimitiveField(env, javaField, javaObj, 'B', v);
Elliott Hughes33203b52011-09-20 19:42:01 -0700268}
269
Elliott Hughes0512f022012-03-15 22:10:52 -0700270static void Field_setChar(JNIEnv* env, jobject javaField, jobject javaObj, jchar value) {
Elliott Hughes1d878f32012-04-11 15:17:54 -0700271 JValue v;
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800272 v.c = value;
273 SetPrimitiveField(env, javaField, javaObj, 'C', v);
274}
Elliott Hughes33203b52011-09-20 19:42:01 -0700275
Elliott Hughes0512f022012-03-15 22:10:52 -0700276static void Field_setDouble(JNIEnv* env, jobject javaField, jobject javaObj, jdouble value) {
Elliott Hughes1d878f32012-04-11 15:17:54 -0700277 JValue v;
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800278 v.d = value;
279 SetPrimitiveField(env, javaField, javaObj, 'D', v);
280}
Elliott Hughes33203b52011-09-20 19:42:01 -0700281
Elliott Hughes0512f022012-03-15 22:10:52 -0700282static void Field_setFloat(JNIEnv* env, jobject javaField, jobject javaObj, jfloat value) {
Elliott Hughes1d878f32012-04-11 15:17:54 -0700283 JValue v;
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800284 v.f = value;
285 SetPrimitiveField(env, javaField, javaObj, 'F', v);
286}
287
Elliott Hughes0512f022012-03-15 22:10:52 -0700288static void Field_setInt(JNIEnv* env, jobject javaField, jobject javaObj, jint value) {
Elliott Hughes1d878f32012-04-11 15:17:54 -0700289 JValue v;
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800290 v.i = value;
291 SetPrimitiveField(env, javaField, javaObj, 'I', v);
292}
293
Elliott Hughes0512f022012-03-15 22:10:52 -0700294static void Field_setLong(JNIEnv* env, jobject javaField, jobject javaObj, jlong value) {
Elliott Hughes1d878f32012-04-11 15:17:54 -0700295 JValue v;
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800296 v.j = value;
297 SetPrimitiveField(env, javaField, javaObj, 'J', v);
298}
299
Elliott Hughes0512f022012-03-15 22:10:52 -0700300static void Field_setShort(JNIEnv* env, jobject javaField, jobject javaObj, jshort value) {
Elliott Hughes1d878f32012-04-11 15:17:54 -0700301 JValue v;
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800302 v.s = value;
303 SetPrimitiveField(env, javaField, javaObj, 'S', v);
Elliott Hughes33203b52011-09-20 19:42:01 -0700304}
305
Brian Carlstromf867b6f2011-09-16 12:17:25 -0700306static JNINativeMethod gMethods[] = {
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800307 NATIVE_METHOD(Field, get, "(Ljava/lang/Object;)Ljava/lang/Object;"),
308 NATIVE_METHOD(Field, getBoolean, "(Ljava/lang/Object;)Z"),
309 NATIVE_METHOD(Field, getByte, "(Ljava/lang/Object;)B"),
310 NATIVE_METHOD(Field, getChar, "(Ljava/lang/Object;)C"),
311 NATIVE_METHOD(Field, getDouble, "(Ljava/lang/Object;)D"),
312 NATIVE_METHOD(Field, getFloat, "(Ljava/lang/Object;)F"),
313 NATIVE_METHOD(Field, getInt, "(Ljava/lang/Object;)I"),
314 NATIVE_METHOD(Field, getLong, "(Ljava/lang/Object;)J"),
315 NATIVE_METHOD(Field, getShort, "(Ljava/lang/Object;)S"),
316 NATIVE_METHOD(Field, set, "(Ljava/lang/Object;Ljava/lang/Object;)V"),
317 NATIVE_METHOD(Field, setBoolean, "(Ljava/lang/Object;Z)V"),
318 NATIVE_METHOD(Field, setByte, "(Ljava/lang/Object;B)V"),
319 NATIVE_METHOD(Field, setChar, "(Ljava/lang/Object;C)V"),
320 NATIVE_METHOD(Field, setDouble, "(Ljava/lang/Object;D)V"),
321 NATIVE_METHOD(Field, setFloat, "(Ljava/lang/Object;F)V"),
322 NATIVE_METHOD(Field, setInt, "(Ljava/lang/Object;I)V"),
323 NATIVE_METHOD(Field, setLong, "(Ljava/lang/Object;J)V"),
324 NATIVE_METHOD(Field, setShort, "(Ljava/lang/Object;S)V"),
Brian Carlstromf867b6f2011-09-16 12:17:25 -0700325};
326
Brian Carlstromf867b6f2011-09-16 12:17:25 -0700327void register_java_lang_reflect_Field(JNIEnv* env) {
Brian Carlstromf867b6f2011-09-16 12:17:25 -0700328 jniRegisterNativeMethods(env, "java/lang/reflect/Field", gMethods, NELEM(gMethods));
329}
330
331} // namespace art