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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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/. */
     5 package org.mozilla.gecko.mozglue.generatorannotations;
     7 import java.lang.annotation.Retention;
     8 import java.lang.annotation.RetentionPolicy;
    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 "";
    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;
    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;
    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