From fc8d247275d06047c652abbdd368fe784bf85e67 Mon Sep 17 00:00:00 2001 From: Jeff Hao Date: Wed, 2 Sep 2015 13:52:20 -0700 Subject: Fix native annotations returning TypeNotPresentException. Also adds test cases for inner classes and TypeNotPresentException. Change-Id: I28041af455f09b43fcf0b07b79b5a21d4741079b --- runtime/dex_file.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'runtime/dex_file.cc') diff --git a/runtime/dex_file.cc b/runtime/dex_file.cc index 29413bf830..5526883330 100644 --- a/runtime/dex_file.cc +++ b/runtime/dex_file.cc @@ -1787,8 +1787,15 @@ bool DexFile::ProcessAnnotationValue(Handle klass, const uint8_t* klass->GetDexFile(), index, klass.Get()); set_object = true; if (element_object == nullptr) { - // TODO: Put a TypeNotFoundExceptionProxy instead of throwing here. - return false; + CHECK(self->IsExceptionPending()); + if (result_style == kAllObjects) { + const char* msg = StringByTypeIdx(index); + self->ThrowNewWrappedException("Ljava/lang/TypeNotPresentException;", msg); + element_object = self->GetException(); + self->ClearException(); + } else { + return false; + } } } break; -- cgit v1.2.3