Skip to content

Commit fe9d619

Browse files
davidmotsonDavid Motsonashvili
and
David Motsonashvili
authored
remove javax.annotation.Nonnull from files containing a different Non… (#6141)
…Null annotation Co-authored-by: David Motsonashvili <[email protected]>
1 parent 6731b55 commit fe9d619

File tree

7 files changed

+24
-29
lines changed

7 files changed

+24
-29
lines changed

firebase-config/bandwagoner/src/main/java/com/googletest/firebase/remoteconfig/bandwagoner/RealtimeFragment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ private void toggleRealtime(View view, Boolean isChecked) {
9494
frc.addOnConfigUpdateListener(
9595
new ConfigUpdateListener() {
9696
@Override
97-
public void onUpdate(ConfigUpdate configUpdate) {
97+
public void onUpdate(@NonNull ConfigUpdate configUpdate) {
9898
Log.d(TAG, String.join(", ", configUpdate.getUpdatedKeys()));
9999
updatedParamsText.setText(String.join(", ", configUpdate.getUpdatedKeys()));
100100
}

firebase-config/src/main/java/com/google/firebase/remoteconfig/ConfigUpdateListener.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
package com.google.firebase.remoteconfig;
1616

1717
import androidx.annotation.NonNull;
18-
import javax.annotation.Nonnull;
1918

2019
/**
2120
* Event listener interface for real-time Remote Config updates. Implement {@code
@@ -38,5 +37,5 @@ public interface ConfigUpdateListener {
3837
*
3938
* @param error A {@link FirebaseRemoteConfigException} with information about the error.
4039
*/
41-
void onError(@Nonnull FirebaseRemoteConfigException error);
40+
void onError(@NonNull FirebaseRemoteConfigException error);
4241
}

firebase-config/src/main/java/com/google/firebase/remoteconfig/FirebaseRemoteConfigServerException.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
import androidx.annotation.NonNull;
1818
import androidx.annotation.Nullable;
19-
import javax.annotation.Nonnull;
2019

2120
/**
2221
* A Firebase Remote Config internal issue caused by an interaction with the Firebase Remote Config
@@ -46,7 +45,7 @@ public FirebaseRemoteConfigServerException(
4645
* Creates a Firebase Remote Config server exception with the given message and {@code
4746
* FirebaseRemoteConfigException} code.
4847
*/
49-
public FirebaseRemoteConfigServerException(@NonNull String detailMessage, @Nonnull Code code) {
48+
public FirebaseRemoteConfigServerException(@NonNull String detailMessage, @NonNull Code code) {
5049
super(detailMessage, code);
5150
this.httpStatusCode = -1;
5251
}
@@ -56,7 +55,7 @@ public FirebaseRemoteConfigServerException(@NonNull String detailMessage, @Nonnu
5655
* {@code FirebaseRemoteConfigException} code.
5756
*/
5857
public FirebaseRemoteConfigServerException(
59-
int httpStatusCode, @NonNull String detailMessage, @Nonnull Code code) {
58+
int httpStatusCode, @NonNull String detailMessage, @NonNull Code code) {
6059
super(detailMessage, code);
6160
this.httpStatusCode = httpStatusCode;
6261
}

firebase-config/src/test/java/com/google/firebase/remoteconfig/FirebaseRemoteConfigTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ public void setUp() throws Exception {
316316
ConfigUpdateListener listener =
317317
new ConfigUpdateListener() {
318318
@Override
319-
public void onUpdate(ConfigUpdate configUpdate) {
319+
public void onUpdate(@NonNull ConfigUpdate configUpdate) {
320320
mockOnUpdateListener.onUpdate(configUpdate);
321321
}
322322

@@ -1757,7 +1757,7 @@ private void flushScheduledTasks() throws InterruptedException {
17571757
private ConfigUpdateListener generateEmptyRealtimeListener() {
17581758
return new ConfigUpdateListener() {
17591759
@Override
1760-
public void onUpdate(ConfigUpdate configUpdate) {}
1760+
public void onUpdate(@NonNull ConfigUpdate configUpdate) {}
17611761

17621762
@Override
17631763
public void onError(@NonNull FirebaseRemoteConfigException error) {}

firebase-firestore/src/main/java/com/google/firebase/firestore/AggregateQuerySnapshot.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import java.util.Collections;
2323
import java.util.Map;
2424
import java.util.Objects;
25-
import javax.annotation.Nonnull;
2625

2726
/**
2827
* The results of executing an {@link AggregateQuery}.
@@ -33,9 +32,9 @@
3332
*/
3433
public class AggregateQuerySnapshot {
3534

36-
@Nonnull private final AggregateQuery query;
35+
@NonNull private final AggregateQuery query;
3736

38-
@Nonnull private final Map<String, Value> data;
37+
@NonNull private final Map<String, Value> data;
3938

4039
AggregateQuerySnapshot(@NonNull AggregateQuery query, @NonNull Map<String, Value> data) {
4140
checkNotNull(query);
@@ -73,7 +72,7 @@ public long getCount() {
7372
* @return The result of the given aggregation.
7473
*/
7574
@Nullable
76-
public Object get(@Nonnull AggregateField aggregateField) {
75+
public Object get(@NonNull AggregateField aggregateField) {
7776
return getInternal(aggregateField);
7877
}
7978

@@ -83,7 +82,7 @@ public Object get(@Nonnull AggregateField aggregateField) {
8382
* @param countAggregateField The count aggregation for which the value is requested.
8483
* @return The result of the given count aggregation.
8584
*/
86-
public long get(@Nonnull AggregateField.CountAggregateField countAggregateField) {
85+
public long get(@NonNull AggregateField.CountAggregateField countAggregateField) {
8786
Long value = getLong(countAggregateField);
8887
if (value == null) {
8988
throw new IllegalArgumentException(
@@ -102,7 +101,7 @@ public long get(@Nonnull AggregateField.CountAggregateField countAggregateField)
102101
* @return The result of the given average aggregation.
103102
*/
104103
@Nullable
105-
public Double get(@Nonnull AggregateField.AverageAggregateField averageAggregateField) {
104+
public Double get(@NonNull AggregateField.AverageAggregateField averageAggregateField) {
106105
return getDouble(averageAggregateField);
107106
}
108107

@@ -116,7 +115,7 @@ public Double get(@Nonnull AggregateField.AverageAggregateField averageAggregate
116115
* @return The result of the given average aggregation as a double.
117116
*/
118117
@Nullable
119-
public Double getDouble(@Nonnull AggregateField aggregateField) {
118+
public Double getDouble(@NonNull AggregateField aggregateField) {
120119
Number val = getTypedValue(aggregateField, Number.class);
121120
return val != null ? val.doubleValue() : null;
122121
}
@@ -130,13 +129,13 @@ public Double getDouble(@Nonnull AggregateField aggregateField) {
130129
* @return The result of the given average aggregation as a long.
131130
*/
132131
@Nullable
133-
public Long getLong(@Nonnull AggregateField aggregateField) {
132+
public Long getLong(@NonNull AggregateField aggregateField) {
134133
Number val = getTypedValue(aggregateField, Number.class);
135134
return val != null ? val.longValue() : null;
136135
}
137136

138137
@Nullable
139-
private Object getInternal(@Nonnull AggregateField aggregateField) {
138+
private Object getInternal(@NonNull AggregateField aggregateField) {
140139
if (!data.containsKey(aggregateField.getAlias())) {
141140
throw new IllegalArgumentException(
142141
"'"
@@ -154,14 +153,14 @@ private Object getInternal(@Nonnull AggregateField aggregateField) {
154153
}
155154

156155
@Nullable
157-
private <T> T getTypedValue(@Nonnull AggregateField aggregateField, Class<T> clazz) {
156+
private <T> T getTypedValue(@NonNull AggregateField aggregateField, Class<T> clazz) {
158157
Object value = getInternal(aggregateField);
159158
return castTypedValue(value, aggregateField, clazz);
160159
}
161160

162161
@Nullable
163162
private <T> T castTypedValue(
164-
Object value, @Nonnull AggregateField aggregateField, Class<T> clazz) {
163+
Object value, @NonNull AggregateField aggregateField, Class<T> clazz) {
165164
if (value == null) {
166165
return null;
167166
} else if (!clazz.isInstance(value)) {

firebase-firestore/src/main/java/com/google/firebase/firestore/local/MemoryRemoteDocumentCache.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import java.util.Iterator;
3232
import java.util.Map;
3333
import java.util.Set;
34-
import javax.annotation.Nonnull;
3534

3635
/** In-memory cache of remote documents. */
3736
final class MemoryRemoteDocumentCache implements RemoteDocumentCache {
@@ -101,7 +100,7 @@ public Map<DocumentKey, MutableDocument> getAll(
101100
public Map<DocumentKey, MutableDocument> getDocumentsMatchingQuery(
102101
Query query,
103102
IndexOffset offset,
104-
@Nonnull Set<DocumentKey> mutatedKeys,
103+
@NonNull Set<DocumentKey> mutatedKeys,
105104
@Nullable QueryContext context) {
106105
Map<DocumentKey, MutableDocument> result = new HashMap<>();
107106

@@ -142,7 +141,7 @@ public Map<DocumentKey, MutableDocument> getDocumentsMatchingQuery(
142141

143142
@Override
144143
public Map<DocumentKey, MutableDocument> getDocumentsMatchingQuery(
145-
Query query, IndexOffset offset, @Nonnull Set<DocumentKey> mutatedKeys) {
144+
Query query, IndexOffset offset, @NonNull Set<DocumentKey> mutatedKeys) {
146145
return getDocumentsMatchingQuery(query, offset, mutatedKeys, /*context*/ null);
147146
}
148147

firebase-inappmessaging/src/main/java/com/google/firebase/inappmessaging/model/ProtoMarshallerClient.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@
1616

1717
import android.text.TextUtils;
1818
import androidx.annotation.NonNull;
19+
import androidx.annotation.Nullable;
1920
import com.google.common.base.Preconditions;
2021
import com.google.firebase.inappmessaging.MessagesProto;
2122
import com.google.firebase.inappmessaging.internal.Logging;
2223
import java.util.Map;
23-
import javax.annotation.Nonnull;
24-
import javax.annotation.Nullable;
2524
import javax.inject.Inject;
2625
import javax.inject.Singleton;
2726

@@ -38,7 +37,7 @@ public class ProtoMarshallerClient {
3837
@Inject
3938
ProtoMarshallerClient() {}
4039

41-
@Nonnull
40+
@NonNull
4241
private static ModalMessage.Builder from(MessagesProto.ModalMessage in) {
4342
ModalMessage.Builder builder = ModalMessage.builder();
4443

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

68-
@Nonnull
67+
@NonNull
6968
private static ImageOnlyMessage.Builder from(MessagesProto.ImageOnlyMessage in) {
7069
ImageOnlyMessage.Builder builder = ImageOnlyMessage.builder();
7170

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

83-
@Nonnull
82+
@NonNull
8483
private static BannerMessage.Builder from(MessagesProto.BannerMessage in) {
8584
BannerMessage.Builder builder = BannerMessage.builder();
8685

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

110-
@Nonnull
109+
@NonNull
111110
private static CardMessage.Builder from(MessagesProto.CardMessage in) {
112111
CardMessage.Builder builder = CardMessage.builder();
113112

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

208207
/** Tranform {@link MessagesProto.Content} proto to an {@link InAppMessage} value object */
209208
public static InAppMessage decode(
210-
@Nonnull MessagesProto.Content in,
209+
@NonNull MessagesProto.Content in,
211210
@NonNull String campaignId,
212211
@NonNull String campaignName,
213212
boolean isTestMessage,

0 commit comments

Comments
 (0)