Fix native annotations returning TypeNotPresentException.
Also adds test cases for inner classes and TypeNotPresentException.
Change-Id: I28041af455f09b43fcf0b07b79b5a21d4741079b
diff --git a/runtime/dex_file.cc b/runtime/dex_file.cc
index 29413bf..5526883 100644
--- a/runtime/dex_file.cc
+++ b/runtime/dex_file.cc
@@ -1787,8 +1787,15 @@
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;