From 80989a6bf3e24b31c7210c76be81ad40f43c63be Mon Sep 17 00:00:00 2001 From: Sebastien Hertz Date: Tue, 1 Apr 2014 14:39:44 +0200 Subject: 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 --- runtime/object_utils.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'runtime/object_utils.h') 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(klass_); + mirror::ObjectArray* 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(klass_); + mirror::ObjectArray* interfaces = proxyClass->GetInterfaces(); + DCHECK(interfaces != nullptr); + return interfaces->Get(idx); } else { uint16_t type_idx = GetDirectInterfaceTypeIdx(idx); mirror::Class* interface = GetDexCache()->GetResolvedType(type_idx); -- cgit v1.2.3-59-g8ed1b