Skip to content

Commit 76d7a36

Browse files
runningcodeclaude
andauthored
docs(android): Fix Javadoc that Error Prone flags in sentry-android-core (#6498)
Error Prone never ran on sentry-android-core. Enabling it reports 34 Javadoc warnings, which fail the build under -Werror: - MissingSummary: turn the @return text into a "Returns ..." summary, and add summaries to Javadocs that only had block tags. - InvalidBlockTag: replace the @noinspection unused Javadoc tags with @SuppressWarnings("unused"), which IntelliJ honors too. - NotJavadoc: turn the Javadoc on methods of an anonymous class into regular comments. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent ff7a1ac commit 76d7a36

11 files changed

Lines changed: 53 additions & 60 deletions

‎sentry-android-core/src/main/java/io/sentry/android/core/InternalSentrySdk.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
public final class InternalSentrySdk {
5252

5353
/**
54-
* @return a copy of the current scopes's topmost scope, or null in case the scopes is disabled
54+
* Returns a copy of the current scopes's topmost scope, or null in case the scopes is disabled.
5555
*/
5656
@Nullable
5757
public static IScope getCurrentScope() {

‎sentry-android-core/src/main/java/io/sentry/android/core/SentryAndroidOptions.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -851,8 +851,8 @@ public void setReportHistoricalMemoryLimiterExits(
851851
}
852852

853853
/**
854-
* @return true if performance-v2 is enabled. See {@link #setEnablePerformanceV2(boolean)} for
855-
* more details.
854+
* Returns true if performance-v2 is enabled. See {@link #setEnablePerformanceV2(boolean)} for
855+
* more details.
856856
*/
857857
public boolean isEnablePerformanceV2() {
858858
return enablePerformanceV2;
@@ -871,8 +871,8 @@ public void setEnablePerformanceV2(final boolean enablePerformanceV2) {
871871
}
872872

873873
/**
874-
* @return true if standalone app start tracing is enabled. See {@link
875-
* #setEnableStandaloneAppStartTracing(boolean)} for more details.
874+
* Returns true if standalone app start tracing is enabled. See {@link
875+
* #setEnableStandaloneAppStartTracing(boolean)} for more details.
876876
*/
877877
@ApiStatus.Experimental
878878
public boolean isEnableStandaloneAppStartTracing() {

‎sentry-android-core/src/main/java/io/sentry/android/core/SentryFrameMetrics.java‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,9 @@ public SentryFrameMetrics duplicate() {
9191
}
9292

9393
/**
94+
* Returns the difference between two frame metrics (this minus other).
95+
*
9496
* @param other the other frame metrics to compare to, usually the older one
95-
* @return the difference between two frame metrics (this minus other)
9697
*/
9798
@NotNull
9899
public SentryFrameMetrics diffTo(final @NotNull SentryFrameMetrics other) {
@@ -105,8 +106,8 @@ public SentryFrameMetrics diffTo(final @NotNull SentryFrameMetrics other) {
105106
}
106107

107108
/**
108-
* @return true if the frame metrics contain valid data, meaning all values are greater or equal
109-
* to 0
109+
* Returns true if the frame metrics contain valid data, meaning all values are greater or equal
110+
* to 0.
110111
*/
111112
public boolean containsValidData() {
112113
return slowFrameCount >= 0

‎sentry-android-core/src/main/java/io/sentry/android/core/SentryFramesDelayResult.java‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,13 @@ public SentryFramesDelayResult(
1616
}
1717

1818
/**
19-
* @return the total frame delay in seconds, or -1 if incalculable (e.g. no frame data available)
19+
* Returns the total frame delay in seconds, or -1 if incalculable (e.g. no frame data available).
2020
*/
2121
public double getDelaySeconds() {
2222
return delaySeconds;
2323
}
2424

25-
/**
26-
* @return the number of frames that contributed to the delay (slow + frozen frames)
27-
*/
25+
/** Returns the number of frames that contributed to the delay (slow + frozen frames). */
2826
public int getFramesContributingToDelayCount() {
2927
return framesContributingToDelayCount;
3028
}

‎sentry-android-core/src/main/java/io/sentry/android/core/anr/AnrCulpritIdentifier.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,9 @@ public boolean equals(final Object obj) {
8989
}
9090

9191
/**
92+
* Returns the most common occurring stacktrace identified as the culprit.
93+
*
9294
* @param stacks a list of stack traces to analyze
93-
* @return the most common occurring stacktrace identified as the culprit
9495
*/
9596
@Nullable
9697
public static AggregatedStackTrace identify(final @NotNull List<AnrStackTrace> stacks) {

‎sentry-android-core/src/main/java/io/sentry/android/core/internal/util/AndroidConnectionStatusProvider.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ private void updateCacheAndNotifyObservers(
304304
}
305305
}
306306

307-
/**
307+
/*
308308
* Check if NetworkCapabilities change is significant for our observers. Only notify for
309309
* changes that affect connectivity status or connection type.
310310
*/
@@ -334,7 +334,7 @@ private boolean isSignificantChange(@Nullable NetworkCapabilities newCapabilitie
334334
return false;
335335
}
336336

337-
/** Check if capabilities that affect connectivity status changed. */
337+
/* Check if capabilities that affect connectivity status changed. */
338338
private boolean hasSignificantCapabilityChanges(
339339
@NotNull NetworkCapabilities old, @NotNull NetworkCapabilities new_) {
340340
// Check capabilities we care about for connectivity determination
@@ -348,7 +348,7 @@ private boolean hasSignificantCapabilityChanges(
348348
return false;
349349
}
350350

351-
/** Check if transport types that affect connection type changed. */
351+
/* Check if transport types that affect connection type changed. */
352352
private boolean hasSignificantTransportChanges(
353353
@NotNull NetworkCapabilities old, @NotNull NetworkCapabilities new_) {
354354
// Check transports we care about for connection type determination

‎sentry-android-core/src/main/java/io/sentry/android/core/internal/util/Debouncer.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ public Debouncer(
2727
}
2828

2929
/**
30-
* @return true if the execution should be debounced due to maxExecutions executions being made
31-
* within waitTimeMs, otherwise false.
30+
* Returns true if the execution should be debounced due to maxExecutions executions being made
31+
* within waitTimeMs, otherwise false.
3232
*/
3333
public boolean checkForDebounce() {
3434
final long now = timeProvider.getCurrentTimeMillis();

‎sentry-android-core/src/main/java/io/sentry/android/core/internal/util/ScreenshotUtils.java‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ public class ScreenshotUtils {
2929
private static final long CAPTURE_TIMEOUT_MS = 1000;
3030

3131
// Used by Hybrid SDKs
32-
/**
33-
* @noinspection unused
34-
*/
32+
@SuppressWarnings("unused")
3533
public static @Nullable byte[] takeScreenshot(
3634
final @NotNull Activity activity,
3735
final @NotNull ILogger logger,
@@ -58,8 +56,8 @@ public class ScreenshotUtils {
5856
* same way {@link io.sentry.android.core.ScreenshotEventProcessor} does for native errors.
5957
*
6058
* @see #captureMaskedScreenshot(Activity, SentryAndroidOptions, BuildInfoProvider, boolean)
61-
* @noinspection unused
6259
*/
60+
@SuppressWarnings("unused")
6361
public static @Nullable byte[] takeMaskedScreenshot(
6462
final @NotNull Activity activity,
6563
final @NotNull SentryAndroidOptions options,

‎sentry-android-core/src/main/java/io/sentry/android/core/internal/util/SentryFrameMetricsCollector.java‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -413,9 +413,7 @@ private void trackCurrentWindow() {
413413
}
414414
}
415415

416-
/**
417-
* @return the last known time a frame was started, according to the Choreographer
418-
*/
416+
/** Returns the last known time a frame was started, according to the Choreographer. */
419417
public long getLastKnownFrameStartTimeNanos() {
420418
// Let's read the choreographer private field to get start timestamp of the frame, which
421419
// uses System.nanoTime() under the hood

‎sentry-android-core/src/main/java/io/sentry/android/core/performance/AppStartMetrics.java‎

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -121,16 +121,16 @@ public AppStartMetrics() {
121121
}
122122

123123
/**
124-
* @return the app start span Uses Process.getStartUptimeMillis() as start timestamp, which
125-
* requires API level 24+
124+
* Returns the app start span. It uses Process.getStartUptimeMillis() as start timestamp, which
125+
* requires API level 24+.
126126
*/
127127
public @NotNull TimeSpan getAppStartTimeSpan() {
128128
return appStartSpan;
129129
}
130130

131131
/**
132-
* @return the app start span Uses Process.getStartUptimeMillis() as start timestamp, which
133-
* requires API level 24+
132+
* Returns the app start span. It uses Process.getStartUptimeMillis() as start timestamp, which
133+
* requires API level 24+.
134134
*/
135135
public @NotNull TimeSpan createProcessInitSpan() {
136136
// AppStartSpan and CLASS_LOADED_UPTIME_MS can be modified at any time.
@@ -145,11 +145,12 @@ public AppStartMetrics() {
145145
}
146146

147147
/**
148-
* @return the SDK init time span, as measured pre-performance-v2 Uses ContentProvider/Sdk init
149-
* time as start timestamp
150-
* <p>Data is filled by either {@link io.sentry.android.core.SentryPerformanceProvider} with a
151-
* fallback to {@link io.sentry.android.core.SentryAndroid}. At least the start timestamp
152-
* should always be set.
148+
* Returns the SDK init time span, as measured pre-performance-v2. Uses ContentProvider/Sdk init
149+
* time as start timestamp.
150+
*
151+
* <p>Data is filled by either {@link io.sentry.android.core.SentryPerformanceProvider} with a
152+
* fallback to {@link io.sentry.android.core.SentryAndroid}. At least the start timestamp should
153+
* always be set.
153154
*/
154155
public @NotNull TimeSpan getSdkInitTimeSpan() {
155156
return sdkInitTimeSpan;
@@ -339,8 +340,8 @@ public long getClassLoadedUptimeMs() {
339340
}
340341

341342
/**
342-
* @return the app start time span if it was started and perf-2 is enabled, falls back to the sdk
343-
* init time span otherwise
343+
* Returns the app start time span if it was started and perf-2 is enabled, falls back to the sdk
344+
* init time span otherwise.
344345
*/
345346
public @NotNull TimeSpan getAppStartTimeSpanWithFallback(
346347
final @NotNull SentryAndroidOptions options) {
@@ -468,8 +469,8 @@ public void setCachedStartInfo(final @Nullable ApplicationStartInfo cachedStartI
468469
* Called by instrumentation
469470
*
470471
* @param application The application object where onCreate was called on
471-
* @noinspection unused
472472
*/
473+
@SuppressWarnings("unused")
473474
public static void onApplicationCreate(final @NotNull Application application) {
474475
final long now = SystemClock.uptimeMillis();
475476

@@ -484,8 +485,8 @@ public static void onApplicationCreate(final @NotNull Application application) {
484485
* Called by instrumentation
485486
*
486487
* @param application The application object where onCreate was called on
487-
* @noinspection unused
488488
*/
489+
@SuppressWarnings("unused")
489490
public static void onApplicationPostCreate(final @NotNull Application application) {
490491
final long now = SystemClock.uptimeMillis();
491492

@@ -755,8 +756,8 @@ public void onActivityDestroyed(@NonNull Activity activity) {
755756
* Called by instrumentation
756757
*
757758
* @param contentProvider The content provider where onCreate was called on
758-
* @noinspection unused
759759
*/
760+
@SuppressWarnings("unused")
760761
public static void onContentProviderCreate(final @NotNull ContentProvider contentProvider) {
761762
final long now = SystemClock.uptimeMillis();
762763

@@ -769,8 +770,8 @@ public static void onContentProviderCreate(final @NotNull ContentProvider conten
769770
* Called by instrumentation
770771
*
771772
* @param contentProvider The content provider where onCreate was called on
772-
* @noinspection unused
773773
*/
774+
@SuppressWarnings("unused")
774775
public static void onContentProviderPostCreate(final @NotNull ContentProvider contentProvider) {
775776
final long now = SystemClock.uptimeMillis();
776777

0 commit comments

Comments
 (0)