aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKiwon Park <kiwonp@google.com>2023-08-08 17:26:37 -0700
committerKiwon Park <kiwonp@google.com>2023-08-09 22:23:53 +0000
commitca8e83ebd5116474e683e6554cf5b29200e40fe0 (patch)
treef3327982ce2a09618da658a61d2cd443e773536d
parente0773a80853a356c181adb170281fc06e4ab8937 (diff)
downloadservice_entitlement-ca8e83ebd5116474e683e6554cf5b29200e40fe0.tar.gz
Add CanIgnoreReturnValue annotation to HTTP Request Builder
Test: m Change-Id: I927968066c1be58b2ed00f462d751dcbbfb12bd3 Bug: 295217638
-rw-r--r--Android.bp1
-rw-r--r--java/com/android/libraries/entitlement/http/HttpRequest.java3
2 files changed, 4 insertions, 0 deletions
diff --git a/Android.bp b/Android.bp
index 09d2bd9..333f0b3 100644
--- a/Android.bp
+++ b/Android.bp
@@ -22,6 +22,7 @@ java_defaults {
libs: [
"androidx.annotation_annotation",
"auto_value_annotations",
+ "error_prone_annotations",
],
plugins: ["auto_value_plugin"],
sdk_version: "system_current",
diff --git a/java/com/android/libraries/entitlement/http/HttpRequest.java b/java/com/android/libraries/entitlement/http/HttpRequest.java
index 57b5561..ec5ca7a 100644
--- a/java/com/android/libraries/entitlement/http/HttpRequest.java
+++ b/java/com/android/libraries/entitlement/http/HttpRequest.java
@@ -26,6 +26,7 @@ import com.android.libraries.entitlement.CarrierConfig;
import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableListMultimap;
import com.google.common.net.HttpHeaders;
+import com.google.errorprone.annotations.CanIgnoreReturnValue;
import org.json.JSONObject;
@@ -74,6 +75,7 @@ public abstract class HttpRequest {
abstract ImmutableListMultimap.Builder<String, String> requestPropertiesBuilder();
/** Adds an HTTP header field. */
+ @CanIgnoreReturnValue
public Builder addRequestProperty(String key, String value) {
requestPropertiesBuilder().put(key, value);
return this;
@@ -84,6 +86,7 @@ public abstract class HttpRequest {
* {@link #addRequestProperty(String, String)} multiple times with the same key and
* one value at a time.
*/
+ @CanIgnoreReturnValue
public Builder addRequestProperty(String key, List<String> value) {
requestPropertiesBuilder().putAll(key, value);
return this;