Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions binder/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,12 @@ import net.ltgt.gradle.errorprone.CheckSeverity

tasks.withType(JavaCompile).configureEach {
options.compilerArgs += [
"-Xlint:-cast"
"-Xlint:-cast",
// For junit-1.15-api & org.robolectric/shadows-framework/4.11.1
"-Xlint:-classfile",
// Unclaimed annotations. TODO(jdcormie): Fix?
"-Xlint:-processing",
]
options.compilerArgs -= ["-Werror"] // https://github.com/grpc/grpc-java/issues/10297
appendToProperty(it.options.errorprone.excludedPaths, ".*/R.java", "|")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ public static Metadata readMetadata(Parcel parcel, Attributes attributes) throws
}
int parcelableStartPos = parcel.dataPosition();
try {
// readParcelable(Classloader, Class<>) requires SDK 33 and at this layer we can't know
// value's type anyway.
@SuppressWarnings("deprecation")
Parcelable value = parcel.readParcelable(MetadataHelper.class.getClassLoader());
if (value == null) {
throw Status.INTERNAL.withDescription("Read null parcelable in metadata").asException();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ final class ParcelableInputStream<P extends Parcelable> extends InputStream {
@SuppressWarnings("unchecked")
static <P extends Parcelable> ParcelableInputStream<P> readFromParcel(
Parcel parcel, ClassLoader classLoader) {
// readParcelable(Classloader, Class<P>) requires SDK 33 and this class isn't typesafe anyway.
@SuppressWarnings("deprecation")
P value = (P) parcel.readParcelable(classLoader);
return new ParcelableInputStream<>(null, value, true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ public PackageInfoBuilder setSignatures(Signature... signatures) {
return this;
}

@SuppressWarnings("deprecation") // 'signatures': We don't yet support signing cert rotation.
public PackageInfo build() {
checkState(this.packageName != null, "packageName is a mandatory field");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public void testDefaultInternalOnly() throws Exception {
}

@Test
@Deprecated
public void testDefaultInternalOnly_legacyApi() {
policy = new ServerSecurityPolicy();
assertThat(policy.checkAuthorizationForService(MY_UID, SERVICE1).getCode())
Expand All @@ -80,6 +81,7 @@ public void testInternalOnly_AnotherUid() throws Exception {
}

@Test
@Deprecated
public void testInternalOnly_AnotherUid_legacyApi() {
policy = new ServerSecurityPolicy();
assertThat(policy.checkAuthorizationForService(OTHER_UID, SERVICE1).getCode())
Expand All @@ -98,6 +100,7 @@ public void testBuilderDefault() throws Exception {
}

@Test
@Deprecated
public void testBuilderDefault_legacyApi() {
policy = ServerSecurityPolicy.newBuilder().build();
assertThat(policy.checkAuthorizationForService(MY_UID, SERVICE1).getCode())
Expand Down Expand Up @@ -125,6 +128,7 @@ public void testPerService() throws Exception {


@Test
@Deprecated
public void testPerService_legacyApi() {
policy =
ServerSecurityPolicy.newBuilder()
Expand Down Expand Up @@ -251,6 +255,7 @@ SERVICE2, policy((uid) -> uid == OTHER_UID ? Status.OK : Status.PERMISSION_DENIE
.isEqualTo(Status.PERMISSION_DENIED.getCode());
}
@Test
@Deprecated
public void testPerServiceNoDefault_legacyApi() {
policy =
ServerSecurityPolicy.newBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ public void testWriteToParcel() throws Exception {
stream.writeToParcel(parcel);

parcel.setDataPosition(0);
assertThat((TestParcelable) parcel.readParcelable(getClass().getClassLoader()))
.isEqualTo(testParcelable);
@SuppressWarnings("deprecation") // readParcelable(ClassLoader)'s replacement is only in 33+.
TestParcelable clone = parcel.readParcelable(getClass().getClassLoader());
assertThat(clone).isEqualTo(testParcelable);
}

@Test
Expand All @@ -113,8 +114,9 @@ public void testAsRegularInputStream() throws Exception {
parcel.unmarshall(data, 0, data.length);
parcel.setDataPosition(0);

assertThat((TestParcelable) parcel.readParcelable(getClass().getClassLoader()))
.isEqualTo(testParcelable);
@SuppressWarnings("deprecation") // readParcelable(ClassLoader)'s replacement is only in 33+.
TestParcelable clone = parcel.readParcelable(getClass().getClassLoader());
assertThat(clone).isEqualTo(testParcelable);
}

@Test
Expand Down