Skip to content

Commit f14fc0e

Browse files
authored
[Config] Annotate Builder with @CanIgnoreReturnValue (#7100)
The return value from Builders can safely be ignored dependending as they only enable chaining. This change fixes a warning thrown by errorprone. (internal) See b/424298831
1 parent ec904ec commit f14fc0e

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

firebase-config/firebase-config.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ dependencies {
8585
annotationProcessor(libs.autovalue)
8686
javadocClasspath(libs.autovalue.annotations)
8787
compileOnly(libs.autovalue.annotations)
88+
compileOnly(libs.errorprone.annotations)
8889
compileOnly(libs.findbugs.jsr305)
8990

9091
// Testing

firebase-config/src/main/java/com/google/firebase/remoteconfig/internal/ConfigContainer.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
package com.google.firebase.remoteconfig.internal;
1616

17+
import com.google.errorprone.annotations.CanIgnoreReturnValue;
1718
import java.util.Date;
1819
import java.util.HashMap;
1920
import java.util.HashSet;
@@ -328,11 +329,13 @@ public Builder(ConfigContainer otherContainer) {
328329
this.builderRolloutMetadata = otherContainer.getRolloutMetadata();
329330
}
330331

332+
@CanIgnoreReturnValue
331333
public Builder replaceConfigsWith(Map<String, String> configsMap) {
332334
this.builderConfigsJson = new JSONObject(configsMap);
333335
return this;
334336
}
335337

338+
@CanIgnoreReturnValue
336339
public Builder replaceConfigsWith(JSONObject configsJson) {
337340
try {
338341
this.builderConfigsJson = new JSONObject(configsJson.toString());
@@ -345,11 +348,13 @@ public Builder replaceConfigsWith(JSONObject configsJson) {
345348
return this;
346349
}
347350

351+
@CanIgnoreReturnValue
348352
public Builder withFetchTime(Date fetchTime) {
349353
this.builderFetchTime = fetchTime;
350354
return this;
351355
}
352356

357+
@CanIgnoreReturnValue
353358
public Builder withAbtExperiments(JSONArray abtExperiments) {
354359
try {
355360
this.builderAbtExperiments = new JSONArray(abtExperiments.toString());
@@ -362,6 +367,7 @@ public Builder withAbtExperiments(JSONArray abtExperiments) {
362367
return this;
363368
}
364369

370+
@CanIgnoreReturnValue
365371
public Builder withPersonalizationMetadata(JSONObject personalizationMetadata) {
366372
try {
367373
this.builderPersonalizationMetadata = new JSONObject(personalizationMetadata.toString());
@@ -374,11 +380,13 @@ public Builder withPersonalizationMetadata(JSONObject personalizationMetadata) {
374380
return this;
375381
}
376382

383+
@CanIgnoreReturnValue
377384
public Builder withTemplateVersionNumber(long templateVersionNumber) {
378385
this.builderTemplateVersionNumber = templateVersionNumber;
379386
return this;
380387
}
381388

389+
@CanIgnoreReturnValue
382390
public Builder withRolloutMetadata(JSONArray rolloutMetadata) {
383391
try {
384392
this.builderRolloutMetadata = new JSONArray(rolloutMetadata.toString());

0 commit comments

Comments
 (0)