Skip to content

remove javax.annotation.Nonnull from files containing a different Non… #6141

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

Merged
merged 6 commits into from
Sep 24, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ private void toggleRealtime(View view, Boolean isChecked) {
frc.addOnConfigUpdateListener(
new ConfigUpdateListener() {
@Override
public void onUpdate(ConfigUpdate configUpdate) {
public void onUpdate(@NonNull ConfigUpdate configUpdate) {
Log.d(TAG, String.join(", ", configUpdate.getUpdatedKeys()));
updatedParamsText.setText(String.join(", ", configUpdate.getUpdatedKeys()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package com.google.firebase.remoteconfig;

import androidx.annotation.NonNull;
import javax.annotation.Nonnull;

/**
* Event listener interface for real-time Remote Config updates. Implement {@code
Expand All @@ -38,5 +37,5 @@ public interface ConfigUpdateListener {
*
* @param error A {@link FirebaseRemoteConfigException} with information about the error.
*/
void onError(@Nonnull FirebaseRemoteConfigException error);
void onError(@NonNull FirebaseRemoteConfigException error);
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import javax.annotation.Nonnull;

/**
* A Firebase Remote Config internal issue caused by an interaction with the Firebase Remote Config
Expand Down Expand Up @@ -46,7 +45,7 @@ public FirebaseRemoteConfigServerException(
* Creates a Firebase Remote Config server exception with the given message and {@code
* FirebaseRemoteConfigException} code.
*/
public FirebaseRemoteConfigServerException(@NonNull String detailMessage, @Nonnull Code code) {
public FirebaseRemoteConfigServerException(@NonNull String detailMessage, @NonNull Code code) {
super(detailMessage, code);
this.httpStatusCode = -1;
}
Expand All @@ -56,7 +55,7 @@ public FirebaseRemoteConfigServerException(@NonNull String detailMessage, @Nonnu
* {@code FirebaseRemoteConfigException} code.
*/
public FirebaseRemoteConfigServerException(
int httpStatusCode, @NonNull String detailMessage, @Nonnull Code code) {
int httpStatusCode, @NonNull String detailMessage, @NonNull Code code) {
super(detailMessage, code);
this.httpStatusCode = httpStatusCode;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ public void setUp() throws Exception {
ConfigUpdateListener listener =
new ConfigUpdateListener() {
@Override
public void onUpdate(ConfigUpdate configUpdate) {
public void onUpdate(@NonNull ConfigUpdate configUpdate) {
mockOnUpdateListener.onUpdate(configUpdate);
}

Expand Down Expand Up @@ -1757,7 +1757,7 @@ private void flushScheduledTasks() throws InterruptedException {
private ConfigUpdateListener generateEmptyRealtimeListener() {
return new ConfigUpdateListener() {
@Override
public void onUpdate(ConfigUpdate configUpdate) {}
public void onUpdate(@NonNull ConfigUpdate configUpdate) {}

@Override
public void onError(@NonNull FirebaseRemoteConfigException error) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import java.util.Collections;
import java.util.Map;
import java.util.Objects;
import javax.annotation.Nonnull;

/**
* The results of executing an {@link AggregateQuery}.
Expand All @@ -33,9 +32,9 @@
*/
public class AggregateQuerySnapshot {

@Nonnull private final AggregateQuery query;
@NonNull private final AggregateQuery query;

@Nonnull private final Map<String, Value> data;
@NonNull private final Map<String, Value> data;

AggregateQuerySnapshot(@NonNull AggregateQuery query, @NonNull Map<String, Value> data) {
checkNotNull(query);
Expand Down Expand Up @@ -73,7 +72,7 @@ public long getCount() {
* @return The result of the given aggregation.
*/
@Nullable
public Object get(@Nonnull AggregateField aggregateField) {
public Object get(@NonNull AggregateField aggregateField) {
return getInternal(aggregateField);
}

Expand All @@ -83,7 +82,7 @@ public Object get(@Nonnull AggregateField aggregateField) {
* @param countAggregateField The count aggregation for which the value is requested.
* @return The result of the given count aggregation.
*/
public long get(@Nonnull AggregateField.CountAggregateField countAggregateField) {
public long get(@NonNull AggregateField.CountAggregateField countAggregateField) {
Long value = getLong(countAggregateField);
if (value == null) {
throw new IllegalArgumentException(
Expand All @@ -102,7 +101,7 @@ public long get(@Nonnull AggregateField.CountAggregateField countAggregateField)
* @return The result of the given average aggregation.
*/
@Nullable
public Double get(@Nonnull AggregateField.AverageAggregateField averageAggregateField) {
public Double get(@NonNull AggregateField.AverageAggregateField averageAggregateField) {
return getDouble(averageAggregateField);
}

Expand All @@ -116,7 +115,7 @@ public Double get(@Nonnull AggregateField.AverageAggregateField averageAggregate
* @return The result of the given average aggregation as a double.
*/
@Nullable
public Double getDouble(@Nonnull AggregateField aggregateField) {
public Double getDouble(@NonNull AggregateField aggregateField) {
Number val = getTypedValue(aggregateField, Number.class);
return val != null ? val.doubleValue() : null;
}
Expand All @@ -130,13 +129,13 @@ public Double getDouble(@Nonnull AggregateField aggregateField) {
* @return The result of the given average aggregation as a long.
*/
@Nullable
public Long getLong(@Nonnull AggregateField aggregateField) {
public Long getLong(@NonNull AggregateField aggregateField) {
Number val = getTypedValue(aggregateField, Number.class);
return val != null ? val.longValue() : null;
}

@Nullable
private Object getInternal(@Nonnull AggregateField aggregateField) {
private Object getInternal(@NonNull AggregateField aggregateField) {
if (!data.containsKey(aggregateField.getAlias())) {
throw new IllegalArgumentException(
"'"
Expand All @@ -154,14 +153,14 @@ private Object getInternal(@Nonnull AggregateField aggregateField) {
}

@Nullable
private <T> T getTypedValue(@Nonnull AggregateField aggregateField, Class<T> clazz) {
private <T> T getTypedValue(@NonNull AggregateField aggregateField, Class<T> clazz) {
Object value = getInternal(aggregateField);
return castTypedValue(value, aggregateField, clazz);
}

@Nullable
private <T> T castTypedValue(
Object value, @Nonnull AggregateField aggregateField, Class<T> clazz) {
Object value, @NonNull AggregateField aggregateField, Class<T> clazz) {
if (value == null) {
return null;
} else if (!clazz.isInstance(value)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import javax.annotation.Nonnull;

/** In-memory cache of remote documents. */
final class MemoryRemoteDocumentCache implements RemoteDocumentCache {
Expand Down Expand Up @@ -101,7 +100,7 @@ public Map<DocumentKey, MutableDocument> getAll(
public Map<DocumentKey, MutableDocument> getDocumentsMatchingQuery(
Query query,
IndexOffset offset,
@Nonnull Set<DocumentKey> mutatedKeys,
@NonNull Set<DocumentKey> mutatedKeys,
@Nullable QueryContext context) {
Map<DocumentKey, MutableDocument> result = new HashMap<>();

Expand Down Expand Up @@ -142,7 +141,7 @@ public Map<DocumentKey, MutableDocument> getDocumentsMatchingQuery(

@Override
public Map<DocumentKey, MutableDocument> getDocumentsMatchingQuery(
Query query, IndexOffset offset, @Nonnull Set<DocumentKey> mutatedKeys) {
Query query, IndexOffset offset, @NonNull Set<DocumentKey> mutatedKeys) {
return getDocumentsMatchingQuery(query, offset, mutatedKeys, /*context*/ null);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@

import android.text.TextUtils;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.common.base.Preconditions;
import com.google.firebase.inappmessaging.MessagesProto;
import com.google.firebase.inappmessaging.internal.Logging;
import java.util.Map;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.inject.Inject;
import javax.inject.Singleton;

Expand All @@ -38,7 +37,7 @@ public class ProtoMarshallerClient {
@Inject
ProtoMarshallerClient() {}

@Nonnull
@NonNull
private static ModalMessage.Builder from(MessagesProto.ModalMessage in) {
ModalMessage.Builder builder = ModalMessage.builder();

Expand All @@ -65,7 +64,7 @@ private static ModalMessage.Builder from(MessagesProto.ModalMessage in) {
return builder;
}

@Nonnull
@NonNull
private static ImageOnlyMessage.Builder from(MessagesProto.ImageOnlyMessage in) {
ImageOnlyMessage.Builder builder = ImageOnlyMessage.builder();

Expand All @@ -80,7 +79,7 @@ private static ImageOnlyMessage.Builder from(MessagesProto.ImageOnlyMessage in)
return builder;
}

@Nonnull
@NonNull
private static BannerMessage.Builder from(MessagesProto.BannerMessage in) {
BannerMessage.Builder builder = BannerMessage.builder();

Expand All @@ -107,7 +106,7 @@ private static BannerMessage.Builder from(MessagesProto.BannerMessage in) {
return builder;
}

@Nonnull
@NonNull
private static CardMessage.Builder from(MessagesProto.CardMessage in) {
CardMessage.Builder builder = CardMessage.builder();

Expand Down Expand Up @@ -207,7 +206,7 @@ private static Text decode(MessagesProto.Text in) {

/** Tranform {@link MessagesProto.Content} proto to an {@link InAppMessage} value object */
public static InAppMessage decode(
@Nonnull MessagesProto.Content in,
@NonNull MessagesProto.Content in,
@NonNull String campaignId,
@NonNull String campaignName,
boolean isTestMessage,
Expand Down
Loading