Bug 1049105: Prevent application of annotations to incorrect entity types. r=kats

This commit is contained in:
Chris Kitching 2014-08-05 21:13:49 -07:00
parent 6c62798b21
commit 0a4691f9c7
7 changed files with 21 additions and 0 deletions

View File

@ -4,8 +4,11 @@
package org.mozilla.gecko.mozglue;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target({ElementType.TYPE, ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.FIELD})
@Retention(RetentionPolicy.CLASS)
public @interface JNITarget {}

View File

@ -4,9 +4,12 @@
package org.mozilla.gecko.mozglue;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target({ElementType.TYPE, ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.FIELD})
@Retention(RetentionPolicy.CLASS)
public @interface RobocopTarget {}

View File

@ -4,8 +4,11 @@
package org.mozilla.gecko.mozglue;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target({ElementType.TYPE, ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.FIELD})
@Retention(RetentionPolicy.CLASS)
public @interface WebRTCJNITarget {}

View File

@ -4,9 +4,12 @@
package org.mozilla.gecko.mozglue.generatorannotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface GeneratorOptions {
// Specifies a custom name for the generated C++ class. If left empty, is AndroidJavaClassName.

View File

@ -4,8 +4,10 @@
package org.mozilla.gecko.mozglue.generatorannotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Used to annotate parameters which are optional on the C++ side of the bridge. The annotation is
@ -14,5 +16,6 @@ import java.lang.annotation.RetentionPolicy;
* The default values are zero for numerical types, false for booleans, "" for strings, and null
* for all other reference types.
*/
@Target({ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
public @interface OptionalGeneratedParameter {}

View File

@ -4,8 +4,10 @@
package org.mozilla.gecko.mozglue.generatorannotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* This annotation is used to tag methods that are to have wrapper methods generated in the android
@ -20,6 +22,7 @@ import java.lang.annotation.RetentionPolicy;
* Java method to be invoked from the C side from multiple threads. Often, this isn't what is wanted
* and may lead to subtle bugs.
*/
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR})
@Retention(RetentionPolicy.RUNTIME)
public @interface WrapElementForJNI {
// Optional parameter specifying the name of the generated method stub. If omitted, the name

View File

@ -4,12 +4,15 @@
package org.mozilla.gecko.mozglue.generatorannotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Handy shortcut annotation. Functionally equivalent to tagging every member individually with default
* settings.
*/
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface WrapEntireClassForJNI {}