1 // Copyright 2012 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 package org.jni_zero; 6 7 import java.lang.annotation.ElementType; 8 import java.lang.annotation.Retention; 9 import java.lang.annotation.RetentionPolicy; 10 import java.lang.annotation.Target; 11 12 /** 13 * Similar to {@link CalledByNative}, this also exposes JNI bindings to native code. The main 14 * difference is this <b>will not</b> crash the browser process if the Java method throws an 15 * exception. However, the C++ caller <b>must</b> handle and clear the exception before calling into 16 * any other Java code, otherwise the next Java method call will crash (with the previous call's 17 * exception, which leads to a very confusing debugging experience). 18 * 19 * <p>Usage of this annotation should be very rare; due to the complexity of correctly handling 20 * exceptions in C++, prefer using {@link CalledByNative}. 21 */ 22 @Target(ElementType.METHOD) 23 @Retention(RetentionPolicy.CLASS) 24 public @interface CalledByNativeUnchecked { 25 /* 26 * If present, tells which inner class the method belongs to. 27 */ value()28 public String value() default ""; 29 } 30