Strengthen annotation-related checks in JNI code.

Instead of clearing unexpected exceptions in JNI code,
assert that they should not happen.

Test: m test-art-host
Bug: 34659969
Change-Id: I7b8d32aa17426e0f37350afec40f07dee73a4b35
diff --git a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
index 813a264..ea7a83c 100644
--- a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
+++ b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
@@ -2185,20 +2185,11 @@
   // Generic JNI trampoline at this stage; instead, method's
   // annotations' classes are looked up in the bootstrap class
   // loader's resolved types (which won't trigger an exception).
+  CHECK(!self->IsExceptionPending());
   bool critical_native = called->IsAnnotatedWithCriticalNative();
-  // ArtMethod::IsAnnotatedWithCriticalNative should not throw
-  // an exception; clear it if it happened anyway.
-  // TODO: Revisit this code path and turn this into a CHECK(!self->IsExceptionPending()).
-  if (self->IsExceptionPending()) {
-    self->ClearException();
-  }
+  CHECK(!self->IsExceptionPending());
   bool fast_native = called->IsAnnotatedWithFastNative();
-  // ArtMethod::IsAnnotatedWithFastNative should not throw
-  // an exception; clear it if it happened anyway.
-  // TODO: Revisit this code path and turn this into a CHECK(!self->IsExceptionPending()).
-  if (self->IsExceptionPending()) {
-    self->ClearException();
-  }
+  CHECK(!self->IsExceptionPending());
   bool normal_native = !critical_native && !fast_native;
   // Restore the initial ArtMethod pointer at `*sp`.
   *sp = called;