diff options
| author | Tor Norbye <tnorbye@google.com> | 2015-03-18 09:01:58 -0700 |
|---|---|---|
| committer | Tor Norbye <tnorbye@google.com> | 2015-03-30 07:56:10 -0700 |
| commit | 9b2e27b330a5047774442f112efd8ba40b046c39 (patch) | |
| tree | 518a29a27e6e6f4dcfb1c6164b25a7967a650e1b /annotations | |
| parent | 39d9fd414e278052a378e5825b66728aaf63def6 (diff) | |
| download | android_frameworks_support-9b2e27b330a5047774442f112efd8ba40b046c39.tar.gz android_frameworks_support-9b2e27b330a5047774442f112efd8ba40b046c39.tar.bz2 android_frameworks_support-9b2e27b330a5047774442f112efd8ba40b046c39.zip | |
Update annotation retention for resource type annotations
The resource type annotations in the support library should use
class file retention. That's more compact than having to use external
annotations for these. (IntDef and StringDef on the other hand should
just use source retention, since the class file format for annotations
only allows storing the values of the constants they refer to, not
references to the constants.)
Also allows the resource type annotations to be applied to local
variables as requested in
150475: Update Res support annotations to permit LOCAL_VARIABLE
annotations
Change-Id: I29bdfe3c258b349bd6c2a89c41b2bb76454d0ed4
Diffstat (limited to 'annotations')
23 files changed, 88 insertions, 69 deletions
diff --git a/annotations/src/android/support/annotation/AnimRes.java b/annotations/src/android/support/annotation/AnimRes.java index d613ba90ad..906461b07e 100644 --- a/annotations/src/android/support/annotation/AnimRes.java +++ b/annotations/src/android/support/annotation/AnimRes.java @@ -20,16 +20,17 @@ import java.lang.annotation.Retention; import java.lang.annotation.Target; import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.LOCAL_VARIABLE; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; -import static java.lang.annotation.RetentionPolicy.SOURCE; +import static java.lang.annotation.RetentionPolicy.CLASS; /** * Denotes that an integer parameter, field or method return value is expected * to be an anim resource reference (e.g. {@link android.R.anim#fade_in}). */ @Documented -@Retention(SOURCE) -@Target({METHOD, PARAMETER, FIELD}) +@Retention(CLASS) +@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE}) public @interface AnimRes { } diff --git a/annotations/src/android/support/annotation/AnimatorRes.java b/annotations/src/android/support/annotation/AnimatorRes.java index b7843c051b..468123694c 100644 --- a/annotations/src/android/support/annotation/AnimatorRes.java +++ b/annotations/src/android/support/annotation/AnimatorRes.java @@ -20,16 +20,17 @@ import java.lang.annotation.Retention; import java.lang.annotation.Target; import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.LOCAL_VARIABLE; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; -import static java.lang.annotation.RetentionPolicy.SOURCE; +import static java.lang.annotation.RetentionPolicy.CLASS; /** * Denotes that an integer parameter, field or method return value is expected * to be an animator resource reference (e.g. {@link android.R.animator#fade_in}). */ @Documented -@Retention(SOURCE) -@Target({METHOD, PARAMETER, FIELD}) +@Retention(CLASS) +@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE}) public @interface AnimatorRes { } diff --git a/annotations/src/android/support/annotation/AnyRes.java b/annotations/src/android/support/annotation/AnyRes.java index 50f9e273e6..e831289e3d 100644 --- a/annotations/src/android/support/annotation/AnyRes.java +++ b/annotations/src/android/support/annotation/AnyRes.java @@ -20,9 +20,10 @@ import java.lang.annotation.Retention; import java.lang.annotation.Target; import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.LOCAL_VARIABLE; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; -import static java.lang.annotation.RetentionPolicy.SOURCE; +import static java.lang.annotation.RetentionPolicy.CLASS; /** * Denotes that an integer parameter, field or method return value is expected @@ -31,7 +32,7 @@ import static java.lang.annotation.RetentionPolicy.SOURCE; * {@link DrawableRes}. */ @Documented -@Retention(SOURCE) -@Target({METHOD, PARAMETER, FIELD}) +@Retention(CLASS) +@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE}) public @interface AnyRes { } diff --git a/annotations/src/android/support/annotation/ArrayRes.java b/annotations/src/android/support/annotation/ArrayRes.java index 0fb4fdb5ee..347de36f96 100644 --- a/annotations/src/android/support/annotation/ArrayRes.java +++ b/annotations/src/android/support/annotation/ArrayRes.java @@ -20,16 +20,17 @@ import java.lang.annotation.Retention; import java.lang.annotation.Target; import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.LOCAL_VARIABLE; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; -import static java.lang.annotation.RetentionPolicy.SOURCE; +import static java.lang.annotation.RetentionPolicy.CLASS; /** * Denotes that an integer parameter, field or method return value is expected * to be an array resource reference (e.g. {@link android.R.array#phoneTypes}). */ @Documented -@Retention(SOURCE) -@Target({METHOD, PARAMETER, FIELD}) +@Retention(CLASS) +@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE}) public @interface ArrayRes { } diff --git a/annotations/src/android/support/annotation/AttrRes.java b/annotations/src/android/support/annotation/AttrRes.java index 290259769f..7ba1f0d911 100644 --- a/annotations/src/android/support/annotation/AttrRes.java +++ b/annotations/src/android/support/annotation/AttrRes.java @@ -20,16 +20,17 @@ import java.lang.annotation.Retention; import java.lang.annotation.Target; import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.LOCAL_VARIABLE; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; -import static java.lang.annotation.RetentionPolicy.SOURCE; +import static java.lang.annotation.RetentionPolicy.CLASS; /** * Denotes that an integer parameter, field or method return value is expected * to be an attribute reference (e.g. {@link android.R.attr#action}). */ @Documented -@Retention(SOURCE) -@Target({METHOD, PARAMETER, FIELD}) +@Retention(CLASS) +@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE}) public @interface AttrRes { } diff --git a/annotations/src/android/support/annotation/BoolRes.java b/annotations/src/android/support/annotation/BoolRes.java index 32cb4d1c7d..bef8071b93 100644 --- a/annotations/src/android/support/annotation/BoolRes.java +++ b/annotations/src/android/support/annotation/BoolRes.java @@ -20,16 +20,17 @@ import java.lang.annotation.Retention; import java.lang.annotation.Target; import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.LOCAL_VARIABLE; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; -import static java.lang.annotation.RetentionPolicy.SOURCE; +import static java.lang.annotation.RetentionPolicy.CLASS; /** * Denotes that an integer parameter, field or method return value is expected * to be a boolean resource reference. */ @Documented -@Retention(SOURCE) -@Target({METHOD, PARAMETER, FIELD}) +@Retention(CLASS) +@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE}) public @interface BoolRes { } diff --git a/annotations/src/android/support/annotation/ColorRes.java b/annotations/src/android/support/annotation/ColorRes.java index d3d560a28e..eb273c4343 100644 --- a/annotations/src/android/support/annotation/ColorRes.java +++ b/annotations/src/android/support/annotation/ColorRes.java @@ -20,16 +20,17 @@ import java.lang.annotation.Retention; import java.lang.annotation.Target; import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.LOCAL_VARIABLE; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; -import static java.lang.annotation.RetentionPolicy.SOURCE; +import static java.lang.annotation.RetentionPolicy.CLASS; /** * Denotes that an integer parameter, field or method return value is expected * to be a color resource reference (e.g. {@link android.R.color#black}). */ @Documented -@Retention(SOURCE) -@Target({METHOD, PARAMETER, FIELD}) +@Retention(CLASS) +@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE}) public @interface ColorRes { } diff --git a/annotations/src/android/support/annotation/DimenRes.java b/annotations/src/android/support/annotation/DimenRes.java index 1aae6a3e4d..c3492a5bac 100644 --- a/annotations/src/android/support/annotation/DimenRes.java +++ b/annotations/src/android/support/annotation/DimenRes.java @@ -20,16 +20,17 @@ import java.lang.annotation.Retention; import java.lang.annotation.Target; import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.LOCAL_VARIABLE; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; -import static java.lang.annotation.RetentionPolicy.SOURCE; +import static java.lang.annotation.RetentionPolicy.CLASS; /** * Denotes that an integer parameter, field or method return value is expected * to be a dimension resource reference (e.g. {@link android.R.dimen#app_icon_size}). */ @Documented -@Retention(SOURCE) -@Target({METHOD, PARAMETER, FIELD}) +@Retention(CLASS) +@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE}) public @interface DimenRes { } diff --git a/annotations/src/android/support/annotation/DrawableRes.java b/annotations/src/android/support/annotation/DrawableRes.java index b85e25374c..0ea1bca432 100644 --- a/annotations/src/android/support/annotation/DrawableRes.java +++ b/annotations/src/android/support/annotation/DrawableRes.java @@ -20,16 +20,17 @@ import java.lang.annotation.Retention; import java.lang.annotation.Target; import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.LOCAL_VARIABLE; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; -import static java.lang.annotation.RetentionPolicy.SOURCE; +import static java.lang.annotation.RetentionPolicy.CLASS; /** * Denotes that an integer parameter, field or method return value is expected * to be a drawable resource reference (e.g. {@link android.R.attr#alertDialogIcon}). */ @Documented -@Retention(SOURCE) -@Target({METHOD, PARAMETER, FIELD}) +@Retention(CLASS) +@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE}) public @interface DrawableRes { } diff --git a/annotations/src/android/support/annotation/FractionRes.java b/annotations/src/android/support/annotation/FractionRes.java index f78ca4e0e8..14048664ed 100644 --- a/annotations/src/android/support/annotation/FractionRes.java +++ b/annotations/src/android/support/annotation/FractionRes.java @@ -20,16 +20,17 @@ import java.lang.annotation.Retention; import java.lang.annotation.Target; import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.LOCAL_VARIABLE; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; -import static java.lang.annotation.RetentionPolicy.SOURCE; +import static java.lang.annotation.RetentionPolicy.CLASS; /** * Denotes that an integer parameter, field or method return value is expected * to be a fraction resource reference. */ @Documented -@Retention(SOURCE) -@Target({METHOD, PARAMETER, FIELD}) +@Retention(CLASS) +@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE}) public @interface FractionRes { } diff --git a/annotations/src/android/support/annotation/IdRes.java b/annotations/src/android/support/annotation/IdRes.java index 21d0a80c8c..9a0060f744 100644 --- a/annotations/src/android/support/annotation/IdRes.java +++ b/annotations/src/android/support/annotation/IdRes.java @@ -20,16 +20,17 @@ import java.lang.annotation.Retention; import java.lang.annotation.Target; import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.LOCAL_VARIABLE; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; -import static java.lang.annotation.RetentionPolicy.SOURCE; +import static java.lang.annotation.RetentionPolicy.CLASS; /** * Denotes that an integer parameter, field or method return value is expected * to be an id resource reference (e.g. {@link android.R.id#copy}). */ @Documented -@Retention(SOURCE) -@Target({METHOD, PARAMETER, FIELD}) +@Retention(CLASS) +@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE}) public @interface IdRes { } diff --git a/annotations/src/android/support/annotation/IntDef.java b/annotations/src/android/support/annotation/IntDef.java index 57a782b595..fedd7b4b32 100644 --- a/annotations/src/android/support/annotation/IntDef.java +++ b/annotations/src/android/support/annotation/IntDef.java @@ -23,7 +23,6 @@ import static java.lang.annotation.ElementType.ANNOTATION_TYPE; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; -import static java.lang.annotation.RetentionPolicy.CLASS; import static java.lang.annotation.RetentionPolicy.SOURCE; /** @@ -52,7 +51,7 @@ import static java.lang.annotation.RetentionPolicy.SOURCE; * value = {NAVIGATION_MODE_STANDARD, NAVIGATION_MODE_LIST, NAVIGATION_MODE_TABS}) * }</pre> */ -@Retention(CLASS) +@Retention(SOURCE) @Target({ANNOTATION_TYPE}) public @interface IntDef { /** Defines the allowed constants for this element */ diff --git a/annotations/src/android/support/annotation/IntegerRes.java b/annotations/src/android/support/annotation/IntegerRes.java index 95938f806c..6bfcc378e6 100644 --- a/annotations/src/android/support/annotation/IntegerRes.java +++ b/annotations/src/android/support/annotation/IntegerRes.java @@ -20,16 +20,17 @@ import java.lang.annotation.Retention; import java.lang.annotation.Target; import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.LOCAL_VARIABLE; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; -import static java.lang.annotation.RetentionPolicy.SOURCE; +import static java.lang.annotation.RetentionPolicy.CLASS; /** * Denotes that an integer parameter, field or method return value is expected * to be an integer resource reference (e.g. {@link android.R.integer#config_shortAnimTime}). */ @Documented -@Retention(SOURCE) -@Target({METHOD, PARAMETER, FIELD}) +@Retention(CLASS) +@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE}) public @interface IntegerRes { } diff --git a/annotations/src/android/support/annotation/InterpolatorRes.java b/annotations/src/android/support/annotation/InterpolatorRes.java index 7068684062..20f42b8495 100644 --- a/annotations/src/android/support/annotation/InterpolatorRes.java +++ b/annotations/src/android/support/annotation/InterpolatorRes.java @@ -20,16 +20,17 @@ import java.lang.annotation.Retention; import java.lang.annotation.Target; import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.LOCAL_VARIABLE; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; -import static java.lang.annotation.RetentionPolicy.SOURCE; +import static java.lang.annotation.RetentionPolicy.CLASS; /** * Denotes that an integer parameter, field or method return value is expected * to be an interpolator resource reference (e.g. {@link android.R.interpolator#cycle}). */ @Documented -@Retention(SOURCE) -@Target({METHOD, PARAMETER, FIELD}) +@Retention(CLASS) +@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE}) public @interface InterpolatorRes { } diff --git a/annotations/src/android/support/annotation/LayoutRes.java b/annotations/src/android/support/annotation/LayoutRes.java index 51780a9f5e..ad04ef0434 100644 --- a/annotations/src/android/support/annotation/LayoutRes.java +++ b/annotations/src/android/support/annotation/LayoutRes.java @@ -20,16 +20,17 @@ import java.lang.annotation.Retention; import java.lang.annotation.Target; import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.LOCAL_VARIABLE; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; -import static java.lang.annotation.RetentionPolicy.SOURCE; +import static java.lang.annotation.RetentionPolicy.CLASS; /** * Denotes that an integer parameter, field or method return value is expected * to be a layout resource reference (e.g. {@link android.R.layout#list_content}). */ @Documented -@Retention(SOURCE) -@Target({METHOD, PARAMETER, FIELD}) +@Retention(CLASS) +@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE}) public @interface LayoutRes { } diff --git a/annotations/src/android/support/annotation/MenuRes.java b/annotations/src/android/support/annotation/MenuRes.java index b28ad955a3..05290499f4 100644 --- a/annotations/src/android/support/annotation/MenuRes.java +++ b/annotations/src/android/support/annotation/MenuRes.java @@ -20,16 +20,17 @@ import java.lang.annotation.Retention; import java.lang.annotation.Target; import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.LOCAL_VARIABLE; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; -import static java.lang.annotation.RetentionPolicy.SOURCE; +import static java.lang.annotation.RetentionPolicy.CLASS; /** * Denotes that an integer parameter, field or method return value is expected * to be a menu resource reference. */ @Documented -@Retention(SOURCE) -@Target({METHOD, PARAMETER, FIELD}) +@Retention(CLASS) +@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE}) public @interface MenuRes { } diff --git a/annotations/src/android/support/annotation/PluralsRes.java b/annotations/src/android/support/annotation/PluralsRes.java index 00a9c844c7..509bc7b1d3 100644 --- a/annotations/src/android/support/annotation/PluralsRes.java +++ b/annotations/src/android/support/annotation/PluralsRes.java @@ -20,16 +20,17 @@ import java.lang.annotation.Retention; import java.lang.annotation.Target; import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.LOCAL_VARIABLE; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; -import static java.lang.annotation.RetentionPolicy.SOURCE; +import static java.lang.annotation.RetentionPolicy.CLASS; /** * Denotes that an integer parameter, field or method return value is expected * to be a plurals resource reference. */ @Documented -@Retention(SOURCE) -@Target({METHOD, PARAMETER, FIELD}) +@Retention(CLASS) +@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE}) public @interface PluralsRes { } diff --git a/annotations/src/android/support/annotation/RawRes.java b/annotations/src/android/support/annotation/RawRes.java index 7db9e0cbe3..b1bb47b5ab 100644 --- a/annotations/src/android/support/annotation/RawRes.java +++ b/annotations/src/android/support/annotation/RawRes.java @@ -20,16 +20,17 @@ import java.lang.annotation.Retention; import java.lang.annotation.Target; import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.LOCAL_VARIABLE; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; -import static java.lang.annotation.RetentionPolicy.SOURCE; +import static java.lang.annotation.RetentionPolicy.CLASS; /** * Denotes that an integer parameter, field or method return value is expected * to be a raw resource reference. */ @Documented -@Retention(SOURCE) -@Target({METHOD, PARAMETER, FIELD}) +@Retention(CLASS) +@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE}) public @interface RawRes { } diff --git a/annotations/src/android/support/annotation/StringDef.java b/annotations/src/android/support/annotation/StringDef.java index 72039a5ac9..cae227ec73 100644 --- a/annotations/src/android/support/annotation/StringDef.java +++ b/annotations/src/android/support/annotation/StringDef.java @@ -22,7 +22,6 @@ import static java.lang.annotation.ElementType.ANNOTATION_TYPE; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; -import static java.lang.annotation.RetentionPolicy.CLASS; import static java.lang.annotation.RetentionPolicy.SOURCE; /** @@ -45,7 +44,7 @@ import static java.lang.annotation.RetentionPolicy.SOURCE; * public abstract Object getSystemService(@ServiceName String name); * }</pre> */ -@Retention(CLASS) +@Retention(SOURCE) @Target({ANNOTATION_TYPE}) public @interface StringDef { /** Defines the allowed constants for this element */ diff --git a/annotations/src/android/support/annotation/StringRes.java b/annotations/src/android/support/annotation/StringRes.java index 28b79b0b9d..2c1149c64c 100644 --- a/annotations/src/android/support/annotation/StringRes.java +++ b/annotations/src/android/support/annotation/StringRes.java @@ -20,16 +20,17 @@ import java.lang.annotation.Retention; import java.lang.annotation.Target; import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.LOCAL_VARIABLE; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; -import static java.lang.annotation.RetentionPolicy.SOURCE; +import static java.lang.annotation.RetentionPolicy.CLASS; /** * Denotes that an integer parameter, field or method return value is expected * to be a String resource reference (e.g. {@link android.R.string#ok}). */ @Documented -@Retention(SOURCE) -@Target({METHOD, PARAMETER, FIELD}) +@Retention(CLASS) +@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE}) public @interface StringRes { } diff --git a/annotations/src/android/support/annotation/StyleRes.java b/annotations/src/android/support/annotation/StyleRes.java index 5e6f454a22..6d931bf70a 100644 --- a/annotations/src/android/support/annotation/StyleRes.java +++ b/annotations/src/android/support/annotation/StyleRes.java @@ -20,16 +20,17 @@ import java.lang.annotation.Retention; import java.lang.annotation.Target; import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.LOCAL_VARIABLE; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; -import static java.lang.annotation.RetentionPolicy.SOURCE; +import static java.lang.annotation.RetentionPolicy.CLASS; /** - * Denotes that a integer parameter, field or method return value is expected + * Denotes that an integer parameter, field or method return value is expected * to be a style resource reference (e.g. {@link android.R.style#TextAppearance}). */ @Documented -@Retention(SOURCE) -@Target({METHOD, PARAMETER, FIELD}) +@Retention(CLASS) +@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE}) public @interface StyleRes { } diff --git a/annotations/src/android/support/annotation/StyleableRes.java b/annotations/src/android/support/annotation/StyleableRes.java index 617dfaea2b..d7902d119c 100644 --- a/annotations/src/android/support/annotation/StyleableRes.java +++ b/annotations/src/android/support/annotation/StyleableRes.java @@ -20,16 +20,17 @@ import java.lang.annotation.Retention; import java.lang.annotation.Target; import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.LOCAL_VARIABLE; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; -import static java.lang.annotation.RetentionPolicy.SOURCE; +import static java.lang.annotation.RetentionPolicy.CLASS; /** - * Denotes that a integer parameter, field or method return value is expected + * Denotes that an integer parameter, field or method return value is expected * to be a styleable resource reference (e.g. {@link android.R.styleable#TextView_text}). */ @Documented -@Retention(SOURCE) -@Target({METHOD, PARAMETER, FIELD}) +@Retention(CLASS) +@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE}) public @interface StyleableRes { } diff --git a/annotations/src/android/support/annotation/XmlRes.java b/annotations/src/android/support/annotation/XmlRes.java index 66713a82b5..2b8b9fa65f 100644 --- a/annotations/src/android/support/annotation/XmlRes.java +++ b/annotations/src/android/support/annotation/XmlRes.java @@ -20,16 +20,17 @@ import java.lang.annotation.Retention; import java.lang.annotation.Target; import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.LOCAL_VARIABLE; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; -import static java.lang.annotation.RetentionPolicy.SOURCE; +import static java.lang.annotation.RetentionPolicy.CLASS; /** * Denotes that an integer parameter, field or method return value is expected * to be an XML resource reference. */ @Documented -@Retention(SOURCE) -@Target({METHOD, PARAMETER, FIELD}) +@Retention(CLASS) +@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE}) public @interface XmlRes { } |
