blob: fe9f79ccc34012827faa7a98b2b839d9548a700c [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) {
Elliott Hughesf24d3ce2012-04-11 17:43:37 -070028 DCHECK_EQ(value.GetJ(), 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 Hughesf24d3ce2012-04-11 17:43:37 -070035 value.SetZ(f->GetBoolean(o));
Elliott Hughes33203b52011-09-20 19:42:01 -070036 return true;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -070037 case Primitive::kPrimByte:
Elliott Hughesf24d3ce2012-04-11 17:43:37 -070038 value.SetB(f->GetByte(o));
Elliott Hughes33203b52011-09-20 19:42:01 -070039 return true;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -070040 case Primitive::kPrimChar:
Elliott Hughesf24d3ce2012-04-11 17:43:37 -070041 value.SetC(f->GetChar(o));
Elliott Hughes33203b52011-09-20 19:42:01 -070042 return true;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -070043 case Primitive::kPrimDouble:
Elliott Hughesf24d3ce2012-04-11 17:43:37 -070044 value.SetD(f->GetDouble(o));
Elliott Hughes33203b52011-09-20 19:42:01 -070045 return true;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -070046 case Primitive::kPrimFloat:
Elliott Hughesf24d3ce2012-04-11 17:43:37 -070047 value.SetF(f->GetFloat(o));
Elliott Hughes33203b52011-09-20 19:42:01 -070048 return true;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -070049 case Primitive::kPrimInt:
Elliott Hughesf24d3ce2012-04-11 17:43:37 -070050 value.SetI(f->GetInt(o));
Elliott Hughes33203b52011-09-20 19:42:01 -070051 return true;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -070052 case Primitive::kPrimLong:
Elliott Hughesf24d3ce2012-04-11 17:43:37 -070053 value.SetJ(f->GetLong(o));
Elliott Hughes33203b52011-09-20 19:42:01 -070054 return true;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -070055 case Primitive::kPrimShort:
Elliott Hughesf24d3ce2012-04-11 17:43:37 -070056 value.SetS(f->GetShort(o));
Elliott Hughes33203b52011-09-20 19:42:01 -070057 return true;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -070058 case Primitive::kPrimNot:
Elliott Hughes33203b52011-09-20 19:42:01 -070059 if (allow_references) {
Elliott Hughesf24d3ce2012-04-11 17:43:37 -070060 value.SetL(f->GetObject(o));
Elliott Hughes33203b52011-09-20 19:42:01 -070061 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 Hughes0512f022012-03-15 22:10:52 -070074static bool CheckReceiver(JNIEnv* env, jobject javaObj, Field* f, Object*& o) {
Elliott Hughesed1c1e32011-10-02 14:31:05 -070075 if (f->IsStatic()) {
76 o = NULL;
77 return true;
78 }
79
80 o = Decode<Object*>(env, javaObj);
Ian Rogers6d4d9fc2011-11-30 16:24:48 -080081 Class* declaringClass = f->GetDeclaringClass();
Elliott Hughesed1c1e32011-10-02 14:31:05 -070082 if (!VerifyObjectInClass(env, o, declaringClass)) {
83 return false;
84 }
85 return true;
86}
87
Elliott Hughes0512f022012-03-15 22:10:52 -070088static jobject Field_get(JNIEnv* env, jobject javaField, jobject javaObj) {
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;
Ian Rogers6d4d9fc2011-11-30 16:24:48 -080091 if (!CheckReceiver(env, javaObj, f, o)) {
92 return NULL;
93 }
94
95 // Get the field's value, boxing if necessary.
Elliott Hughes1d878f32012-04-11 15:17:54 -070096 JValue value;
Ian Rogers6d4d9fc2011-11-30 16:24:48 -080097 if (!GetFieldValue(o, f, value, true)) {
98 return NULL;
99 }
Elliott Hughesdbac3092012-03-16 18:00:30 -0700100 BoxPrimitive(FieldHelper(f).GetTypeAsPrimitiveType(), value);
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800101
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700102 return AddLocalReference<jobject>(env, value.GetL());
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800103}
104
Elliott Hughes0512f022012-03-15 22:10:52 -0700105static JValue GetPrimitiveField(JNIEnv* env, jobject javaField, jobject javaObj, char dst_descriptor) {
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800106 Field* f = DecodeField(env->FromReflectedField(javaField));
107 Object* o = NULL;
108 if (!CheckReceiver(env, javaObj, f, o)) {
Elliott Hughesed1c1e32011-10-02 14:31:05 -0700109 return JValue();
Elliott Hughes33203b52011-09-20 19:42:01 -0700110 }
111
112 // Read the value.
Elliott Hughes1d878f32012-04-11 15:17:54 -0700113 JValue field_value;
Elliott Hughes33203b52011-09-20 19:42:01 -0700114 if (!GetFieldValue(o, f, field_value, false)) {
115 return JValue();
116 }
117
118 // Widen it if necessary (and possible).
119 JValue wide_value;
Elliott Hughes582a7d12011-10-10 18:38:42 -0700120 Class* dst_type = Runtime::Current()->GetClassLinker()->FindPrimitiveClass(dst_descriptor);
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800121 if (!ConvertPrimitiveValue(FieldHelper(f).GetTypeAsPrimitiveType(), dst_type->GetPrimitiveType(),
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700122 field_value, wide_value)) {
Elliott Hughes33203b52011-09-20 19:42:01 -0700123 return JValue();
124 }
125 return wide_value;
126}
127
Elliott Hughes0512f022012-03-15 22:10:52 -0700128static jboolean Field_getBoolean(JNIEnv* env, jobject javaField, jobject javaObj) {
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700129 return GetPrimitiveField(env, javaField, javaObj, 'Z').GetZ();
Elliott Hughes33203b52011-09-20 19:42:01 -0700130}
131
Elliott Hughes0512f022012-03-15 22:10:52 -0700132static jbyte Field_getByte(JNIEnv* env, jobject javaField, jobject javaObj) {
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700133 return GetPrimitiveField(env, javaField, javaObj, 'B').GetB();
Elliott Hughes33203b52011-09-20 19:42:01 -0700134}
135
Elliott Hughes0512f022012-03-15 22:10:52 -0700136static jchar Field_getChar(JNIEnv* env, jobject javaField, jobject javaObj) {
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700137 return GetPrimitiveField(env, javaField, javaObj, 'C').GetC();
Elliott Hughes33203b52011-09-20 19:42:01 -0700138}
139
Elliott Hughes0512f022012-03-15 22:10:52 -0700140static jdouble Field_getDouble(JNIEnv* env, jobject javaField, jobject javaObj) {
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700141 return GetPrimitiveField(env, javaField, javaObj, 'D').GetD();
Elliott Hughes33203b52011-09-20 19:42:01 -0700142}
143
Elliott Hughes0512f022012-03-15 22:10:52 -0700144static jfloat Field_getFloat(JNIEnv* env, jobject javaField, jobject javaObj) {
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700145 return GetPrimitiveField(env, javaField, javaObj, 'F').GetF();
Elliott Hughes33203b52011-09-20 19:42:01 -0700146}
147
Elliott Hughes0512f022012-03-15 22:10:52 -0700148static jint Field_getInt(JNIEnv* env, jobject javaField, jobject javaObj) {
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700149 return GetPrimitiveField(env, javaField, javaObj, 'I').GetI();
Elliott Hughes33203b52011-09-20 19:42:01 -0700150}
151
Elliott Hughes0512f022012-03-15 22:10:52 -0700152static jlong Field_getLong(JNIEnv* env, jobject javaField, jobject javaObj) {
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700153 return GetPrimitiveField(env, javaField, javaObj, 'J').GetJ();
Elliott Hughes33203b52011-09-20 19:42:01 -0700154}
155
Elliott Hughes0512f022012-03-15 22:10:52 -0700156static jshort Field_getShort(JNIEnv* env, jobject javaField, jobject javaObj) {
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700157 return GetPrimitiveField(env, javaField, javaObj, 'S').GetS();
Elliott Hughes33203b52011-09-20 19:42:01 -0700158}
159
Elliott Hughes0512f022012-03-15 22:10:52 -0700160static void SetFieldValue(Object* o, Field* f, const JValue& new_value, bool allow_references) {
Ian Rogers0045a292012-03-31 21:08:41 -0700161 if (!Runtime::Current()->GetClassLinker()->EnsureInitialized(f->GetDeclaringClass(), true, true)) {
Elliott Hughes923e8b82012-03-23 11:44:07 -0700162 return;
163 }
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800164 switch (FieldHelper(f).GetTypeAsPrimitiveType()) {
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700165 case Primitive::kPrimBoolean:
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700166 f->SetBoolean(o, new_value.GetZ());
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700167 break;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700168 case Primitive::kPrimByte:
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700169 f->SetByte(o, new_value.GetB());
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700170 break;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700171 case Primitive::kPrimChar:
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700172 f->SetChar(o, new_value.GetC());
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700173 break;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700174 case Primitive::kPrimDouble:
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700175 f->SetDouble(o, new_value.GetD());
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700176 break;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700177 case Primitive::kPrimFloat:
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700178 f->SetFloat(o, new_value.GetF());
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700179 break;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700180 case Primitive::kPrimInt:
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700181 f->SetInt(o, new_value.GetI());
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700182 break;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700183 case Primitive::kPrimLong:
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700184 f->SetLong(o, new_value.GetJ());
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700185 break;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700186 case Primitive::kPrimShort:
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700187 f->SetShort(o, new_value.GetS());
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700188 break;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700189 case Primitive::kPrimNot:
Elliott Hughes33203b52011-09-20 19:42:01 -0700190 if (allow_references) {
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700191 f->SetObject(o, new_value.GetL());
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700192 break;
Elliott Hughes33203b52011-09-20 19:42:01 -0700193 }
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700194 // Else fall through to report an error.
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700195 case Primitive::kPrimVoid:
Elliott Hughes33203b52011-09-20 19:42:01 -0700196 // Never okay.
Elliott Hughes5cb5ad22011-10-02 12:13:39 -0700197 Thread::Current()->ThrowNewExceptionF("Ljava/lang/IllegalArgumentException;",
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700198 "Not a primitive field: %s", PrettyField(f).c_str());
199 return;
Elliott Hughes33203b52011-09-20 19:42:01 -0700200 }
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700201
202 // Special handling for final fields on SMP systems.
203 // We need a store/store barrier here (JMM requirement).
204 if (f->IsFinal()) {
205 ANDROID_MEMBAR_STORE();
206 }
Elliott Hughes33203b52011-09-20 19:42:01 -0700207}
208
Elliott Hughes0512f022012-03-15 22:10:52 -0700209static void Field_set(JNIEnv* env, jobject javaField, jobject javaObj, jobject javaValue) {
Elliott Hughes34e06962012-04-09 13:55:55 -0700210 ScopedThreadStateChange tsc(Thread::Current(), kRunnable);
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800211 Field* f = DecodeField(env->FromReflectedField(javaField));
212
213 // Unbox the value, if necessary.
214 Object* boxed_value = Decode<Object*>(env, javaValue);
215 JValue unboxed_value;
Elliott Hughesdbac3092012-03-16 18:00:30 -0700216 if (!UnboxPrimitive(boxed_value, FieldHelper(f).GetType(), unboxed_value, "field")) {
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800217 return;
218 }
219
220 // Check that the receiver is non-null and an instance of the field's declaring class.
221 Object* o = NULL;
222 if (!CheckReceiver(env, javaObj, f, o)) {
223 return;
224 }
225
226 SetFieldValue(o, f, unboxed_value, true);
227}
228
Elliott Hughes0512f022012-03-15 22:10:52 -0700229static void SetPrimitiveField(JNIEnv* env, jobject javaField, jobject javaObj, char src_descriptor,
230 const JValue& new_value) {
Elliott Hughes34e06962012-04-09 13:55:55 -0700231 ScopedThreadStateChange tsc(Thread::Current(), kRunnable);
Elliott Hughes418d20f2011-09-22 14:00:39 -0700232 Field* f = DecodeField(env->FromReflectedField(javaField));
Elliott Hughesed1c1e32011-10-02 14:31:05 -0700233 Object* o = NULL;
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800234 if (!CheckReceiver(env, javaObj, f, o)) {
Elliott Hughesed1c1e32011-10-02 14:31:05 -0700235 return;
Elliott Hughes33203b52011-09-20 19:42:01 -0700236 }
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800237 FieldHelper fh(f);
238 if (!fh.IsPrimitiveType()) {
Jesse Wilsonc129a6b2011-11-24 14:47:46 -0500239 Thread::Current()->ThrowNewExceptionF("Ljava/lang/IllegalArgumentException;",
240 "Not a primitive field: %s", PrettyField(f).c_str());
241 return;
242 }
Elliott Hughes33203b52011-09-20 19:42:01 -0700243
244 // Widen the value if necessary (and possible).
245 JValue wide_value;
Elliott Hughes582a7d12011-10-10 18:38:42 -0700246 Class* src_type = Runtime::Current()->GetClassLinker()->FindPrimitiveClass(src_descriptor);
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800247 if (!ConvertPrimitiveValue(src_type->GetPrimitiveType(), fh.GetTypeAsPrimitiveType(),
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700248 new_value, wide_value)) {
Elliott Hughes33203b52011-09-20 19:42:01 -0700249 return;
250 }
251
252 // Write the value.
253 SetFieldValue(o, f, wide_value, false);
254}
255
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700256static void Field_setBoolean(JNIEnv* env, jobject javaField, jobject javaObj, jboolean z) {
257 JValue value;
258 value.SetZ(z);
259 SetPrimitiveField(env, javaField, javaObj, 'Z', value);
Elliott Hughes33203b52011-09-20 19:42:01 -0700260}
261
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700262static void Field_setByte(JNIEnv* env, jobject javaField, jobject javaObj, jbyte b) {
263 JValue value;
264 value.SetB(b);
265 SetPrimitiveField(env, javaField, javaObj, 'B', value);
Elliott Hughes33203b52011-09-20 19:42:01 -0700266}
267
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700268static void Field_setChar(JNIEnv* env, jobject javaField, jobject javaObj, jchar c) {
269 JValue value;
270 value.SetC(c);
271 SetPrimitiveField(env, javaField, javaObj, 'C', value);
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800272}
Elliott Hughes33203b52011-09-20 19:42:01 -0700273
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700274static void Field_setDouble(JNIEnv* env, jobject javaField, jobject javaObj, jdouble d) {
275 JValue value;
276 value.SetD(d);
277 SetPrimitiveField(env, javaField, javaObj, 'D', value);
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800278}
Elliott Hughes33203b52011-09-20 19:42:01 -0700279
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700280static void Field_setFloat(JNIEnv* env, jobject javaField, jobject javaObj, jfloat f) {
281 JValue value;
282 value.SetF(f);
283 SetPrimitiveField(env, javaField, javaObj, 'F', value);
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800284}
285
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700286static void Field_setInt(JNIEnv* env, jobject javaField, jobject javaObj, jint i) {
287 JValue value;
288 value.SetI(i);
289 SetPrimitiveField(env, javaField, javaObj, 'I', value);
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800290}
291
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700292static void Field_setLong(JNIEnv* env, jobject javaField, jobject javaObj, jlong j) {
293 JValue value;
294 value.SetJ(j);
295 SetPrimitiveField(env, javaField, javaObj, 'J', value);
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800296}
297
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700298static void Field_setShort(JNIEnv* env, jobject javaField, jobject javaObj, jshort s) {
299 JValue value;
300 value.SetS(s);
301 SetPrimitiveField(env, javaField, javaObj, 'S', value);
Elliott Hughes33203b52011-09-20 19:42:01 -0700302}
303
Brian Carlstromf867b6f2011-09-16 12:17:25 -0700304static JNINativeMethod gMethods[] = {
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800305 NATIVE_METHOD(Field, get, "(Ljava/lang/Object;)Ljava/lang/Object;"),
306 NATIVE_METHOD(Field, getBoolean, "(Ljava/lang/Object;)Z"),
307 NATIVE_METHOD(Field, getByte, "(Ljava/lang/Object;)B"),
308 NATIVE_METHOD(Field, getChar, "(Ljava/lang/Object;)C"),
309 NATIVE_METHOD(Field, getDouble, "(Ljava/lang/Object;)D"),
310 NATIVE_METHOD(Field, getFloat, "(Ljava/lang/Object;)F"),
311 NATIVE_METHOD(Field, getInt, "(Ljava/lang/Object;)I"),
312 NATIVE_METHOD(Field, getLong, "(Ljava/lang/Object;)J"),
313 NATIVE_METHOD(Field, getShort, "(Ljava/lang/Object;)S"),
314 NATIVE_METHOD(Field, set, "(Ljava/lang/Object;Ljava/lang/Object;)V"),
315 NATIVE_METHOD(Field, setBoolean, "(Ljava/lang/Object;Z)V"),
316 NATIVE_METHOD(Field, setByte, "(Ljava/lang/Object;B)V"),
317 NATIVE_METHOD(Field, setChar, "(Ljava/lang/Object;C)V"),
318 NATIVE_METHOD(Field, setDouble, "(Ljava/lang/Object;D)V"),
319 NATIVE_METHOD(Field, setFloat, "(Ljava/lang/Object;F)V"),
320 NATIVE_METHOD(Field, setInt, "(Ljava/lang/Object;I)V"),
321 NATIVE_METHOD(Field, setLong, "(Ljava/lang/Object;J)V"),
322 NATIVE_METHOD(Field, setShort, "(Ljava/lang/Object;S)V"),
Brian Carlstromf867b6f2011-09-16 12:17:25 -0700323};
324
Brian Carlstromf867b6f2011-09-16 12:17:25 -0700325void register_java_lang_reflect_Field(JNIEnv* env) {
Brian Carlstromf867b6f2011-09-16 12:17:25 -0700326 jniRegisterNativeMethods(env, "java/lang/reflect/Field", gMethods, NELEM(gMethods));
327}
328
329} // namespace art