Skip to content

Commit 552940b

Browse files
authored
Final keyword in Metrics methods (#5013)
2 parents 386b53d + f502ffe commit 552940b

File tree

11 files changed

+44
-39
lines changed

11 files changed

+44
-39
lines changed

sentry-android-core/src/main/java/io/sentry/android/core/AndroidMetricsBatchProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public final class AndroidMetricsBatchProcessor extends MetricsBatchProcessor
1212
implements AppState.AppStateListener {
1313

1414
public AndroidMetricsBatchProcessor(
15-
@NotNull SentryOptions options, @NotNull ISentryClient client) {
15+
final @NotNull SentryOptions options, final @NotNull ISentryClient client) {
1616
super(options, client);
1717
AppState.getInstance().addAppStateListener(this);
1818
}

sentry-android-core/src/main/java/io/sentry/android/core/AndroidMetricsBatchProcessorFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
public final class AndroidMetricsBatchProcessorFactory implements IMetricsBatchProcessorFactory {
1010
@Override
1111
public @NotNull IMetricsBatchProcessor create(
12-
@NotNull SentryOptions options, @NotNull SentryClient client) {
12+
final @NotNull SentryOptions options, final @NotNull SentryClient client) {
1313
return new AndroidMetricsBatchProcessor(options, client);
1414
}
1515
}

sentry/src/main/java/io/sentry/SentryLogEvent.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public void setTimestamp(final @NotNull Double timestamp) {
5353
return body;
5454
}
5555

56-
public void setBody(@NotNull String body) {
56+
public void setBody(final @NotNull String body) {
5757
this.body = body;
5858
}
5959

@@ -88,7 +88,7 @@ public void setAttribute(
8888
return severityNumber;
8989
}
9090

91-
public void setSeverityNumber(@Nullable Integer severityNumber) {
91+
public void setSeverityNumber(final @Nullable Integer severityNumber) {
9292
this.severityNumber = severityNumber;
9393
}
9494

@@ -120,7 +120,7 @@ public void serialize(final @NotNull ObjectWriter writer, final @NotNull ILogger
120120

121121
if (unknown != null) {
122122
for (String key : unknown.keySet()) {
123-
Object value = unknown.get(key);
123+
final Object value = unknown.get(key);
124124
writer.name(key).value(logger, value);
125125
}
126126
}
@@ -185,29 +185,29 @@ public static final class Deserializer implements JsonDeserializer<SentryLogEven
185185
reader.endObject();
186186

187187
if (traceId == null) {
188-
String message = "Missing required field \"" + JsonKeys.TRACE_ID + "\"";
189-
Exception exception = new IllegalStateException(message);
188+
final String message = "Missing required field \"" + JsonKeys.TRACE_ID + "\"";
189+
final Exception exception = new IllegalStateException(message);
190190
logger.log(SentryLevel.ERROR, message, exception);
191191
throw exception;
192192
}
193193

194194
if (timestamp == null) {
195-
String message = "Missing required field \"" + JsonKeys.TIMESTAMP + "\"";
196-
Exception exception = new IllegalStateException(message);
195+
final String message = "Missing required field \"" + JsonKeys.TIMESTAMP + "\"";
196+
final Exception exception = new IllegalStateException(message);
197197
logger.log(SentryLevel.ERROR, message, exception);
198198
throw exception;
199199
}
200200

201201
if (body == null) {
202-
String message = "Missing required field \"" + JsonKeys.BODY + "\"";
203-
Exception exception = new IllegalStateException(message);
202+
final String message = "Missing required field \"" + JsonKeys.BODY + "\"";
203+
final Exception exception = new IllegalStateException(message);
204204
logger.log(SentryLevel.ERROR, message, exception);
205205
throw exception;
206206
}
207207

208208
if (level == null) {
209-
String message = "Missing required field \"" + JsonKeys.LEVEL + "\"";
210-
Exception exception = new IllegalStateException(message);
209+
final String message = "Missing required field \"" + JsonKeys.LEVEL + "\"";
210+
final Exception exception = new IllegalStateException(message);
211211
logger.log(SentryLevel.ERROR, message, exception);
212212
throw exception;
213213
}

sentry/src/main/java/io/sentry/SentryLogEventAttributeValue.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ public static final class Deserializer implements JsonDeserializer<SentryLogEven
9999
reader.endObject();
100100

101101
if (type == null) {
102-
String message = "Missing required field \"" + JsonKeys.TYPE + "\"";
103-
Exception exception = new IllegalStateException(message);
102+
final String message = "Missing required field \"" + JsonKeys.TYPE + "\"";
103+
final Exception exception = new IllegalStateException(message);
104104
logger.log(SentryLevel.ERROR, message, exception);
105105
throw exception;
106106
}

sentry/src/main/java/io/sentry/SentryLogEvents.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ public static final class Deserializer implements JsonDeserializer<SentryLogEven
8181
reader.endObject();
8282

8383
if (items == null) {
84-
String message = "Missing required field \"" + JsonKeys.ITEMS + "\"";
85-
Exception exception = new IllegalStateException(message);
84+
final String message = "Missing required field \"" + JsonKeys.ITEMS + "\"";
85+
final Exception exception = new IllegalStateException(message);
8686
logger.log(SentryLevel.ERROR, message, exception);
8787
throw exception;
8888
}

sentry/src/main/java/io/sentry/SentryMetricsEvent.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -79,39 +79,39 @@ public void setTimestamp(final @NotNull Double timestamp) {
7979
return name;
8080
}
8181

82-
public void setName(@NotNull String name) {
82+
public void setName(final @NotNull String name) {
8383
this.name = name;
8484
}
8585

8686
public @NotNull String getType() {
8787
return type;
8888
}
8989

90-
public void setType(@NotNull String type) {
90+
public void setType(final @NotNull String type) {
9191
this.type = type;
9292
}
9393

9494
public @Nullable String getUnit() {
9595
return unit;
9696
}
9797

98-
public void setUnit(@Nullable String unit) {
98+
public void setUnit(final @Nullable String unit) {
9999
this.unit = unit;
100100
}
101101

102102
public @Nullable SpanId getSpanId() {
103103
return spanId;
104104
}
105105

106-
public void setSpanId(@Nullable SpanId spanId) {
106+
public void setSpanId(final @Nullable SpanId spanId) {
107107
this.spanId = spanId;
108108
}
109109

110110
public @NotNull Double getValue() {
111111
return value;
112112
}
113113

114-
public void setValue(@NotNull Double value) {
114+
public void setValue(final @NotNull Double value) {
115115
this.value = value;
116116
}
117117

@@ -241,36 +241,36 @@ public static final class Deserializer implements JsonDeserializer<SentryMetrics
241241
reader.endObject();
242242

243243
if (traceId == null) {
244-
String message = "Missing required field \"" + JsonKeys.TRACE_ID + "\"";
245-
Exception exception = new IllegalStateException(message);
244+
final String message = "Missing required field \"" + JsonKeys.TRACE_ID + "\"";
245+
final Exception exception = new IllegalStateException(message);
246246
logger.log(SentryLevel.ERROR, message, exception);
247247
throw exception;
248248
}
249249

250250
if (timestamp == null) {
251-
String message = "Missing required field \"" + JsonKeys.TIMESTAMP + "\"";
252-
Exception exception = new IllegalStateException(message);
251+
final String message = "Missing required field \"" + JsonKeys.TIMESTAMP + "\"";
252+
final Exception exception = new IllegalStateException(message);
253253
logger.log(SentryLevel.ERROR, message, exception);
254254
throw exception;
255255
}
256256

257257
if (type == null) {
258-
String message = "Missing required field \"" + JsonKeys.TYPE + "\"";
259-
Exception exception = new IllegalStateException(message);
258+
final String message = "Missing required field \"" + JsonKeys.TYPE + "\"";
259+
final Exception exception = new IllegalStateException(message);
260260
logger.log(SentryLevel.ERROR, message, exception);
261261
throw exception;
262262
}
263263

264264
if (name == null) {
265-
String message = "Missing required field \"" + JsonKeys.NAME + "\"";
266-
Exception exception = new IllegalStateException(message);
265+
final String message = "Missing required field \"" + JsonKeys.NAME + "\"";
266+
final Exception exception = new IllegalStateException(message);
267267
logger.log(SentryLevel.ERROR, message, exception);
268268
throw exception;
269269
}
270270

271271
if (value == null) {
272-
String message = "Missing required field \"" + JsonKeys.VALUE + "\"";
273-
Exception exception = new IllegalStateException(message);
272+
final String message = "Missing required field \"" + JsonKeys.VALUE + "\"";
273+
final Exception exception = new IllegalStateException(message);
274274
logger.log(SentryLevel.ERROR, message, exception);
275275
throw exception;
276276
}

sentry/src/main/java/io/sentry/SentryMetricsEvents.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ public static final class Deserializer implements JsonDeserializer<SentryMetrics
8181
reader.endObject();
8282

8383
if (items == null) {
84-
String message = "Missing required field \"" + JsonKeys.ITEMS + "\"";
85-
Exception exception = new IllegalStateException(message);
84+
final String message = "Missing required field \"" + JsonKeys.ITEMS + "\"";
85+
final Exception exception = new IllegalStateException(message);
8686
logger.log(SentryLevel.ERROR, message, exception);
8787
throw exception;
8888
}

sentry/src/main/java/io/sentry/SentryOptions.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3771,7 +3771,7 @@ public boolean isEnabled() {
37713771
*
37723772
* @param enableMetrics true if Sentry Metrics should be enabled
37733773
*/
3774-
public void setEnabled(boolean enableMetrics) {
3774+
public void setEnabled(final boolean enableMetrics) {
37753775
this.enable = enableMetrics;
37763776
}
37773777

@@ -3789,7 +3789,7 @@ public void setEnabled(boolean enableMetrics) {
37893789
*
37903790
* @param beforeSend the beforeSend callback for metrics
37913791
*/
3792-
public void setBeforeSend(@Nullable BeforeSendMetricCallback beforeSend) {
3792+
public void setBeforeSend(final @Nullable BeforeSendMetricCallback beforeSend) {
37933793
this.beforeSend = beforeSend;
37943794
}
37953795

@@ -3813,7 +3813,7 @@ public interface BeforeSendMetricCallback {
38133813
* @return the original metric, mutated metric or null if metric was dropped
38143814
*/
38153815
@Nullable
3816-
SentryMetricsEvent execute(@NotNull SentryMetricsEvent metric);
3816+
SentryMetricsEvent execute(final @NotNull SentryMetricsEvent metric);
38173817
}
38183818
}
38193819

sentry/src/main/java/io/sentry/metrics/DefaultMetricsBatchProcessorFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
public final class DefaultMetricsBatchProcessorFactory implements IMetricsBatchProcessorFactory {
88
@Override
99
public @NotNull IMetricsBatchProcessor create(
10-
@NotNull SentryOptions options, @NotNull SentryClient client) {
10+
final @NotNull SentryOptions options, final @NotNull SentryClient client) {
1111
return new MetricsBatchProcessor(options, client);
1212
}
1313
}

sentry/src/main/java/io/sentry/metrics/IMetricsBatchProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public interface IMetricsBatchProcessor {
99
void close(boolean isRestarting);
1010

1111
/**
12-
* Flushes log events.
12+
* Flushes metrics.
1313
*
1414
* @param timeoutMillis time in milliseconds
1515
*/

0 commit comments

Comments
 (0)