blob: bd33c0ebf2460776b93de394b3d05ece45e42959 [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
Brian Carlstromf867b6f2011-09-16 12:17:25 -070017#include "class_linker.h"
Elliott Hugheseac76672012-05-24 21:56:51 -070018#include "jni_internal.h"
Brian Carlstromf867b6f2011-09-16 12:17:25 -070019#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
Brian Carlstromf867b6f2011-09-16 12:17:25 -070023namespace art {
24
Elliott Hughes0512f022012-03-15 22:10:52 -070025static bool GetFieldValue(Object* o, Field* f, JValue& value, bool allow_references) {
Elliott Hughesf24d3ce2012-04-11 17:43:37 -070026 DCHECK_EQ(value.GetJ(), 0LL);
Elliott Hughes34e06962012-04-09 13:55:55 -070027 ScopedThreadStateChange tsc(Thread::Current(), kRunnable);
Ian Rogers0045a292012-03-31 21:08:41 -070028 if (!Runtime::Current()->GetClassLinker()->EnsureInitialized(f->GetDeclaringClass(), true, true)) {
Elliott Hughes923e8b82012-03-23 11:44:07 -070029 return false;
30 }
Ian Rogers6d4d9fc2011-11-30 16:24:48 -080031 switch (FieldHelper(f).GetTypeAsPrimitiveType()) {
Brian Carlstrom6b4ef022011-10-23 14:59:04 -070032 case Primitive::kPrimBoolean:
Elliott Hughesf24d3ce2012-04-11 17:43:37 -070033 value.SetZ(f->GetBoolean(o));
Elliott Hughes33203b52011-09-20 19:42:01 -070034 return true;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -070035 case Primitive::kPrimByte:
Elliott Hughesf24d3ce2012-04-11 17:43:37 -070036 value.SetB(f->GetByte(o));
Elliott Hughes33203b52011-09-20 19:42:01 -070037 return true;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -070038 case Primitive::kPrimChar:
Elliott Hughesf24d3ce2012-04-11 17:43:37 -070039 value.SetC(f->GetChar(o));
Elliott Hughes33203b52011-09-20 19:42:01 -070040 return true;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -070041 case Primitive::kPrimDouble:
Elliott Hughesf24d3ce2012-04-11 17:43:37 -070042 value.SetD(f->GetDouble(o));
Elliott Hughes33203b52011-09-20 19:42:01 -070043 return true;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -070044 case Primitive::kPrimFloat:
Elliott Hughesf24d3ce2012-04-11 17:43:37 -070045 value.SetF(f->GetFloat(o));
Elliott Hughes33203b52011-09-20 19:42:01 -070046 return true;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -070047 case Primitive::kPrimInt:
Elliott Hughesf24d3ce2012-04-11 17:43:37 -070048 value.SetI(f->GetInt(o));
Elliott Hughes33203b52011-09-20 19:42:01 -070049 return true;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -070050 case Primitive::kPrimLong:
Elliott Hughesf24d3ce2012-04-11 17:43:37 -070051 value.SetJ(f->GetLong(o));
Elliott Hughes33203b52011-09-20 19:42:01 -070052 return true;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -070053 case Primitive::kPrimShort:
Elliott Hughesf24d3ce2012-04-11 17:43:37 -070054 value.SetS(f->GetShort(o));
Elliott Hughes33203b52011-09-20 19:42:01 -070055 return true;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -070056 case Primitive::kPrimNot:
Elliott Hughes33203b52011-09-20 19:42:01 -070057 if (allow_references) {
Elliott Hughesf24d3ce2012-04-11 17:43:37 -070058 value.SetL(f->GetObject(o));
Elliott Hughes33203b52011-09-20 19:42:01 -070059 return true;
60 }
61 // Else break to report an error.
62 break;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -070063 case Primitive::kPrimVoid:
Elliott Hughes33203b52011-09-20 19:42:01 -070064 // Never okay.
65 break;
66 }
Elliott Hughes5cb5ad22011-10-02 12:13:39 -070067 Thread::Current()->ThrowNewExceptionF("Ljava/lang/IllegalArgumentException;",
Elliott Hughes33203b52011-09-20 19:42:01 -070068 "Not a primitive field: %s", PrettyField(f).c_str());
69 return false;
70}
71
Elliott Hughes0512f022012-03-15 22:10:52 -070072static bool CheckReceiver(JNIEnv* env, jobject javaObj, Field* f, Object*& o) {
Elliott Hughesed1c1e32011-10-02 14:31:05 -070073 if (f->IsStatic()) {
74 o = NULL;
75 return true;
76 }
77
78 o = Decode<Object*>(env, javaObj);
Ian Rogers6d4d9fc2011-11-30 16:24:48 -080079 Class* declaringClass = f->GetDeclaringClass();
Elliott Hugheseac76672012-05-24 21:56:51 -070080 if (!VerifyObjectInClass(o, declaringClass)) {
Elliott Hughesed1c1e32011-10-02 14:31:05 -070081 return false;
82 }
83 return true;
84}
85
Elliott Hughes0512f022012-03-15 22:10:52 -070086static jobject Field_get(JNIEnv* env, jobject javaField, jobject javaObj) {
Elliott Hughes418d20f2011-09-22 14:00:39 -070087 Field* f = DecodeField(env->FromReflectedField(javaField));
Elliott Hughesed1c1e32011-10-02 14:31:05 -070088 Object* o = NULL;
Ian Rogers6d4d9fc2011-11-30 16:24:48 -080089 if (!CheckReceiver(env, javaObj, f, o)) {
90 return NULL;
91 }
92
93 // Get the field's value, boxing if necessary.
Elliott Hughes1d878f32012-04-11 15:17:54 -070094 JValue value;
Ian Rogers6d4d9fc2011-11-30 16:24:48 -080095 if (!GetFieldValue(o, f, value, true)) {
96 return NULL;
97 }
Elliott Hughesdbac3092012-03-16 18:00:30 -070098 BoxPrimitive(FieldHelper(f).GetTypeAsPrimitiveType(), value);
Ian Rogers6d4d9fc2011-11-30 16:24:48 -080099
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700100 return AddLocalReference<jobject>(env, value.GetL());
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800101}
102
Elliott Hughes0512f022012-03-15 22:10:52 -0700103static JValue GetPrimitiveField(JNIEnv* env, jobject javaField, jobject javaObj, char dst_descriptor) {
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800104 Field* f = DecodeField(env->FromReflectedField(javaField));
105 Object* o = NULL;
106 if (!CheckReceiver(env, javaObj, f, o)) {
Elliott Hughesed1c1e32011-10-02 14:31:05 -0700107 return JValue();
Elliott Hughes33203b52011-09-20 19:42:01 -0700108 }
109
110 // Read the value.
Elliott Hughes1d878f32012-04-11 15:17:54 -0700111 JValue field_value;
Elliott Hughes33203b52011-09-20 19:42:01 -0700112 if (!GetFieldValue(o, f, field_value, false)) {
113 return JValue();
114 }
115
116 // Widen it if necessary (and possible).
117 JValue wide_value;
Elliott Hughes582a7d12011-10-10 18:38:42 -0700118 Class* dst_type = Runtime::Current()->GetClassLinker()->FindPrimitiveClass(dst_descriptor);
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800119 if (!ConvertPrimitiveValue(FieldHelper(f).GetTypeAsPrimitiveType(), dst_type->GetPrimitiveType(),
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700120 field_value, wide_value)) {
Elliott Hughes33203b52011-09-20 19:42:01 -0700121 return JValue();
122 }
123 return wide_value;
124}
125
Elliott Hughes0512f022012-03-15 22:10:52 -0700126static jboolean Field_getBoolean(JNIEnv* env, jobject javaField, jobject javaObj) {
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700127 return GetPrimitiveField(env, javaField, javaObj, 'Z').GetZ();
Elliott Hughes33203b52011-09-20 19:42:01 -0700128}
129
Elliott Hughes0512f022012-03-15 22:10:52 -0700130static jbyte Field_getByte(JNIEnv* env, jobject javaField, jobject javaObj) {
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700131 return GetPrimitiveField(env, javaField, javaObj, 'B').GetB();
Elliott Hughes33203b52011-09-20 19:42:01 -0700132}
133
Elliott Hughes0512f022012-03-15 22:10:52 -0700134static jchar Field_getChar(JNIEnv* env, jobject javaField, jobject javaObj) {
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700135 return GetPrimitiveField(env, javaField, javaObj, 'C').GetC();
Elliott Hughes33203b52011-09-20 19:42:01 -0700136}
137
Elliott Hughes0512f022012-03-15 22:10:52 -0700138static jdouble Field_getDouble(JNIEnv* env, jobject javaField, jobject javaObj) {
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700139 return GetPrimitiveField(env, javaField, javaObj, 'D').GetD();
Elliott Hughes33203b52011-09-20 19:42:01 -0700140}
141
Elliott Hughes0512f022012-03-15 22:10:52 -0700142static jfloat Field_getFloat(JNIEnv* env, jobject javaField, jobject javaObj) {
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700143 return GetPrimitiveField(env, javaField, javaObj, 'F').GetF();
Elliott Hughes33203b52011-09-20 19:42:01 -0700144}
145
Elliott Hughes0512f022012-03-15 22:10:52 -0700146static jint Field_getInt(JNIEnv* env, jobject javaField, jobject javaObj) {
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700147 return GetPrimitiveField(env, javaField, javaObj, 'I').GetI();
Elliott Hughes33203b52011-09-20 19:42:01 -0700148}
149
Elliott Hughes0512f022012-03-15 22:10:52 -0700150static jlong Field_getLong(JNIEnv* env, jobject javaField, jobject javaObj) {
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700151 return GetPrimitiveField(env, javaField, javaObj, 'J').GetJ();
Elliott Hughes33203b52011-09-20 19:42:01 -0700152}
153
Elliott Hughes0512f022012-03-15 22:10:52 -0700154static jshort Field_getShort(JNIEnv* env, jobject javaField, jobject javaObj) {
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700155 return GetPrimitiveField(env, javaField, javaObj, 'S').GetS();
Elliott Hughes33203b52011-09-20 19:42:01 -0700156}
157
Elliott Hughes0512f022012-03-15 22:10:52 -0700158static void SetFieldValue(Object* o, Field* f, const JValue& new_value, bool allow_references) {
Ian Rogers0045a292012-03-31 21:08:41 -0700159 if (!Runtime::Current()->GetClassLinker()->EnsureInitialized(f->GetDeclaringClass(), true, true)) {
Elliott Hughes923e8b82012-03-23 11:44:07 -0700160 return;
161 }
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800162 switch (FieldHelper(f).GetTypeAsPrimitiveType()) {
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700163 case Primitive::kPrimBoolean:
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700164 f->SetBoolean(o, new_value.GetZ());
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700165 break;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700166 case Primitive::kPrimByte:
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700167 f->SetByte(o, new_value.GetB());
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700168 break;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700169 case Primitive::kPrimChar:
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700170 f->SetChar(o, new_value.GetC());
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700171 break;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700172 case Primitive::kPrimDouble:
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700173 f->SetDouble(o, new_value.GetD());
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700174 break;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700175 case Primitive::kPrimFloat:
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700176 f->SetFloat(o, new_value.GetF());
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700177 break;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700178 case Primitive::kPrimInt:
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700179 f->SetInt(o, new_value.GetI());
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700180 break;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700181 case Primitive::kPrimLong:
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700182 f->SetLong(o, new_value.GetJ());
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700183 break;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700184 case Primitive::kPrimShort:
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700185 f->SetShort(o, new_value.GetS());
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700186 break;
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700187 case Primitive::kPrimNot:
Elliott Hughes33203b52011-09-20 19:42:01 -0700188 if (allow_references) {
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700189 f->SetObject(o, new_value.GetL());
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700190 break;
Elliott Hughes33203b52011-09-20 19:42:01 -0700191 }
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700192 // Else fall through to report an error.
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700193 case Primitive::kPrimVoid:
Elliott Hughes33203b52011-09-20 19:42:01 -0700194 // Never okay.
Elliott Hughes5cb5ad22011-10-02 12:13:39 -0700195 Thread::Current()->ThrowNewExceptionF("Ljava/lang/IllegalArgumentException;",
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700196 "Not a primitive field: %s", PrettyField(f).c_str());
197 return;
Elliott Hughes33203b52011-09-20 19:42:01 -0700198 }
Elliott Hughesfe6207f2011-09-26 17:24:06 -0700199
200 // Special handling for final fields on SMP systems.
201 // We need a store/store barrier here (JMM requirement).
202 if (f->IsFinal()) {
203 ANDROID_MEMBAR_STORE();
204 }
Elliott Hughes33203b52011-09-20 19:42:01 -0700205}
206
Elliott Hughes0512f022012-03-15 22:10:52 -0700207static void Field_set(JNIEnv* env, jobject javaField, jobject javaObj, jobject javaValue) {
Elliott Hughes34e06962012-04-09 13:55:55 -0700208 ScopedThreadStateChange tsc(Thread::Current(), kRunnable);
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800209 Field* f = DecodeField(env->FromReflectedField(javaField));
210
211 // Unbox the value, if necessary.
212 Object* boxed_value = Decode<Object*>(env, javaValue);
213 JValue unboxed_value;
Elliott Hughesaaa5edc2012-05-16 15:54:30 -0700214 if (!UnboxPrimitiveForField(boxed_value, FieldHelper(f).GetType(), unboxed_value, f)) {
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800215 return;
216 }
217
218 // Check that the receiver is non-null and an instance of the field's declaring class.
219 Object* o = NULL;
220 if (!CheckReceiver(env, javaObj, f, o)) {
221 return;
222 }
223
224 SetFieldValue(o, f, unboxed_value, true);
225}
226
Elliott Hughes0512f022012-03-15 22:10:52 -0700227static void SetPrimitiveField(JNIEnv* env, jobject javaField, jobject javaObj, char src_descriptor,
228 const JValue& new_value) {
Elliott Hughes34e06962012-04-09 13:55:55 -0700229 ScopedThreadStateChange tsc(Thread::Current(), kRunnable);
Elliott Hughes418d20f2011-09-22 14:00:39 -0700230 Field* f = DecodeField(env->FromReflectedField(javaField));
Elliott Hughesed1c1e32011-10-02 14:31:05 -0700231 Object* o = NULL;
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800232 if (!CheckReceiver(env, javaObj, f, o)) {
Elliott Hughesed1c1e32011-10-02 14:31:05 -0700233 return;
Elliott Hughes33203b52011-09-20 19:42:01 -0700234 }
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800235 FieldHelper fh(f);
236 if (!fh.IsPrimitiveType()) {
Jesse Wilsonc129a6b2011-11-24 14:47:46 -0500237 Thread::Current()->ThrowNewExceptionF("Ljava/lang/IllegalArgumentException;",
238 "Not a primitive field: %s", PrettyField(f).c_str());
239 return;
240 }
Elliott Hughes33203b52011-09-20 19:42:01 -0700241
242 // Widen the value if necessary (and possible).
243 JValue wide_value;
Elliott Hughes582a7d12011-10-10 18:38:42 -0700244 Class* src_type = Runtime::Current()->GetClassLinker()->FindPrimitiveClass(src_descriptor);
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800245 if (!ConvertPrimitiveValue(src_type->GetPrimitiveType(), fh.GetTypeAsPrimitiveType(),
Brian Carlstrom6b4ef022011-10-23 14:59:04 -0700246 new_value, wide_value)) {
Elliott Hughes33203b52011-09-20 19:42:01 -0700247 return;
248 }
249
250 // Write the value.
251 SetFieldValue(o, f, wide_value, false);
252}
253
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700254static void Field_setBoolean(JNIEnv* env, jobject javaField, jobject javaObj, jboolean z) {
255 JValue value;
256 value.SetZ(z);
257 SetPrimitiveField(env, javaField, javaObj, 'Z', value);
Elliott Hughes33203b52011-09-20 19:42:01 -0700258}
259
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700260static void Field_setByte(JNIEnv* env, jobject javaField, jobject javaObj, jbyte b) {
261 JValue value;
262 value.SetB(b);
263 SetPrimitiveField(env, javaField, javaObj, 'B', value);
Elliott Hughes33203b52011-09-20 19:42:01 -0700264}
265
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700266static void Field_setChar(JNIEnv* env, jobject javaField, jobject javaObj, jchar c) {
267 JValue value;
268 value.SetC(c);
269 SetPrimitiveField(env, javaField, javaObj, 'C', value);
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800270}
Elliott Hughes33203b52011-09-20 19:42:01 -0700271
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700272static void Field_setDouble(JNIEnv* env, jobject javaField, jobject javaObj, jdouble d) {
273 JValue value;
274 value.SetD(d);
275 SetPrimitiveField(env, javaField, javaObj, 'D', value);
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800276}
Elliott Hughes33203b52011-09-20 19:42:01 -0700277
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700278static void Field_setFloat(JNIEnv* env, jobject javaField, jobject javaObj, jfloat f) {
279 JValue value;
280 value.SetF(f);
281 SetPrimitiveField(env, javaField, javaObj, 'F', value);
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800282}
283
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700284static void Field_setInt(JNIEnv* env, jobject javaField, jobject javaObj, jint i) {
285 JValue value;
286 value.SetI(i);
287 SetPrimitiveField(env, javaField, javaObj, 'I', value);
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800288}
289
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700290static void Field_setLong(JNIEnv* env, jobject javaField, jobject javaObj, jlong j) {
291 JValue value;
292 value.SetJ(j);
293 SetPrimitiveField(env, javaField, javaObj, 'J', value);
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800294}
295
Elliott Hughesf24d3ce2012-04-11 17:43:37 -0700296static void Field_setShort(JNIEnv* env, jobject javaField, jobject javaObj, jshort s) {
297 JValue value;
298 value.SetS(s);
299 SetPrimitiveField(env, javaField, javaObj, 'S', value);
Elliott Hughes33203b52011-09-20 19:42:01 -0700300}
301
Brian Carlstromf867b6f2011-09-16 12:17:25 -0700302static JNINativeMethod gMethods[] = {
Ian Rogers6d4d9fc2011-11-30 16:24:48 -0800303 NATIVE_METHOD(Field, get, "(Ljava/lang/Object;)Ljava/lang/Object;"),
304 NATIVE_METHOD(Field, getBoolean, "(Ljava/lang/Object;)Z"),
305 NATIVE_METHOD(Field, getByte, "(Ljava/lang/Object;)B"),
306 NATIVE_METHOD(Field, getChar, "(Ljava/lang/Object;)C"),
307 NATIVE_METHOD(Field, getDouble, "(Ljava/lang/Object;)D"),
308 NATIVE_METHOD(Field, getFloat, "(Ljava/lang/Object;)F"),
309 NATIVE_METHOD(Field, getInt, "(Ljava/lang/Object;)I"),
310 NATIVE_METHOD(Field, getLong, "(Ljava/lang/Object;)J"),
311 NATIVE_METHOD(Field, getShort, "(Ljava/lang/Object;)S"),
312 NATIVE_METHOD(Field, set, "(Ljava/lang/Object;Ljava/lang/Object;)V"),
313 NATIVE_METHOD(Field, setBoolean, "(Ljava/lang/Object;Z)V"),
314 NATIVE_METHOD(Field, setByte, "(Ljava/lang/Object;B)V"),
315 NATIVE_METHOD(Field, setChar, "(Ljava/lang/Object;C)V"),
316 NATIVE_METHOD(Field, setDouble, "(Ljava/lang/Object;D)V"),
317 NATIVE_METHOD(Field, setFloat, "(Ljava/lang/Object;F)V"),
318 NATIVE_METHOD(Field, setInt, "(Ljava/lang/Object;I)V"),
319 NATIVE_METHOD(Field, setLong, "(Ljava/lang/Object;J)V"),
320 NATIVE_METHOD(Field, setShort, "(Ljava/lang/Object;S)V"),
Brian Carlstromf867b6f2011-09-16 12:17:25 -0700321};
322
Brian Carlstromf867b6f2011-09-16 12:17:25 -0700323void register_java_lang_reflect_Field(JNIEnv* env) {
Elliott Hugheseac76672012-05-24 21:56:51 -0700324 REGISTER_NATIVE_METHODS("java/lang/reflect/Field");
Brian Carlstromf867b6f2011-09-16 12:17:25 -0700325}
326
327} // namespace art