Default annotations_enabled to true for sdk_library
This turns out retention of Nullable annotations, which is almost
certainly what every user wants. Also add the "stub-annotations" lib to
the stub libs property, to make sure the nullability annotations
resolve properly.
Bug: 157010342
Test: m
Change-Id: I905144add4ef6f85445eedd1ba5169445f6005e0
diff --git a/java/sdk_library.go b/java/sdk_library.go
index 61bb106..e85b692 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -789,6 +789,9 @@
props.Patch_module = module.properties.Patch_module
props.Installable = proptools.BoolPtr(false)
props.Libs = module.sdkLibraryProperties.Stub_only_libs
+ // The stub-annotations library contains special versions of the annotations
+ // with CLASS retention policy, so that they're kept around for kotlin.
+ props.Libs = append(props.Libs, "stub-annotations")
props.Product_variables.Pdk.Enabled = proptools.BoolPtr(false)
props.Openjdk9.Srcs = module.properties.Openjdk9.Srcs
props.Openjdk9.Javacflags = module.properties.Openjdk9.Javacflags
@@ -822,6 +825,7 @@
Arg_files []string
Args *string
Java_version *string
+ Annotations_enabled *bool
Merge_annotations_dirs []string
Merge_inclusion_annotations_dirs []string
Generate_stubs *bool
@@ -872,6 +876,7 @@
props.Aidl.Local_include_dirs = module.deviceProperties.Aidl.Local_include_dirs
props.Java_version = module.properties.Java_version
+ props.Annotations_enabled = proptools.BoolPtr(true)
props.Merge_annotations_dirs = module.sdkLibraryProperties.Merge_annotations_dirs
props.Merge_inclusion_annotations_dirs = module.sdkLibraryProperties.Merge_inclusion_annotations_dirs