Skip to content

Copybara fix #5598

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ abstract class ApiDiffer : DefaultTask() {
val (pMajor, pMinor, _) = previousVersionString.get().split(".")
val (major, minor, _) = version.get().split(".")
val curVersionDelta: VersionDelta =
if (major > pMajor) VersionDelta.MAJOR
else if (minor > pMinor) VersionDelta.MINOR else VersionDelta.PATCH
if (major.toIntOrNull()!! > pMajor.toIntOrNull()!!) VersionDelta.MAJOR
else if (minor.toIntOrNull()!! > pMinor.toIntOrNull()!!) VersionDelta.MINOR
else VersionDelta.PATCH
val afterJar = readApi(currentJar.get())
val beforeJar = readApi(previousJar.get())
val classKeys = afterJar.keys union beforeJar.keys
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import com.google.android.gms.tasks.Task;
import com.google.android.gms.tasks.TaskCompletionSource;
import com.google.errorprone.annotations.CanIgnoreReturnValue;

import java.util.concurrent.Callable;
import java.util.concurrent.CancellationException;
import java.util.concurrent.CountDownLatch;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;

import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.firebase.crashlytics.internal.common.CommonUtils;
import com.google.firebase.crashlytics.internal.common.CrashlyticsBackgroundWorker;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
* map to the same Target, each Target maps to a single WatchTarget in RemoteStore and a single
* TargetData entry in persistence.
*/
@SuppressWarnings("MissingCasesInEnumSwitch")
public final class Target {
public static final long NO_LIMIT = -1;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import com.google.common.base.Supplier;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.firebase.firestore.model.Document;
import com.google.firebase.firestore.model.DocumentKey;
import com.google.firebase.firestore.model.FieldIndex.IndexOffset;
Expand Down Expand Up @@ -101,6 +102,7 @@ public Scheduler getScheduler() {
}

/** Runs a single backfill operation and returns the number of documents processed. */
@CanIgnoreReturnValue
public int backfill() {
return persistence.runTransaction("Backfill Indexes", () -> this.writeIndexEntries());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;

import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.firebase.Timestamp;
import com.google.firebase.database.collection.ImmutableSortedMap;
import com.google.firebase.firestore.core.Query;
Expand Down Expand Up @@ -194,6 +196,7 @@ private Map<DocumentKey, OverlayedDocument> computeViews(
return result;
}

@CanIgnoreReturnValue
private Map<DocumentKey, FieldMask> recalculateAndSaveOverlays(
Map<DocumentKey, MutableDocument> docs) {
List<MutationBatch> batches =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
package com.google.firebase.firestore.model;

import androidx.annotation.NonNull;

import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.firestore.v1.Value;

/**
Expand Down Expand Up @@ -163,6 +165,7 @@ public MutableDocument setHasLocalMutations() {
return this;
}

@CanIgnoreReturnValue
public MutableDocument setReadTime(SnapshotVersion readTime) {
this.readTime = readTime;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import static com.google.firebase.firestore.util.Assert.hardAssert;

import androidx.annotation.Nullable;

import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.firebase.Timestamp;
import com.google.firebase.firestore.model.Document;
import com.google.firebase.firestore.model.DocumentKey;
Expand Down Expand Up @@ -161,6 +163,7 @@ public abstract void applyToRemoteDocument(
* a part of.
* @return A {@code FieldMask} representing the fields that are changed by applying this mutation.
*/
@CanIgnoreReturnValue
public abstract @Nullable FieldMask applyToLocalView(
MutableDocument document, @Nullable FieldMask previousMask, Timestamp localWriteTime);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
package com.google.firebase.firestore.model.mutation;

import androidx.annotation.Nullable;

import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.firebase.Timestamp;
import com.google.firebase.firestore.model.DocumentKey;
import com.google.firebase.firestore.model.FieldPath;
Expand Down Expand Up @@ -87,6 +89,7 @@ public void applyToRemoteDocument(MutableDocument document, MutationResult mutat
}

@Override
@CanIgnoreReturnValue
public FieldMask applyToLocalView(
MutableDocument document, @Nullable FieldMask previousMask, Timestamp localWriteTime) {
verifyKeyMatches(document);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;

import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.firebase.firestore.auth.User;
import com.google.firebase.firestore.model.DocumentKey;
import com.google.firebase.firestore.model.FieldIndex.IndexOffset;
Expand Down Expand Up @@ -278,18 +279,22 @@ public void testGetMatchingDocsRespectsMutatedDocs() {
assertThat(results.values()).containsExactly(doc("a/2", 1, map("matches", false)));
}

@CanIgnoreReturnValue
protected MutableDocument addTestDocumentAtPath(String path) {
return addTestDocumentAtPath(path, 42, 42);
}

@CanIgnoreReturnValue
protected MutableDocument addTestDocumentAtPath(DocumentKey key) {
return addTestDocumentAtPath(key.getPath().canonicalString(), 42, 42);
}

@CanIgnoreReturnValue
protected MutableDocument addTestDocumentAtPath(String path, int updateTime, int readTime) {
return addTestDocumentAtPath(path, updateTime, readTime, map("data", 2));
}

@CanIgnoreReturnValue
protected MutableDocument addTestDocumentAtPath(
String path, int updateTime, int readTime, Map<String, Object> data) {
MutableDocument doc = doc(path, updateTime, data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ URL getURL(String function) {
}

/** @deprecated Use {@link #useEmulator(String, int)} to connect to the emulator. */
@Deprecated
public void useFunctionsEmulator(@NonNull String origin) {
Preconditions.checkNotNull(origin, "origin cannot be null");
urlFormat = origin + "/%2$s/%1$s/%3$s";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.google.android.gms.common.util.VisibleForTesting;
import com.google.android.gms.tasks.Task;
import com.google.android.gms.tasks.TaskCompletionSource;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.firebase.inappmessaging.FirebaseInAppMessagingDisplayCallbacks;
import com.google.firebase.inappmessaging.internal.time.Clock;
import com.google.firebase.inappmessaging.model.Action;
Expand Down Expand Up @@ -77,6 +78,7 @@ boolean wasImpressed() {
return wasImpressed;
}

@CanIgnoreReturnValue
@Override
public Task<Void> impressionDetected() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import android.text.TextUtils;
import androidx.annotation.Nullable;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.firebase.inappmessaging.MessagesProto;

/** Encapsulates an Action for a Firebase In App Message. */
Expand Down Expand Up @@ -97,18 +98,21 @@ public static class Builder {
@Nullable private String actionUrl;
@Nullable private Button button;

@CanIgnoreReturnValue
public Builder setActionUrl(@Nullable String actionUrl) {
if (!TextUtils.isEmpty(actionUrl)) {
this.actionUrl = actionUrl;
}
return this;
}

@CanIgnoreReturnValue
public Builder setButton(@Nullable Button button) {
this.button = button;
return this;
}

@CanIgnoreReturnValue
public Builder setButton(MessagesProto.Button button) {
Button.Builder buttonBuilder = new Button.Builder();
buttonBuilder.setButtonHexColor(button.getButtonHexColor());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import android.text.TextUtils;
import androidx.annotation.NonNull;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.util.Map;
import javax.annotation.Nullable;

Expand Down Expand Up @@ -148,26 +149,31 @@ public static class Builder {
@Nullable Action action;
@Nullable String backgroundHexColor;

@CanIgnoreReturnValue
public Builder setTitle(@Nullable Text title) {
this.title = title;
return this;
}

@CanIgnoreReturnValue
public Builder setBody(@Nullable Text body) {
this.body = body;
return this;
}

@CanIgnoreReturnValue
public Builder setImageData(@Nullable ImageData imageData) {
this.imageData = imageData;
return this;
}

@CanIgnoreReturnValue
public Builder setAction(@Nullable Action action) {
this.action = action;
return this;
}

@CanIgnoreReturnValue
public Builder setBackgroundHexColor(@Nullable String backgroundHexColor) {
this.backgroundHexColor = backgroundHexColor;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import android.text.TextUtils;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.firebase.inappmessaging.MessagesProto;

/** Encapsulates any button used in a Firebase In App Message. */
Expand Down Expand Up @@ -95,18 +96,21 @@ public static class Builder {
@Nullable private Text text;
@Nullable private String buttonHexColor;

@CanIgnoreReturnValue
public Builder setText(@Nullable Text text) {
this.text = text;
return this;
}

@CanIgnoreReturnValue
public Builder setText(MessagesProto.Text text) {
Text.Builder textBuilder = new Text.Builder();
textBuilder.setText(text);
this.text = textBuilder.build();
return this;
}

@CanIgnoreReturnValue
public Builder setButtonHexColor(@Nullable String buttonHexColor) {
this.buttonHexColor = buttonHexColor;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import android.text.TextUtils;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.util.Map;

/** Encapsulates a Firebase In App Card Message. */
Expand Down Expand Up @@ -202,41 +203,49 @@ public static class Builder {
@Nullable Text body;
@Nullable Action secondaryAction;

@CanIgnoreReturnValue
public Builder setPortraitImageData(@Nullable ImageData portraitImageData) {
this.portraitImageData = portraitImageData;
return this;
}

@CanIgnoreReturnValue
public Builder setLandscapeImageData(@Nullable ImageData landscapeImageData) {
this.landscapeImageData = landscapeImageData;
return this;
}

@CanIgnoreReturnValue
public Builder setBackgroundHexColor(@Nullable String backgroundHexColor) {
this.backgroundHexColor = backgroundHexColor;
return this;
}

@CanIgnoreReturnValue
public Builder setPrimaryAction(@Nullable Action primaryAction) {
this.primaryAction = primaryAction;
return this;
}

@CanIgnoreReturnValue
public Builder setSecondaryAction(@Nullable Action secondaryAction) {
this.secondaryAction = secondaryAction;
return this;
}

@CanIgnoreReturnValue
public Builder setTitle(@Nullable Text title) {
this.title = title;
return this;
}

@CanIgnoreReturnValue
public Builder setBody(@Nullable Text body) {
this.body = body;
return this;
}

@CanIgnoreReturnValue
public CardMessage build(
CampaignMetadata campaignMetadata, @Nullable Map<String, String> data) {
if (primaryAction == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package com.google.firebase.inappmessaging.model;

import androidx.annotation.NonNull;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.util.Map;
import javax.annotation.Nullable;

Expand Down Expand Up @@ -102,11 +103,13 @@ public static class Builder {
@Nullable ImageData imageData;
@Nullable Action action;

@CanIgnoreReturnValue
public Builder setImageData(@Nullable ImageData imageData) {
this.imageData = imageData;
return this;
}

@CanIgnoreReturnValue
public Builder setAction(@Nullable Action action) {
this.action = action;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import android.text.TextUtils;
import androidx.annotation.NonNull;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.util.Map;
import javax.annotation.Nullable;

Expand Down Expand Up @@ -148,26 +149,31 @@ public static class Builder {
@Nullable Action action;
@Nullable String backgroundHexColor;

@CanIgnoreReturnValue
public Builder setTitle(@Nullable Text title) {
this.title = title;
return this;
}

@CanIgnoreReturnValue
public Builder setBody(@Nullable Text body) {
this.body = body;
return this;
}

@CanIgnoreReturnValue
public Builder setImageData(@Nullable ImageData imageData) {
this.imageData = imageData;
return this;
}

@CanIgnoreReturnValue
public Builder setAction(@Nullable Action action) {
this.action = action;
return this;
}

@CanIgnoreReturnValue
public Builder setBackgroundHexColor(@Nullable String backgroundHexColor) {
this.backgroundHexColor = backgroundHexColor;
return this;
Expand Down
Loading