Add j.a.p.Generated to ART's Public API surface
Certain code generation tools like Dagger emit this annotation. Add this
to Public API surface to enable apps to use these annotation processors.
Another option was to add this to the new "Toolchain" API surface
instead. e.g. LambdaMetaFactory (LMF) was added to Toolchain API surface
and not Public API in aosp/2369873. One difference is that unlike LMF,
j.a.p.Generated is part of JLS and is backed by an implementation.
Bug: 261244752
Bug: 283243108
Test: TH
Change-Id: I29122adc5ee9d7cafd5403ac5421a7b0d9737dd1
diff --git a/JavaLibrary.bp b/JavaLibrary.bp
index 91e72d0..749ba59 100644
--- a/JavaLibrary.bp
+++ b/JavaLibrary.bp
@@ -185,7 +185,6 @@
// framework-api-annotations contain API annotations, e.g. @SystemApi.
":framework-api-annotations",
":openjdk_lambda_stub_files",
- ":openjdk_generated_annotation_stub_files",
":app-compat-annotations-source",
// Use the okhttp source too to allow libcore code to reference it
@@ -440,10 +439,11 @@
include_srcs: true,
}
-// Creates a jar that exists to satisfy javac when compiling source code that
-// contains @Generated annotations, which are produced by some code generation
-// tools (notably dagger) but aren't part of the Android API.
-// See http://b/123891440.
+// This is an empty jar that exists for backwards compatibility with T (and below).
+// Historically, it existed to satisfy javac when compiling source code that
+// contains @Generated annotations.
+// This is no longer necessary since @Generated was added to ART's Public API
+// surface in U.
java_library {
name: "core-generated-annotation-stubs",
visibility: [
@@ -452,7 +452,6 @@
],
defaults: ["libcore_java_defaults"],
srcs: [
- ":openjdk_generated_annotation_stub_files",
],
hostdex: true,
sdk_version: "none",
@@ -935,7 +934,6 @@
// in openjdk_java_files.bp for more details.
":openjdk_mmodule_extra_files",
":okhttp_api_files",
-
],
libs: [
// Put framework-api-annotations into libs to avoid exposing the definition of framework's
@@ -1015,11 +1013,6 @@
// This one is not on device but it's needed when javac compiles code
// containing lambdas.
"core-lambda-stubs-for-system-modules",
- // This one is not on device but it's needed when javac compiles code
- // containing @Generated annotations produced by some code generation
- // tools.
- // See http://b/123891440.
- "core-generated-annotation-stubs",
// Ensure that core libraries that depend on the public API can access
// the UnsupportedAppUsage, CorePlatformApi and IntraCoreApi