mobile/android/base/mozglue/generatorannotations/WrapElementForJNI.java

branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
equal deleted inserted replaced
-1:000000000000 0:af277b0313d0
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 package org.mozilla.gecko.mozglue.generatorannotations;
6
7 import java.lang.annotation.Retention;
8 import java.lang.annotation.RetentionPolicy;
9
10 /**
11 * This annotation is used to tag methods that are to have wrapper methods generated in the android
12 * bridge. Such methods will be protected from destruction by Proguard, and allow us to avoid writing
13 * by hand large amounts of boring boilerplate.
14 * An annotated Java method will have a corresponding method generated in the android bridge.
15 * By default, the name of the generated method will be the same as the name of the Java method, with
16 * the first letter in upper case. The stubName property may be used to specify a custom name for the
17 * generated method stub.
18 *
19 * allowMultithreaded should be used as sparingly as possible - the resulting code will allow the
20 * Java method to be invoked from the C side from multiple threads. Often, this isn't what is wanted
21 * and may lead to subtle bugs.
22 */
23 @Retention(RetentionPolicy.RUNTIME)
24 public @interface WrapElementForJNI {
25 // Optional parameter specifying the name of the generated method stub. If omitted, the name
26 // of the Java method will be used.
27 String stubName() default "";
28
29 // Optional parameter specifying if the generated method should be a static member of AndroidBridge
30 // By default, an instance member is produced. This is almost always what is wanted.
31 boolean generateStatic() default false;
32
33 /**
34 * If set, the generated method stub will support being called from any thread via the use of
35 * GetJNIForThread. This is rarely useful, at time of writing, as well as possibly risky.
36 * See information in AndroidBridge.cpp regarding GetJNIForThread.
37 *
38 * Did I mention use of this function is discouraged?
39 */
40 boolean allowMultithread() default false;
41
42 /**
43 * If set, the generated stub will not handle uncaught exceptions.
44 * Any exception must be handled or cleared by the code calling the stub.
45 */
46 boolean noThrow() default false;
47 }

mercurial