Add overrideSourcePosition to UnsupportedAppUsage.
This allows tools to know the original source position of the annotation
in cases where the java code is generated. It will be populated by the
AIDL compiler.
Bug: 145120552
Test: m
Change-Id: Ie5c1108ccb8417195f09d1ed61be4ce1f1c2282d
diff --git a/dalvik/src/main/java/dalvik/annotation/compat/UnsupportedAppUsage.java b/dalvik/src/main/java/dalvik/annotation/compat/UnsupportedAppUsage.java
index ff3ad4b..0932c33 100644
--- a/dalvik/src/main/java/dalvik/annotation/compat/UnsupportedAppUsage.java
+++ b/dalvik/src/main/java/dalvik/annotation/compat/UnsupportedAppUsage.java
@@ -146,6 +146,20 @@
String publicAlternatives() default "";
/**
+ * Override the default source position when generating an index of the annotations.
+ *
+ * <p>This is intended for use by tools that generate java source code, to point to the
+ * original source position of the annotation, rather than the position within the generated
+ * code. It should never be set manually.
+ *
+ * <p>The format of the value is "path/to/file:startline:startcol:endline:endcol" indicating
+ * the position of the annotation itself.
+ */
+ @CorePlatformApi
+ @IntraCoreApi
+ String overrideSourcePosition() default "";
+
+ /**
* Container for {@link UnsupportedAppUsage} that allows it to be applied repeatedly to types.
*/
@Retention(CLASS)
diff --git a/mmodules/core_platform_api/api/platform/current-api.txt b/mmodules/core_platform_api/api/platform/current-api.txt
index 68b1943..d83f22d 100644
--- a/mmodules/core_platform_api/api/platform/current-api.txt
+++ b/mmodules/core_platform_api/api/platform/current-api.txt
@@ -507,6 +507,7 @@
method public abstract String expectedSignature() default "";
method public abstract String implicitMember() default "";
method public abstract int maxTargetSdk() default java.lang.Integer.MAX_VALUE;
+ method public abstract String overrideSourcePosition() default "";
method public abstract String publicAlternatives() default "";
method public abstract long trackingBug() default 0;
}
diff --git a/mmodules/intracoreapi/api/intra/current-api.txt b/mmodules/intracoreapi/api/intra/current-api.txt
index cde404a..01572c4 100644
--- a/mmodules/intracoreapi/api/intra/current-api.txt
+++ b/mmodules/intracoreapi/api/intra/current-api.txt
@@ -25,6 +25,7 @@
method @libcore.api.CorePlatformApi @libcore.api.IntraCoreApi public abstract String expectedSignature() default "";
method @libcore.api.CorePlatformApi @libcore.api.IntraCoreApi public abstract String implicitMember() default "";
method @libcore.api.CorePlatformApi @libcore.api.IntraCoreApi public abstract int maxTargetSdk() default java.lang.Integer.MAX_VALUE;
+ method @libcore.api.CorePlatformApi @libcore.api.IntraCoreApi public abstract String overrideSourcePosition() default "";
method @libcore.api.CorePlatformApi @libcore.api.IntraCoreApi public abstract String publicAlternatives() default "";
method @libcore.api.CorePlatformApi @libcore.api.IntraCoreApi public abstract long trackingBug() default 0;
}