Example #1
0
 //
 // Exception audit:
 //
 //  Verdict
 //    Exception wrapping is required.
 //
 //  Rationale
 //    `java.util.List.lastIndexOf(Object)` throws a number of exceptions, see:
 //
 //     https://developer.android.com/reference/java/util/List?hl=en#lastIndexOf(java.lang.Object)
 //
 public virtual int LastIndexOf(object item)
 {
     if (id_lastIndexOf == IntPtr.Zero)
     {
         id_lastIndexOf = JNIEnv.GetMethodID(arraylist_class, "lastIndexOf", "(Ljava/lang/Object;)I");
     }
     return(JavaConvert.WithLocalJniHandle(item, lref => {
         try {
             return JNIEnv.CallIntMethod(Handle, id_lastIndexOf, new JValue(lref));
         } catch (Java.Lang.ClassCastException ex) when(JNIEnv.ShouldWrapJavaException(ex))
         {
             throw new InvalidCastException(ex.Message, ex);
         } catch (Java.Lang.NullPointerException ex) when(JNIEnv.ShouldWrapJavaException(ex))
         {
             throw new NullReferenceException(ex.Message, ex);
         }
     }));
 }