summaryrefslogtreecommitdiffstats
path: root/runtime/mirror/object_test.cc
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2014-05-21 17:43:44 -0700
committerMathieu Chartier <mathieuc@google.com>2014-06-09 12:46:32 -0700
commitbfd9a4378eacaf2dc2bbe05ad48c5164fc93c9fe (patch)
tree3d3f667c8232a9c1bb6fe9daea0d364f9ae01d8c /runtime/mirror/object_test.cc
parent2e1ca953c7fb165da36cc26ea74d3045d7e272c8 (diff)
downloadart-bfd9a4378eacaf2dc2bbe05ad48c5164fc93c9fe.zip
art-bfd9a4378eacaf2dc2bbe05ad48c5164fc93c9fe.tar.gz
art-bfd9a4378eacaf2dc2bbe05ad48c5164fc93c9fe.tar.bz2
Change MethodHelper to use a Handle.
Added ConstHandle to help prevent errors where you modify the value stored in the handle of the caller. Also fixed compaction bugs related to not knowing MethodHelper::GetReturnType can resolve types. This bug was present in interpreter RETURN_OBJECT. Bug: 13077697 Change-Id: I71f964d4d810ab4debda1a09bc968af8f3c874a3
Diffstat (limited to 'runtime/mirror/object_test.cc')
-rw-r--r--runtime/mirror/object_test.cc30
1 files changed, 11 insertions, 19 deletions
diff --git a/runtime/mirror/object_test.cc b/runtime/mirror/object_test.cc
index 18e50ce..f85fb27 100644
--- a/runtime/mirror/object_test.cc
+++ b/runtime/mirror/object_test.cc
@@ -451,7 +451,7 @@ TEST_F(ObjectTest, DescriptorCompare) {
jobject jclass_loader_1 = LoadDex("ProtoCompare");
jobject jclass_loader_2 = LoadDex("ProtoCompare2");
- StackHandleScope<2> hs(soa.Self());
+ StackHandleScope<4> hs(soa.Self());
Handle<ClassLoader> class_loader_1(hs.NewHandle(soa.Decode<ClassLoader*>(jclass_loader_1)));
Handle<ClassLoader> class_loader_2(hs.NewHandle(soa.Decode<ClassLoader*>(jclass_loader_2)));
@@ -461,33 +461,25 @@ TEST_F(ObjectTest, DescriptorCompare) {
ASSERT_TRUE(klass2 != NULL);
ArtMethod* m1_1 = klass1->GetVirtualMethod(0);
- MethodHelper mh(m1_1);
- EXPECT_STREQ(mh.GetName(), "m1");
+ EXPECT_STREQ(m1_1->GetName(), "m1");
ArtMethod* m2_1 = klass1->GetVirtualMethod(1);
- mh.ChangeMethod(m2_1);
- EXPECT_STREQ(mh.GetName(), "m2");
+ EXPECT_STREQ(m2_1->GetName(), "m2");
ArtMethod* m3_1 = klass1->GetVirtualMethod(2);
- mh.ChangeMethod(m3_1);
- EXPECT_STREQ(mh.GetName(), "m3");
+ EXPECT_STREQ(m3_1->GetName(), "m3");
ArtMethod* m4_1 = klass1->GetVirtualMethod(3);
- mh.ChangeMethod(m4_1);
- EXPECT_STREQ(mh.GetName(), "m4");
+ EXPECT_STREQ(m4_1->GetName(), "m4");
ArtMethod* m1_2 = klass2->GetVirtualMethod(0);
- mh.ChangeMethod(m1_2);
- EXPECT_STREQ(mh.GetName(), "m1");
+ EXPECT_STREQ(m1_2->GetName(), "m1");
ArtMethod* m2_2 = klass2->GetVirtualMethod(1);
- mh.ChangeMethod(m2_2);
- EXPECT_STREQ(mh.GetName(), "m2");
+ EXPECT_STREQ(m2_2->GetName(), "m2");
ArtMethod* m3_2 = klass2->GetVirtualMethod(2);
- mh.ChangeMethod(m3_2);
- EXPECT_STREQ(mh.GetName(), "m3");
+ EXPECT_STREQ(m3_2->GetName(), "m3");
ArtMethod* m4_2 = klass2->GetVirtualMethod(3);
- mh.ChangeMethod(m4_2);
- EXPECT_STREQ(mh.GetName(), "m4");
+ EXPECT_STREQ(m4_2->GetName(), "m4");
- mh.ChangeMethod(m1_1);
- MethodHelper mh2(m1_2);
+ MethodHelper mh(hs.NewHandle(m1_1));
+ MethodHelper mh2(hs.NewHandle(m1_2));
EXPECT_TRUE(mh.HasSameNameAndSignature(&mh2));
EXPECT_TRUE(mh2.HasSameNameAndSignature(&mh));