blob: a2f09e7b6c6db1cb158388d60d35ecd0e43c901a [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"
Elliott Hughes418d20f2011-09-22 14:00:39 -070020#include "reflection.h"
Brian Carlstromf867b6f2011-09-16 12:17:25 -070021
22#include "JniConstants.h" // Last to avoid problems with LOG redefinition.
23
24namespace art {
25
26namespace {
27
28jint Field_getFieldModifiers(JNIEnv* env, jobject jfield, jclass javaDeclaringClass, jint slot) {
Elliott Hughes582a7d12011-10-10 18:38:42 -070029 return Decode<Object*>(env, jfield)->AsField()->GetAccessFlags() & kAccJavaFlagsMask;
Brian Carlstromf867b6f2011-09-16 12:17:25 -070030}
31
Elliott Hughes33203b52011-09-20 19:42:01 -070032bool GetFieldValue(Object* o, Field* f, JValue& value, bool allow_references) {
Brian Carlstrom6b4ef022011-10-23 14:59:04 -070033 switch (f->GetPrimitiveType()) {
34 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:
Elliott Hughes33203b52011-09-20 19:42:01 -070038 value.b = f->GetByte(o);
39 return true;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -070040 case Primitive::kPrimChar:
Elliott Hughes33203b52011-09-20 19:42:01 -070041 value.c = f->GetChar(o);
42 return true;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -070043 case Primitive::kPrimDouble:
Elliott Hughes33203b52011-09-20 19:42:01 -070044 value.d = f->GetDouble(o);
45 return true;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -070046 case Primitive::kPrimFloat:
Elliott Hughes33203b52011-09-20 19:42:01 -070047 value.f = f->GetFloat(o);
48 return true;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -070049 case Primitive::kPrimInt:
Elliott Hughes33203b52011-09-20 19:42:01 -070050 value.i = f->GetInt(o);
51 return true;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -070052 case Primitive::kPrimLong:
Elliott Hughes33203b52011-09-20 19:42:01 -070053 value.j = f->GetLong(o);
54 return true;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -070055 case Primitive::kPrimShort:
Elliott Hughes33203b52011-09-20 19:42:01 -070056 value.s = f->GetShort(o);
57 return true;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -070058 case Primitive::kPrimNot:
Elliott Hughes33203b52011-09-20 19:42:01 -070059 if (allow_references) {
60 value.l = f->GetObject(o);
61 return true;
62 }
63 // Else break to report an error.
64 break;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -070065 case Primitive::kPrimVoid:
Elliott Hughes33203b52011-09-20 19:42:01 -070066 // Never okay.
67 break;
68 }
Elliott Hughes5cb5ad22011-10-02 12:13:39 -070069 Thread::Current()->ThrowNewExceptionF("Ljava/lang/IllegalArgumentException;",
Elliott Hughes33203b52011-09-20 19:42:01 -070070 "Not a primitive field: %s", PrettyField(f).c_str());
71 return false;
72}
73
Elliott Hughesed1c1e32011-10-02 14:31:05 -070074bool CheckReceiver(JNIEnv* env, jobject javaObj, jclass javaDeclaringClass, Field* f, Object*& o) {
75 if (f->IsStatic()) {
76 o = NULL;
77 return true;
78 }
79
80 o = Decode<Object*>(env, javaObj);
81 Class* declaringClass = Decode<Class*>(env, javaDeclaringClass);
82 if (!VerifyObjectInClass(env, o, declaringClass)) {
83 return false;
84 }
85 return true;
86}
87
Elliott Hughes582a7d12011-10-10 18:38:42 -070088JValue GetPrimitiveField(JNIEnv* env, jobject javaField, jobject javaObj, jclass javaDeclaringClass, jchar dst_descriptor) {
Elliott Hughes418d20f2011-09-22 14:00:39 -070089 Field* f = DecodeField(env->FromReflectedField(javaField));
Elliott Hughesed1c1e32011-10-02 14:31:05 -070090 Object* o = NULL;
91 if (!CheckReceiver(env, javaObj, javaDeclaringClass, f, o)) {
92 return JValue();
Elliott Hughes33203b52011-09-20 19:42:01 -070093 }
94
95 // Read the value.
96 JValue field_value;
97 if (!GetFieldValue(o, f, field_value, false)) {
98 return JValue();
99 }
100
101 // Widen it if necessary (and possible).
102 JValue wide_value;
Elliott Hughes582a7d12011-10-10 18:38:42 -0700103 Class* dst_type = Runtime::Current()->GetClassLinker()->FindPrimitiveClass(dst_descriptor);
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700104 if (!ConvertPrimitiveValue(f->GetPrimitiveType(), dst_type->GetPrimitiveType(),
105 field_value, wide_value)) {
Elliott Hughes33203b52011-09-20 19:42:01 -0700106 return JValue();
107 }
108 return wide_value;
109}
110
Elliott Hughes582a7d12011-10-10 18:38:42 -0700111jbyte Field_getBField(JNIEnv* env, jobject javaField, jobject javaObj, jclass javaDeclaringClass, jclass, jint, jboolean, jchar dst_descriptor) {
112 return GetPrimitiveField(env, javaField, javaObj, javaDeclaringClass, dst_descriptor).b;
Elliott Hughes33203b52011-09-20 19:42:01 -0700113}
114
Elliott Hughes582a7d12011-10-10 18:38:42 -0700115jchar Field_getCField(JNIEnv* env, jobject javaField, jobject javaObj, jclass javaDeclaringClass, jclass, jint, jboolean, jchar dst_descriptor) {
116 return GetPrimitiveField(env, javaField, javaObj, javaDeclaringClass, dst_descriptor).c;
Elliott Hughes33203b52011-09-20 19:42:01 -0700117}
118
Elliott Hughes582a7d12011-10-10 18:38:42 -0700119jdouble Field_getDField(JNIEnv* env, jobject javaField, jobject javaObj, jclass javaDeclaringClass, jclass, jint, jboolean, jchar dst_descriptor) {
120 return GetPrimitiveField(env, javaField, javaObj, javaDeclaringClass, dst_descriptor).d;
Elliott Hughes33203b52011-09-20 19:42:01 -0700121}
122
Elliott Hughes582a7d12011-10-10 18:38:42 -0700123jfloat Field_getFField(JNIEnv* env, jobject javaField, jobject javaObj, jclass javaDeclaringClass, jclass, jint, jboolean, jchar dst_descriptor) {
124 return GetPrimitiveField(env, javaField, javaObj, javaDeclaringClass, dst_descriptor).f;
Elliott Hughes33203b52011-09-20 19:42:01 -0700125}
126
Elliott Hughes582a7d12011-10-10 18:38:42 -0700127jint Field_getIField(JNIEnv* env, jobject javaField, jobject javaObj, jclass javaDeclaringClass, jclass, jint, jboolean, jchar dst_descriptor) {
128 return GetPrimitiveField(env, javaField, javaObj, javaDeclaringClass, dst_descriptor).i;
Elliott Hughes33203b52011-09-20 19:42:01 -0700129}
130
Elliott Hughes582a7d12011-10-10 18:38:42 -0700131jlong Field_getJField(JNIEnv* env, jobject javaField, jobject javaObj, jclass javaDeclaringClass, jclass, jint, jboolean, jchar dst_descriptor) {
132 return GetPrimitiveField(env, javaField, javaObj, javaDeclaringClass, dst_descriptor).j;
Elliott Hughes33203b52011-09-20 19:42:01 -0700133}
134
Elliott Hughes582a7d12011-10-10 18:38:42 -0700135jshort Field_getSField(JNIEnv* env, jobject javaField, jobject javaObj, jclass javaDeclaringClass, jclass, jint, jboolean, jchar dst_descriptor) {
136 return GetPrimitiveField(env, javaField, javaObj, javaDeclaringClass, dst_descriptor).s;
Elliott Hughes33203b52011-09-20 19:42:01 -0700137}
138
Elliott Hughes582a7d12011-10-10 18:38:42 -0700139jboolean Field_getZField(JNIEnv* env, jobject javaField, jobject javaObj, jclass javaDeclaringClass, jclass, jint, jboolean, jchar dst_descriptor) {
140 return GetPrimitiveField(env, javaField, javaObj, javaDeclaringClass, dst_descriptor).z;
Elliott Hughes33203b52011-09-20 19:42:01 -0700141}
142
143void SetFieldValue(Object* o, Field* f, const JValue& new_value, bool allow_references) {
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700144 switch (f->GetPrimitiveType()) {
145 case Primitive::kPrimBoolean:
Elliott Hughes33203b52011-09-20 19:42:01 -0700146 f->SetBoolean(o, new_value.z);
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700147 break;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700148 case Primitive::kPrimByte:
Elliott Hughes33203b52011-09-20 19:42:01 -0700149 f->SetByte(o, new_value.b);
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700150 break;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700151 case Primitive::kPrimChar:
Elliott Hughes33203b52011-09-20 19:42:01 -0700152 f->SetChar(o, new_value.c);
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700153 break;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700154 case Primitive::kPrimDouble:
Elliott Hughes33203b52011-09-20 19:42:01 -0700155 f->SetDouble(o, new_value.d);
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700156 break;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700157 case Primitive::kPrimFloat:
Elliott Hughes33203b52011-09-20 19:42:01 -0700158 f->SetFloat(o, new_value.f);
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700159 break;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700160 case Primitive::kPrimInt:
Elliott Hughes33203b52011-09-20 19:42:01 -0700161 f->SetInt(o, new_value.i);
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700162 break;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700163 case Primitive::kPrimLong:
Elliott Hughes33203b52011-09-20 19:42:01 -0700164 f->SetLong(o, new_value.j);
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700165 break;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700166 case Primitive::kPrimShort:
Elliott Hughes33203b52011-09-20 19:42:01 -0700167 f->SetShort(o, new_value.s);
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700168 break;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700169 case Primitive::kPrimNot:
Elliott Hughes33203b52011-09-20 19:42:01 -0700170 if (allow_references) {
171 f->SetObject(o, new_value.l);
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700172 break;
Elliott Hughes33203b52011-09-20 19:42:01 -0700173 }
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700174 // Else fall through to report an error.
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700175 case Primitive::kPrimVoid:
Elliott Hughes33203b52011-09-20 19:42:01 -0700176 // Never okay.
Elliott Hughes5cb5ad22011-10-02 12:13:39 -0700177 Thread::Current()->ThrowNewExceptionF("Ljava/lang/IllegalArgumentException;",
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700178 "Not a primitive field: %s", PrettyField(f).c_str());
179 return;
Elliott Hughes33203b52011-09-20 19:42:01 -0700180 }
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700181
182 // Special handling for final fields on SMP systems.
183 // We need a store/store barrier here (JMM requirement).
184 if (f->IsFinal()) {
185 ANDROID_MEMBAR_STORE();
186 }
Elliott Hughes33203b52011-09-20 19:42:01 -0700187}
188
Elliott Hughes582a7d12011-10-10 18:38:42 -0700189void SetPrimitiveField(JNIEnv* env, jobject javaField, jobject javaObj, jclass javaDeclaringClass, jchar src_descriptor, const JValue& new_value) {
Elliott Hughes418d20f2011-09-22 14:00:39 -0700190 Field* f = DecodeField(env->FromReflectedField(javaField));
Elliott Hughesed1c1e32011-10-02 14:31:05 -0700191 Object* o = NULL;
192 if (!CheckReceiver(env, javaObj, javaDeclaringClass, f, o)) {
193 return;
Elliott Hughes33203b52011-09-20 19:42:01 -0700194 }
195
196 // Widen the value if necessary (and possible).
197 JValue wide_value;
Elliott Hughes582a7d12011-10-10 18:38:42 -0700198 Class* src_type = Runtime::Current()->GetClassLinker()->FindPrimitiveClass(src_descriptor);
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700199 if (!ConvertPrimitiveValue(src_type->GetPrimitiveType(), f->GetPrimitiveType(),
200 new_value, wide_value)) {
Elliott Hughes33203b52011-09-20 19:42:01 -0700201 return;
202 }
203
204 // Write the value.
205 SetFieldValue(o, f, wide_value, false);
206}
207
Elliott Hughes582a7d12011-10-10 18:38:42 -0700208void Field_setBField(JNIEnv* env, jobject javaField, jobject javaObj, jclass javaDeclaringClass, jclass, jint, jboolean, jchar src_descriptor, jbyte value) {
Elliott Hughes33203b52011-09-20 19:42:01 -0700209 JValue v = { 0 };
210 v.b = value;
Elliott Hughes582a7d12011-10-10 18:38:42 -0700211 SetPrimitiveField(env, javaField, javaObj, javaDeclaringClass, src_descriptor, v);
Elliott Hughes33203b52011-09-20 19:42:01 -0700212}
213
Elliott Hughes582a7d12011-10-10 18:38:42 -0700214void Field_setCField(JNIEnv* env, jobject javaField, jobject javaObj, jclass javaDeclaringClass, jclass, jint, jboolean, jchar src_descriptor, jchar value) {
Elliott Hughes33203b52011-09-20 19:42:01 -0700215 JValue v = { 0 };
216 v.c = value;
Elliott Hughes582a7d12011-10-10 18:38:42 -0700217 SetPrimitiveField(env, javaField, javaObj, javaDeclaringClass, src_descriptor, v);
Elliott Hughes33203b52011-09-20 19:42:01 -0700218}
219
Elliott Hughes582a7d12011-10-10 18:38:42 -0700220void Field_setDField(JNIEnv* env, jobject javaField, jobject javaObj, jclass javaDeclaringClass, jclass, jint, jboolean, jchar src_descriptor, jdouble value) {
Elliott Hughes33203b52011-09-20 19:42:01 -0700221 JValue v = { 0 };
222 v.d = value;
Elliott Hughes582a7d12011-10-10 18:38:42 -0700223 SetPrimitiveField(env, javaField, javaObj, javaDeclaringClass, src_descriptor, v);
Elliott Hughes33203b52011-09-20 19:42:01 -0700224}
225
Elliott Hughes582a7d12011-10-10 18:38:42 -0700226void Field_setFField(JNIEnv* env, jobject javaField, jobject javaObj, jclass javaDeclaringClass, jclass, jint, jboolean, jchar src_descriptor, jfloat value) {
Elliott Hughes33203b52011-09-20 19:42:01 -0700227 JValue v = { 0 };
228 v.f = value;
Elliott Hughes582a7d12011-10-10 18:38:42 -0700229 SetPrimitiveField(env, javaField, javaObj, javaDeclaringClass, src_descriptor, v);
Elliott Hughes33203b52011-09-20 19:42:01 -0700230}
231
Elliott Hughes582a7d12011-10-10 18:38:42 -0700232void Field_setIField(JNIEnv* env, jobject javaField, jobject javaObj, jclass javaDeclaringClass, jclass, jint, jboolean, jchar src_descriptor, jint value) {
Elliott Hughes33203b52011-09-20 19:42:01 -0700233 JValue v = { 0 };
234 v.i = value;
Elliott Hughes582a7d12011-10-10 18:38:42 -0700235 SetPrimitiveField(env, javaField, javaObj, javaDeclaringClass, src_descriptor, v);
Elliott Hughes33203b52011-09-20 19:42:01 -0700236}
237
Elliott Hughes582a7d12011-10-10 18:38:42 -0700238void Field_setJField(JNIEnv* env, jobject javaField, jobject javaObj, jclass javaDeclaringClass, jclass, jint, jboolean, jchar src_descriptor, jlong value) {
Elliott Hughes33203b52011-09-20 19:42:01 -0700239 JValue v = { 0 };
240 v.j = value;
Elliott Hughes582a7d12011-10-10 18:38:42 -0700241 SetPrimitiveField(env, javaField, javaObj, javaDeclaringClass, src_descriptor, v);
Elliott Hughes33203b52011-09-20 19:42:01 -0700242}
243
Elliott Hughes582a7d12011-10-10 18:38:42 -0700244void Field_setSField(JNIEnv* env, jobject javaField, jobject javaObj, jclass javaDeclaringClass, jclass, jint, jboolean, jchar src_descriptor, jshort value) {
Elliott Hughes33203b52011-09-20 19:42:01 -0700245 JValue v = { 0 };
246 v.s = value;
Elliott Hughes582a7d12011-10-10 18:38:42 -0700247 SetPrimitiveField(env, javaField, javaObj, javaDeclaringClass, src_descriptor, v);
Elliott Hughes33203b52011-09-20 19:42:01 -0700248}
249
Elliott Hughes582a7d12011-10-10 18:38:42 -0700250void Field_setZField(JNIEnv* env, jobject javaField, jobject javaObj, jclass javaDeclaringClass, jclass, jint, jboolean, jchar src_descriptor, jboolean value) {
Elliott Hughes33203b52011-09-20 19:42:01 -0700251 JValue v = { 0 };
252 v.z = value;
Elliott Hughes582a7d12011-10-10 18:38:42 -0700253 SetPrimitiveField(env, javaField, javaObj, javaDeclaringClass, src_descriptor, v);
Elliott Hughes33203b52011-09-20 19:42:01 -0700254}
255
256void Field_setField(JNIEnv* env, jobject javaField, jobject javaObj, jclass javaDeclaringClass, jclass, jint, jboolean, jobject javaValue) {
Elliott Hughes418d20f2011-09-22 14:00:39 -0700257 Field* f = DecodeField(env->FromReflectedField(javaField));
Elliott Hughes33203b52011-09-20 19:42:01 -0700258
259 // Unbox the value, if necessary.
260 Object* boxed_value = Decode<Object*>(env, javaValue);
261 JValue unboxed_value;
262 if (!UnboxPrimitive(env, boxed_value, f->GetType(), unboxed_value)) {
263 return;
264 }
265
266 // Check that the receiver is non-null and an instance of the field's declaring class.
Elliott Hughesed1c1e32011-10-02 14:31:05 -0700267 Object* o = NULL;
268 if (!CheckReceiver(env, javaObj, javaDeclaringClass, f, o)) {
269 return;
Elliott Hughes33203b52011-09-20 19:42:01 -0700270 }
271
272 SetFieldValue(o, f, unboxed_value, true);
273}
274
275jobject Field_getField(JNIEnv* env, jobject javaField, jobject javaObj, jclass javaDeclaringClass, jclass, jint, jboolean) {
Elliott Hughes418d20f2011-09-22 14:00:39 -0700276 Field* f = DecodeField(env->FromReflectedField(javaField));
Elliott Hughesed1c1e32011-10-02 14:31:05 -0700277 Object* o = NULL;
278 if (!CheckReceiver(env, javaObj, javaDeclaringClass, f, o)) {
279 return NULL;
Elliott Hughes33203b52011-09-20 19:42:01 -0700280 }
281
282 // Get the field's value, boxing if necessary.
283 JValue value;
284 if (!GetFieldValue(o, f, value, true)) {
285 return NULL;
286 }
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700287 BoxPrimitive(env, f->GetPrimitiveType(), value);
Elliott Hughes33203b52011-09-20 19:42:01 -0700288
289 return AddLocalReference<jobject>(env, value.l);
290}
291
Brian Carlstromf867b6f2011-09-16 12:17:25 -0700292static JNINativeMethod gMethods[] = {
Elliott Hughes33203b52011-09-20 19:42:01 -0700293 NATIVE_METHOD(Field, getFieldModifiers, "(Ljava/lang/Class;I)I"),
294
295 NATIVE_METHOD(Field, getBField, "(Ljava/lang/Object;Ljava/lang/Class;Ljava/lang/Class;IZC)B"),
296 NATIVE_METHOD(Field, getCField, "(Ljava/lang/Object;Ljava/lang/Class;Ljava/lang/Class;IZC)C"),
297 NATIVE_METHOD(Field, getDField, "(Ljava/lang/Object;Ljava/lang/Class;Ljava/lang/Class;IZC)D"),
298 NATIVE_METHOD(Field, getFField, "(Ljava/lang/Object;Ljava/lang/Class;Ljava/lang/Class;IZC)F"),
299 NATIVE_METHOD(Field, getField, "(Ljava/lang/Object;Ljava/lang/Class;Ljava/lang/Class;IZ)Ljava/lang/Object;"),
300 NATIVE_METHOD(Field, getIField, "(Ljava/lang/Object;Ljava/lang/Class;Ljava/lang/Class;IZC)I"),
301 NATIVE_METHOD(Field, getJField, "(Ljava/lang/Object;Ljava/lang/Class;Ljava/lang/Class;IZC)J"),
302 NATIVE_METHOD(Field, getSField, "(Ljava/lang/Object;Ljava/lang/Class;Ljava/lang/Class;IZC)S"),
303 NATIVE_METHOD(Field, getZField, "(Ljava/lang/Object;Ljava/lang/Class;Ljava/lang/Class;IZC)Z"),
304 NATIVE_METHOD(Field, setBField, "(Ljava/lang/Object;Ljava/lang/Class;Ljava/lang/Class;IZCB)V"),
305 NATIVE_METHOD(Field, setCField, "(Ljava/lang/Object;Ljava/lang/Class;Ljava/lang/Class;IZCC)V"),
306 NATIVE_METHOD(Field, setDField, "(Ljava/lang/Object;Ljava/lang/Class;Ljava/lang/Class;IZCD)V"),
307 NATIVE_METHOD(Field, setFField, "(Ljava/lang/Object;Ljava/lang/Class;Ljava/lang/Class;IZCF)V"),
308 NATIVE_METHOD(Field, setField, "(Ljava/lang/Object;Ljava/lang/Class;Ljava/lang/Class;IZLjava/lang/Object;)V"),
309 NATIVE_METHOD(Field, setIField, "(Ljava/lang/Object;Ljava/lang/Class;Ljava/lang/Class;IZCI)V"),
310 NATIVE_METHOD(Field, setJField, "(Ljava/lang/Object;Ljava/lang/Class;Ljava/lang/Class;IZCJ)V"),
311 NATIVE_METHOD(Field, setSField, "(Ljava/lang/Object;Ljava/lang/Class;Ljava/lang/Class;IZCS)V"),
312 NATIVE_METHOD(Field, setZField, "(Ljava/lang/Object;Ljava/lang/Class;Ljava/lang/Class;IZCZ)V"),
Brian Carlstromf867b6f2011-09-16 12:17:25 -0700313};
314
315} // namespace
316
317void register_java_lang_reflect_Field(JNIEnv* env) {
Elliott Hughes418d20f2011-09-22 14:00:39 -0700318 InitBoxingMethods(env); // TODO: move to Runtime?
Brian Carlstromf867b6f2011-09-16 12:17:25 -0700319 jniRegisterNativeMethods(env, "java/lang/reflect/Field", gMethods, NELEM(gMethods));
320}
321
322} // namespace art