Remove nullablility annotations from module-lib

They were added to workaround the problem of package-private versions
being added to the stubs, which prevented use of the annotations from
mainline modules.

Having them in the API leads to a different problem -- this version of
the nullability annotations have SOURCE retention. However in the stubs
build we want to have CLASS retention, so that kotlin can make use of
their presence.

This is arguably a much cleaner fix, since having a source-retention
annotation doesn't really make much sense.

Bug: 157010342
Test: m
Change-Id: Id78f00da5b6af2930224a82faa24cb8235362521
Merged-In: Id78f00da5b6af2930224a82faa24cb8235362521
This commit is contained in:
Anton Hansson
2020-05-20 12:06:23 +01:00
parent 44cb762e2b
commit 206be52a78
4 changed files with 3 additions and 17 deletions

View File

@@ -254,7 +254,6 @@ droidstubs {
java_defaults {
name: "android_defaults_stubs_current",
libs: [ "stub-annotations" ],
static_libs: [ "private-stub-annotations-jar" ],
errorprone: {
javacflags: [
"-XepDisableAllChecks",
@@ -270,18 +269,21 @@ java_defaults {
java_library_static {
name: "android_stubs_current",
srcs: [ ":api-stubs-docs" ],
static_libs: [ "private-stub-annotations-jar" ],
defaults: ["android_defaults_stubs_current"],
}
java_library_static {
name: "android_system_stubs_current",
srcs: [ ":system-api-stubs-docs" ],
static_libs: [ "private-stub-annotations-jar" ],
defaults: ["android_defaults_stubs_current"],
}
java_library_static {
name: "android_test_stubs_current",
srcs: [ ":test-api-stubs-docs" ],
static_libs: [ "private-stub-annotations-jar" ],
defaults: ["android_defaults_stubs_current"],
}

View File

@@ -1,14 +1,4 @@
// Signature format: 2.0
package android.annotation {
@java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) @java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.PARAMETER, java.lang.annotation.ElementType.FIELD}) public @interface NonNull {
}
@java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) @java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.PARAMETER, java.lang.annotation.ElementType.FIELD}) public @interface Nullable {
}
}
package android.net {
public final class TetheredClient implements android.os.Parcelable {

View File

@@ -20,8 +20,6 @@ import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.RetentionPolicy.SOURCE;
import android.annotation.SystemApi.Client;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
@@ -36,6 +34,5 @@ import java.lang.annotation.Target;
*/
@Retention(SOURCE)
@Target({METHOD, PARAMETER, FIELD})
@SystemApi(client = Client.MODULE_LIBRARIES)
public @interface NonNull {
}

View File

@@ -20,8 +20,6 @@ import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.RetentionPolicy.SOURCE;
import android.annotation.SystemApi.Client;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
@@ -43,6 +41,5 @@ import java.lang.annotation.Target;
*/
@Retention(SOURCE)
@Target({METHOD, PARAMETER, FIELD})
@SystemApi(client = Client.MODULE_LIBRARIES)
public @interface Nullable {
}