Skip to content

Commit

Permalink
Fix crashlytics copybara (#5558)
Browse files Browse the repository at this point in the history
Some of the methods donot have the right nullable annotations. This pr
updates all of them

---------

Co-authored-by: VinayGuthal <[email protected]>
  • Loading branch information
VinayGuthal and winay39 authored Nov 17, 2023
1 parent 1f531b9 commit 8a7621b
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import androidx.annotation.VisibleForTesting;
import com.google.android.gms.tasks.Task;
import com.google.android.gms.tasks.Tasks;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.firebase.FirebaseApp;
import com.google.firebase.crashlytics.BuildConfig;
import com.google.firebase.crashlytics.internal.CrashlyticsNativeComponent;
Expand Down Expand Up @@ -220,6 +221,7 @@ public boolean onPreExecute(AppData appData, SettingsProvider settingsProvider)
}

/** Performs background initialization asynchronously on the background worker's thread. */
@CanIgnoreReturnValue
public Task<Void> doBackgroundInitializationAsync(SettingsProvider settingsProvider) {
return Utils.callTask(
crashHandlerExecutor,
Expand All @@ -232,6 +234,7 @@ public Task<Void> call() throws Exception {
}

/** Performs background initialization synchronously on the calling thread. */
@CanIgnoreReturnValue
private Task<Void> doBackgroundInitialization(SettingsProvider settingsProvider) {
// create the marker for this run
markInitializationStarted();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
* This class is responsible for capturing information from the system and exception objects,
* parsing them, and returning canonical CrashlyticsReport and Event objects.
*/
@SuppressWarnings("KotlinInternal")
public class CrashlyticsReportDataCapture {

private static final Map<String, Integer> ARCHITECTURES_BY_NAME = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import com.google.android.gms.tasks.Continuation;
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 Expand Up @@ -135,6 +137,7 @@ public static <T> T awaitEvenIfOnMainThread(Task<T> task)
}

/** Invokes latch.await(timeout, unit) uninterruptibly. */
@CanIgnoreReturnValue
public static boolean awaitUninterruptibly(CountDownLatch latch, long timeout, TimeUnit unit) {
boolean interrupted = false;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

package com.google.firebase.crashlytics.internal.metadata;

import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.firebase.crashlytics.internal.Logger;
import com.google.firebase.crashlytics.internal.model.CrashlyticsReport;
import java.util.ArrayList;
Expand All @@ -38,6 +39,7 @@ public synchronized List<RolloutAssignment> getRolloutAssignmentList() {
return Collections.unmodifiableList(new ArrayList<RolloutAssignment>(rolloutsState));
}

@CanIgnoreReturnValue
public synchronized boolean updateRolloutAssignmentList(List<RolloutAssignment> newMapList) {
rolloutsState.clear();
int nOverLimit = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

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;
import com.google.firebase.crashlytics.internal.model.CrashlyticsReport;
Expand Down Expand Up @@ -180,6 +182,7 @@ public List<CrashlyticsReport.Session.Event.RolloutAssignment> getRolloutsState(
* Update RolloutsState in memory and persistence. Return True if update successfully, false
* otherwise
*/
@CanIgnoreReturnValue
public boolean updateRolloutsState(List<RolloutAssignment> rolloutAssignments) {
synchronized (rolloutsState) {
if (!rolloutsState.updateRolloutAssignmentList(rolloutAssignments)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1119,7 +1119,7 @@ public static RolloutsState.Builder builder() {
public abstract static class Builder {
@NonNull
public abstract RolloutsState.Builder setRolloutAssignments(
@Nullable List<RolloutAssignment> rolloutAssignments);
@NonNull List<RolloutAssignment> rolloutAssignments);

@NonNull
public abstract RolloutsState build();
Expand Down Expand Up @@ -1215,7 +1215,7 @@ public abstract static class Builder {
@NonNull
public abstract Builder setLog(@NonNull Log value);

@Nullable
@NonNull
public abstract Builder setRollouts(@NonNull RolloutsState rolloutsState);

@NonNull
Expand Down

0 comments on commit 8a7621b

Please sign in to comment.