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