summaryrefslogtreecommitdiff
path: root/runtime/object_utils.h
diff options
context:
space:
mode:
author Sebastien Hertz <shertz@google.com> 2014-04-01 14:39:44 +0200
committer Sebastien Hertz <shertz@google.com> 2014-04-01 15:20:11 +0200
commit80989a6bf3e24b31c7210c76be81ad40f43c63be (patch)
tree6e3365de360d3d02c14ce614e1755620e8b9f7bb /runtime/object_utils.h
parenta708e32a9f764a48175e705ec4bcd2201c84f492 (diff)
Fix ClassHelper::GetDirectInterface for proxy class
Returns only the direct interfaces implemented by the proxy class. We collect them from the "interfaces" field in the synthesized proxy class instead of looking into the iftable. Also updates proxy_test to reflect this change. Bug: 13689930 Change-Id: I926e2ed30f9e65972d700a378671cec82dedaa7c
Diffstat (limited to 'runtime/object_utils.h')
-rw-r--r--runtime/object_utils.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/runtime/object_utils.h b/runtime/object_utils.h
index 63801d3a3f..072f074e85 100644
--- a/runtime/object_utils.h
+++ b/runtime/object_utils.h
@@ -25,6 +25,7 @@
#include "mirror/class.h"
#include "mirror/dex_cache.h"
#include "mirror/iftable.h"
+#include "mirror/proxy.h"
#include "mirror/string.h"
#include "runtime.h"
@@ -133,7 +134,9 @@ class ClassHelper {
} else if (klass_->IsArrayClass()) {
return 2;
} else if (klass_->IsProxyClass()) {
- return klass_->GetIfTable()->Count();
+ mirror::SynthesizedProxyClass* proxyClass = reinterpret_cast<mirror::SynthesizedProxyClass*>(klass_);
+ mirror::ObjectArray<mirror::Class>* interfaces = proxyClass->GetInterfaces();
+ return interfaces != nullptr ? interfaces->GetLength() : 0;
} else {
const DexFile::TypeList* interfaces = GetInterfaceTypeList();
if (interfaces == nullptr) {
@@ -164,7 +167,10 @@ class ClassHelper {
return GetClassLinker()->FindSystemClass(Thread::Current(), "Ljava/io/Serializable;");
}
} else if (klass_->IsProxyClass()) {
- return klass_->GetIfTable()->GetInterface(idx);
+ mirror::SynthesizedProxyClass* proxyClass = reinterpret_cast<mirror::SynthesizedProxyClass*>(klass_);
+ mirror::ObjectArray<mirror::Class>* interfaces = proxyClass->GetInterfaces();
+ DCHECK(interfaces != nullptr);
+ return interfaces->Get(idx);
} else {
uint16_t type_idx = GetDirectInterfaceTypeIdx(idx);
mirror::Class* interface = GetDexCache()->GetResolvedType(type_idx);