xref: /aosp_15_r20/art/runtime/reflection_test.cc (revision 795d594fd825385562da6b089ea9b2033f3abf5a)
1 /*
2  * Copyright (C) 2011 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 "reflection.h"
18 
19 #include <float.h>
20 #include <limits.h>
21 
22 #include "art_method-inl.h"
23 #include "base/pointer_size.h"
24 #include "common_runtime_test.h"
25 #include "dex/descriptors_names.h"
26 #include "jni/java_vm_ext.h"
27 #include "jni/jni_internal.h"
28 #include "mirror/class-alloc-inl.h"
29 #include "nativehelper/scoped_local_ref.h"
30 #include "scoped_thread_state_change-inl.h"
31 
32 namespace art HIDDEN {
33 
34 class ReflectionTest : public CommonRuntimeTest {
35  protected:
SetUp()36   void SetUp() override {
37     CommonRuntimeTest::SetUp();
38 
39     vm_ = Runtime::Current()->GetJavaVM();
40 
41     // Turn on -verbose:jni for the JNI tests.
42     // gLogVerbosity.jni = true;
43 
44     vm_->AttachCurrentThread(&env_, nullptr);
45 
46     ScopedLocalRef<jclass> aioobe(env_,
47                                   env_->FindClass("java/lang/ArrayIndexOutOfBoundsException"));
48     CHECK(aioobe.get() != nullptr);
49     aioobe_ = reinterpret_cast<jclass>(env_->NewGlobalRef(aioobe.get()));
50 
51     ScopedLocalRef<jclass> ase(env_, env_->FindClass("java/lang/ArrayStoreException"));
52     CHECK(ase.get() != nullptr);
53     ase_ = reinterpret_cast<jclass>(env_->NewGlobalRef(ase.get()));
54 
55     ScopedLocalRef<jclass> sioobe(env_,
56                                   env_->FindClass("java/lang/StringIndexOutOfBoundsException"));
57     CHECK(sioobe.get() != nullptr);
58     sioobe_ = reinterpret_cast<jclass>(env_->NewGlobalRef(sioobe.get()));
59   }
60 
CleanUpJniEnv()61   void CleanUpJniEnv() {
62     if (aioobe_ != nullptr) {
63       env_->DeleteGlobalRef(aioobe_);
64       aioobe_ = nullptr;
65     }
66     if (ase_ != nullptr) {
67       env_->DeleteGlobalRef(ase_);
68       ase_ = nullptr;
69     }
70     if (sioobe_ != nullptr) {
71       env_->DeleteGlobalRef(sioobe_);
72       sioobe_ = nullptr;
73     }
74   }
75 
TearDown()76   void TearDown() override {
77     CleanUpJniEnv();
78     CommonRuntimeTest::TearDown();
79   }
80 
GetPrimitiveClass(char descriptor)81   jclass GetPrimitiveClass(char descriptor) {
82     ScopedObjectAccess soa(env_);
83     ObjPtr<mirror::Class> c = class_linker_->FindPrimitiveClass(descriptor);
84     CHECK(c != nullptr);
85     return soa.AddLocalReference<jclass>(c);
86   }
87 
ReflectionTestMakeInterpreted(ArtMethod ** method,ObjPtr<mirror::Object> * receiver,bool is_static,const char * method_name,const char * method_signature)88   void ReflectionTestMakeInterpreted(ArtMethod** method,
89                                      ObjPtr<mirror::Object>* receiver,
90                                      bool is_static,
91                                      const char* method_name,
92                                      const char* method_signature)
93       REQUIRES_SHARED(Locks::mutator_lock_) {
94     const char* class_name = is_static ? "StaticLeafMethods" : "NonStaticLeafMethods";
95     jobject jclass_loader(LoadDex(class_name));
96     Thread* self = Thread::Current();
97     StackHandleScope<3> hs(self);
98     Handle<mirror::ClassLoader> class_loader(
99         hs.NewHandle(
100             ScopedObjectAccessUnchecked(self).Decode<mirror::ClassLoader>(jclass_loader)));
101     if (!is_static) {
102       MakeInterpreted(class_linker_->FindSystemClass(self, "Ljava/lang/Class;"));
103       MakeInterpreted(class_linker_->FindSystemClass(self, "Ljava/lang/Object;"));
104     }
105 
106     ObjPtr<mirror::Class> c = FindClass(DotToDescriptor(class_name).c_str(), class_loader);
107     CHECK(c != nullptr);
108     MakeInterpreted(c);
109 
110     *method = c->FindClassMethod(method_name, method_signature, kRuntimePointerSize);
111     CHECK(*method != nullptr);
112     CHECK_EQ(is_static, (*method)->IsStatic());
113 
114     if (is_static) {
115       *receiver = nullptr;
116     } else {
117       // Ensure class is initialized before allocating object
118       {
119         StackHandleScope<1> hs2(self);
120         HandleWrapperObjPtr<mirror::Class> h_class(hs2.NewHandleWrapper(&c));
121         bool initialized = class_linker_->EnsureInitialized(self, h_class, true, true);
122         CHECK(initialized);
123       }
124       *receiver = c->AllocObject(self);
125     }
126 
127     // Start runtime.
128     HandleWrapperObjPtr<mirror::Object> h(hs.NewHandleWrapper(receiver));
129     bool started = runtime_->Start();
130     CHECK(started);
131     self->TransitionFromSuspendedToRunnable();
132   }
133 
InvokeNopMethod(bool is_static)134   void InvokeNopMethod(bool is_static) {
135     ScopedObjectAccess soa(env_);
136     ArtMethod* method;
137     ObjPtr<mirror::Object> receiver;
138     ReflectionTestMakeInterpreted(&method, &receiver, is_static, "nop", "()V");
139     ScopedLocalRef<jobject> receiver_ref(soa.Env(), soa.AddLocalReference<jobject>(receiver));
140     InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), nullptr);
141   }
142 
InvokeIdentityByteMethod(bool is_static)143   void InvokeIdentityByteMethod(bool is_static) {
144     ScopedObjectAccess soa(env_);
145     ArtMethod* method;
146     ObjPtr<mirror::Object> receiver;
147     ReflectionTestMakeInterpreted(&method, &receiver, is_static, "identity", "(B)B");
148     ScopedLocalRef<jobject> receiver_ref(soa.Env(), soa.AddLocalReference<jobject>(receiver));
149     jvalue args[1];
150 
151     args[0].b = 0;
152     JValue result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
153     EXPECT_EQ(0, result.GetB());
154 
155     args[0].b = -1;
156     result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
157     EXPECT_EQ(-1, result.GetB());
158 
159     args[0].b = SCHAR_MAX;
160     result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
161     EXPECT_EQ(SCHAR_MAX, result.GetB());
162 
163     static_assert(SCHAR_MIN == -128, "SCHAR_MIN unexpected");
164     args[0].b = SCHAR_MIN;
165     result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
166     EXPECT_EQ(SCHAR_MIN, result.GetB());
167   }
168 
InvokeIdentityIntMethod(bool is_static)169   void InvokeIdentityIntMethod(bool is_static) {
170     ScopedObjectAccess soa(env_);
171     ArtMethod* method;
172     ObjPtr<mirror::Object> receiver;
173     ReflectionTestMakeInterpreted(&method, &receiver, is_static, "identity", "(I)I");
174     ScopedLocalRef<jobject> receiver_ref(soa.Env(), soa.AddLocalReference<jobject>(receiver));
175     jvalue args[1];
176 
177     args[0].i = 0;
178     JValue result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
179     EXPECT_EQ(0, result.GetI());
180 
181     args[0].i = -1;
182     result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
183     EXPECT_EQ(-1, result.GetI());
184 
185     args[0].i = INT_MAX;
186     result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
187     EXPECT_EQ(INT_MAX, result.GetI());
188 
189     args[0].i = INT_MIN;
190     result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
191     EXPECT_EQ(INT_MIN, result.GetI());
192   }
193 
InvokeIdentityDoubleMethod(bool is_static)194   void InvokeIdentityDoubleMethod(bool is_static) {
195     ScopedObjectAccess soa(env_);
196     ArtMethod* method;
197     ObjPtr<mirror::Object> receiver;
198     ReflectionTestMakeInterpreted(&method, &receiver, is_static, "identity", "(D)D");
199     ScopedLocalRef<jobject> receiver_ref(soa.Env(), soa.AddLocalReference<jobject>(receiver));
200     jvalue args[1];
201 
202     args[0].d = 0.0;
203     JValue result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
204     EXPECT_DOUBLE_EQ(0.0, result.GetD());
205 
206     args[0].d = -1.0;
207     result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
208     EXPECT_DOUBLE_EQ(-1.0, result.GetD());
209 
210     args[0].d = DBL_MAX;
211     result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
212     EXPECT_DOUBLE_EQ(DBL_MAX, result.GetD());
213 
214     args[0].d = DBL_MIN;
215     result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
216     EXPECT_DOUBLE_EQ(DBL_MIN, result.GetD());
217   }
218 
InvokeSumIntIntMethod(bool is_static)219   void InvokeSumIntIntMethod(bool is_static) {
220     ScopedObjectAccess soa(env_);
221     ArtMethod* method;
222     ObjPtr<mirror::Object> receiver;
223     ReflectionTestMakeInterpreted(&method, &receiver, is_static, "sum", "(II)I");
224     ScopedLocalRef<jobject> receiver_ref(soa.Env(), soa.AddLocalReference<jobject>(receiver));
225     jvalue args[2];
226 
227     args[0].i = 1;
228     args[1].i = 2;
229     JValue result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
230     EXPECT_EQ(3, result.GetI());
231 
232     args[0].i = -2;
233     args[1].i = 5;
234     result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
235     EXPECT_EQ(3, result.GetI());
236 
237     args[0].i = INT_MAX;
238     args[1].i = INT_MIN;
239     result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
240     EXPECT_EQ(-1, result.GetI());
241 
242     args[0].i = INT_MAX;
243     args[1].i = INT_MAX;
244     result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
245     EXPECT_EQ(-2, result.GetI());
246   }
247 
InvokeSumIntIntIntMethod(bool is_static)248   void InvokeSumIntIntIntMethod(bool is_static) {
249     ScopedObjectAccess soa(env_);
250     ArtMethod* method;
251     ObjPtr<mirror::Object> receiver;
252     ReflectionTestMakeInterpreted(&method, &receiver, is_static, "sum", "(III)I");
253     ScopedLocalRef<jobject> receiver_ref(soa.Env(), soa.AddLocalReference<jobject>(receiver));
254     jvalue args[3];
255 
256     args[0].i = 0;
257     args[1].i = 0;
258     args[2].i = 0;
259     JValue result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
260     EXPECT_EQ(0, result.GetI());
261 
262     args[0].i = 1;
263     args[1].i = 2;
264     args[2].i = 3;
265     result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
266     EXPECT_EQ(6, result.GetI());
267 
268     args[0].i = -1;
269     args[1].i = 2;
270     args[2].i = -3;
271     result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
272     EXPECT_EQ(-2, result.GetI());
273 
274     args[0].i = INT_MAX;
275     args[1].i = INT_MIN;
276     args[2].i = INT_MAX;
277     result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
278     EXPECT_EQ(2147483646, result.GetI());
279 
280     args[0].i = INT_MAX;
281     args[1].i = INT_MAX;
282     args[2].i = INT_MAX;
283     result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
284     EXPECT_EQ(2147483645, result.GetI());
285   }
286 
InvokeSumIntIntIntIntMethod(bool is_static)287   void InvokeSumIntIntIntIntMethod(bool is_static) {
288     ScopedObjectAccess soa(env_);
289     ArtMethod* method;
290     ObjPtr<mirror::Object> receiver;
291     ReflectionTestMakeInterpreted(&method, &receiver, is_static, "sum", "(IIII)I");
292     ScopedLocalRef<jobject> receiver_ref(soa.Env(), soa.AddLocalReference<jobject>(receiver));
293     jvalue args[4];
294 
295     args[0].i = 0;
296     args[1].i = 0;
297     args[2].i = 0;
298     args[3].i = 0;
299     JValue result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
300     EXPECT_EQ(0, result.GetI());
301 
302     args[0].i = 1;
303     args[1].i = 2;
304     args[2].i = 3;
305     args[3].i = 4;
306     result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
307     EXPECT_EQ(10, result.GetI());
308 
309     args[0].i = -1;
310     args[1].i = 2;
311     args[2].i = -3;
312     args[3].i = 4;
313     result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
314     EXPECT_EQ(2, result.GetI());
315 
316     args[0].i = INT_MAX;
317     args[1].i = INT_MIN;
318     args[2].i = INT_MAX;
319     args[3].i = INT_MIN;
320     result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
321     EXPECT_EQ(-2, result.GetI());
322 
323     args[0].i = INT_MAX;
324     args[1].i = INT_MAX;
325     args[2].i = INT_MAX;
326     args[3].i = INT_MAX;
327     result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
328     EXPECT_EQ(-4, result.GetI());
329   }
330 
InvokeSumIntIntIntIntIntMethod(bool is_static)331   void InvokeSumIntIntIntIntIntMethod(bool is_static) {
332     ScopedObjectAccess soa(env_);
333     ArtMethod* method;
334     ObjPtr<mirror::Object> receiver;
335     ReflectionTestMakeInterpreted(&method, &receiver, is_static, "sum", "(IIIII)I");
336     ScopedLocalRef<jobject> receiver_ref(soa.Env(), soa.AddLocalReference<jobject>(receiver));
337     jvalue args[5];
338 
339     args[0].i = 0;
340     args[1].i = 0;
341     args[2].i = 0;
342     args[3].i = 0;
343     args[4].i = 0;
344     JValue result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
345     EXPECT_EQ(0, result.GetI());
346 
347     args[0].i = 1;
348     args[1].i = 2;
349     args[2].i = 3;
350     args[3].i = 4;
351     args[4].i = 5;
352     result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
353     EXPECT_EQ(15, result.GetI());
354 
355     args[0].i = -1;
356     args[1].i = 2;
357     args[2].i = -3;
358     args[3].i = 4;
359     args[4].i = -5;
360     result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
361     EXPECT_EQ(-3, result.GetI());
362 
363     args[0].i = INT_MAX;
364     args[1].i = INT_MIN;
365     args[2].i = INT_MAX;
366     args[3].i = INT_MIN;
367     args[4].i = INT_MAX;
368     result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
369     EXPECT_EQ(2147483645, result.GetI());
370 
371     args[0].i = INT_MAX;
372     args[1].i = INT_MAX;
373     args[2].i = INT_MAX;
374     args[3].i = INT_MAX;
375     args[4].i = INT_MAX;
376     result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
377     EXPECT_EQ(2147483643, result.GetI());
378   }
379 
InvokeSumDoubleDoubleMethod(bool is_static)380   void InvokeSumDoubleDoubleMethod(bool is_static) {
381     ScopedObjectAccess soa(env_);
382     ArtMethod* method;
383     ObjPtr<mirror::Object> receiver;
384     ReflectionTestMakeInterpreted(&method, &receiver, is_static, "sum", "(DD)D");
385     ScopedLocalRef<jobject> receiver_ref(soa.Env(), soa.AddLocalReference<jobject>(receiver));
386     jvalue args[2];
387 
388     args[0].d = 0.0;
389     args[1].d = 0.0;
390     JValue result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
391     EXPECT_DOUBLE_EQ(0.0, result.GetD());
392 
393     args[0].d = 1.0;
394     args[1].d = 2.0;
395     result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
396     EXPECT_DOUBLE_EQ(3.0, result.GetD());
397 
398     args[0].d = 1.0;
399     args[1].d = -2.0;
400     result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
401     EXPECT_DOUBLE_EQ(-1.0, result.GetD());
402 
403     args[0].d = DBL_MAX;
404     args[1].d = DBL_MIN;
405     result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
406     EXPECT_DOUBLE_EQ(1.7976931348623157e308, result.GetD());
407 
408     args[0].d = DBL_MAX;
409     args[1].d = DBL_MAX;
410     result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
411     EXPECT_DOUBLE_EQ(INFINITY, result.GetD());
412   }
413 
InvokeSumDoubleDoubleDoubleMethod(bool is_static)414   void InvokeSumDoubleDoubleDoubleMethod(bool is_static) {
415     ScopedObjectAccess soa(env_);
416     ArtMethod* method;
417     ObjPtr<mirror::Object> receiver;
418     ReflectionTestMakeInterpreted(&method, &receiver, is_static, "sum", "(DDD)D");
419     ScopedLocalRef<jobject> receiver_ref(soa.Env(), soa.AddLocalReference<jobject>(receiver));
420     jvalue args[3];
421 
422     args[0].d = 0.0;
423     args[1].d = 0.0;
424     args[2].d = 0.0;
425     JValue result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
426     EXPECT_DOUBLE_EQ(0.0, result.GetD());
427 
428     args[0].d = 1.0;
429     args[1].d = 2.0;
430     args[2].d = 3.0;
431     result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
432     EXPECT_DOUBLE_EQ(6.0, result.GetD());
433 
434     args[0].d = 1.0;
435     args[1].d = -2.0;
436     args[2].d = 3.0;
437     result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
438     EXPECT_DOUBLE_EQ(2.0, result.GetD());
439   }
440 
InvokeSumDoubleDoubleDoubleDoubleMethod(bool is_static)441   void InvokeSumDoubleDoubleDoubleDoubleMethod(bool is_static) {
442     ScopedObjectAccess soa(env_);
443     ArtMethod* method;
444     ObjPtr<mirror::Object> receiver;
445     ReflectionTestMakeInterpreted(&method, &receiver, is_static, "sum", "(DDDD)D");
446     ScopedLocalRef<jobject> receiver_ref(soa.Env(), soa.AddLocalReference<jobject>(receiver));
447     jvalue args[4];
448 
449     args[0].d = 0.0;
450     args[1].d = 0.0;
451     args[2].d = 0.0;
452     args[3].d = 0.0;
453     JValue result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
454     EXPECT_DOUBLE_EQ(0.0, result.GetD());
455 
456     args[0].d = 1.0;
457     args[1].d = 2.0;
458     args[2].d = 3.0;
459     args[3].d = 4.0;
460     result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
461     EXPECT_DOUBLE_EQ(10.0, result.GetD());
462 
463     args[0].d = 1.0;
464     args[1].d = -2.0;
465     args[2].d = 3.0;
466     args[3].d = -4.0;
467     result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
468     EXPECT_DOUBLE_EQ(-2.0, result.GetD());
469   }
470 
InvokeSumDoubleDoubleDoubleDoubleDoubleMethod(bool is_static)471   void InvokeSumDoubleDoubleDoubleDoubleDoubleMethod(bool is_static) {
472     ScopedObjectAccess soa(env_);
473     ArtMethod* method;
474     ObjPtr<mirror::Object> receiver;
475     ReflectionTestMakeInterpreted(&method, &receiver, is_static, "sum", "(DDDDD)D");
476     ScopedLocalRef<jobject> receiver_ref(soa.Env(), soa.AddLocalReference<jobject>(receiver));
477     jvalue args[5];
478 
479     args[0].d = 0.0;
480     args[1].d = 0.0;
481     args[2].d = 0.0;
482     args[3].d = 0.0;
483     args[4].d = 0.0;
484     JValue result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
485     EXPECT_DOUBLE_EQ(0.0, result.GetD());
486 
487     args[0].d = 1.0;
488     args[1].d = 2.0;
489     args[2].d = 3.0;
490     args[3].d = 4.0;
491     args[4].d = 5.0;
492     result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
493     EXPECT_DOUBLE_EQ(15.0, result.GetD());
494 
495     args[0].d = 1.0;
496     args[1].d = -2.0;
497     args[2].d = 3.0;
498     args[3].d = -4.0;
499     args[4].d = 5.0;
500     result = InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), args);
501     EXPECT_DOUBLE_EQ(3.0, result.GetD());
502   }
503 
504   JavaVMExt* vm_;
505   JNIEnv* env_;
506   jclass aioobe_;
507   jclass ase_;
508   jclass sioobe_;
509 };
510 
TEST_F(ReflectionTest,StaticNopMethod)511 TEST_F(ReflectionTest, StaticNopMethod) {
512   InvokeNopMethod(true);
513 }
514 
TEST_F(ReflectionTest,NonStaticNopMethod)515 TEST_F(ReflectionTest, NonStaticNopMethod) {
516   InvokeNopMethod(false);
517 }
518 
TEST_F(ReflectionTest,StaticIdentityByteMethod)519 TEST_F(ReflectionTest, StaticIdentityByteMethod) {
520   InvokeIdentityByteMethod(true);
521 }
522 
TEST_F(ReflectionTest,NonStaticIdentityByteMethod)523 TEST_F(ReflectionTest, NonStaticIdentityByteMethod) {
524   InvokeIdentityByteMethod(false);
525 }
526 
TEST_F(ReflectionTest,StaticIdentityIntMethod)527 TEST_F(ReflectionTest, StaticIdentityIntMethod) {
528   InvokeIdentityIntMethod(true);
529 }
530 
TEST_F(ReflectionTest,NonStaticIdentityIntMethod)531 TEST_F(ReflectionTest, NonStaticIdentityIntMethod) {
532   InvokeIdentityIntMethod(false);
533 }
534 
TEST_F(ReflectionTest,StaticIdentityDoubleMethod)535 TEST_F(ReflectionTest, StaticIdentityDoubleMethod) {
536   InvokeIdentityDoubleMethod(true);
537 }
538 
TEST_F(ReflectionTest,NonStaticIdentityDoubleMethod)539 TEST_F(ReflectionTest, NonStaticIdentityDoubleMethod) {
540   InvokeIdentityDoubleMethod(false);
541 }
542 
TEST_F(ReflectionTest,StaticSumIntIntMethod)543 TEST_F(ReflectionTest, StaticSumIntIntMethod) {
544   InvokeSumIntIntMethod(true);
545 }
546 
TEST_F(ReflectionTest,NonStaticSumIntIntMethod)547 TEST_F(ReflectionTest, NonStaticSumIntIntMethod) {
548   InvokeSumIntIntMethod(false);
549 }
550 
TEST_F(ReflectionTest,StaticSumIntIntIntMethod)551 TEST_F(ReflectionTest, StaticSumIntIntIntMethod) {
552   InvokeSumIntIntIntMethod(true);
553 }
554 
TEST_F(ReflectionTest,NonStaticSumIntIntIntMethod)555 TEST_F(ReflectionTest, NonStaticSumIntIntIntMethod) {
556   InvokeSumIntIntIntMethod(false);
557 }
558 
TEST_F(ReflectionTest,StaticSumIntIntIntIntMethod)559 TEST_F(ReflectionTest, StaticSumIntIntIntIntMethod) {
560   InvokeSumIntIntIntIntMethod(true);
561 }
562 
TEST_F(ReflectionTest,NonStaticSumIntIntIntIntMethod)563 TEST_F(ReflectionTest, NonStaticSumIntIntIntIntMethod) {
564   InvokeSumIntIntIntIntMethod(false);
565 }
566 
TEST_F(ReflectionTest,StaticSumIntIntIntIntIntMethod)567 TEST_F(ReflectionTest, StaticSumIntIntIntIntIntMethod) {
568   InvokeSumIntIntIntIntIntMethod(true);
569 }
570 
TEST_F(ReflectionTest,NonStaticSumIntIntIntIntIntMethod)571 TEST_F(ReflectionTest, NonStaticSumIntIntIntIntIntMethod) {
572   InvokeSumIntIntIntIntIntMethod(false);
573 }
574 
TEST_F(ReflectionTest,StaticSumDoubleDoubleMethod)575 TEST_F(ReflectionTest, StaticSumDoubleDoubleMethod) {
576   InvokeSumDoubleDoubleMethod(true);
577 }
578 
TEST_F(ReflectionTest,NonStaticSumDoubleDoubleMethod)579 TEST_F(ReflectionTest, NonStaticSumDoubleDoubleMethod) {
580   InvokeSumDoubleDoubleMethod(false);
581 }
582 
TEST_F(ReflectionTest,StaticSumDoubleDoubleDoubleMethod)583 TEST_F(ReflectionTest, StaticSumDoubleDoubleDoubleMethod) {
584   InvokeSumDoubleDoubleDoubleMethod(true);
585 }
586 
TEST_F(ReflectionTest,NonStaticSumDoubleDoubleDoubleMethod)587 TEST_F(ReflectionTest, NonStaticSumDoubleDoubleDoubleMethod) {
588   InvokeSumDoubleDoubleDoubleMethod(false);
589 }
590 
TEST_F(ReflectionTest,StaticSumDoubleDoubleDoubleDoubleMethod)591 TEST_F(ReflectionTest, StaticSumDoubleDoubleDoubleDoubleMethod) {
592   InvokeSumDoubleDoubleDoubleDoubleMethod(true);
593 }
594 
TEST_F(ReflectionTest,NonStaticSumDoubleDoubleDoubleDoubleMethod)595 TEST_F(ReflectionTest, NonStaticSumDoubleDoubleDoubleDoubleMethod) {
596   InvokeSumDoubleDoubleDoubleDoubleMethod(false);
597 }
598 
TEST_F(ReflectionTest,StaticSumDoubleDoubleDoubleDoubleDoubleMethod)599 TEST_F(ReflectionTest, StaticSumDoubleDoubleDoubleDoubleDoubleMethod) {
600   InvokeSumDoubleDoubleDoubleDoubleDoubleMethod(true);
601 }
602 
TEST_F(ReflectionTest,NonStaticSumDoubleDoubleDoubleDoubleDoubleMethod)603 TEST_F(ReflectionTest, NonStaticSumDoubleDoubleDoubleDoubleDoubleMethod) {
604   InvokeSumDoubleDoubleDoubleDoubleDoubleMethod(false);
605 }
606 
607 }  // namespace art
608