Skip to content

Commit 9a9a0e3

Browse files
buenaflorclaude
andcommitted
chore(extend-app-start): Remove redundant comments and rename reset to clear
Drop comments that restate code or annotate omissions (region markers, getter javadoc, the reset call-site comment, the ExtendedAppStart/isActive docs). Rename AppStartExtension.reset() to clear() to match its owner AppStartMetrics.clear(). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 45f6c0b commit 9a9a0e3

4 files changed

Lines changed: 6 additions & 22 deletions

File tree

sentry-android-core/api/sentry-android-core.api

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,13 @@ public final class io/sentry/android/core/AppLifecycleIntegration : io/sentry/In
186186

187187
public final class io/sentry/android/core/AppStartExtension : io/sentry/IAppStartExtender {
188188
public fun <init> (Lio/sentry/android/core/performance/AppStartMetrics;)V
189+
public fun clear ()V
189190
public fun extendAppStart ()V
190191
public fun finishAppStart ()V
191192
public fun finishTransaction (Lio/sentry/SentryDate;)V
192193
public fun getExtendedAppStartSpan ()Lio/sentry/ISpan;
193194
public fun getExtendedEndTime ()Lio/sentry/SentryDate;
194195
public fun isActive ()Z
195-
public fun reset ()V
196196
public fun setExtendAppStartListener (Lio/sentry/android/core/AppStartExtension$ExtendAppStartListener;)V
197197
}
198198

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

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@
2929
@ApiStatus.Internal
3030
public final class AppStartExtension implements IAppStartExtender {
3131

32-
/**
33-
* The standalone App Start transaction and its extended child span, created by the integration.
34-
*/
3532
public static final class ExtendedAppStart {
3633
public final @NotNull ITransaction transaction;
3734
public final @NotNull ISpan span;
@@ -125,7 +122,6 @@ public void finishAppStart() {
125122
}
126123
}
127124

128-
/** Whether an eagerly-created extension transaction exists and has not finished yet. */
129125
public boolean isActive() {
130126
try (final @NotNull ISentryLifecycleToken ignored = lock.acquire()) {
131127
return extendedTransaction != null && !extendedTransaction.isFinished();
@@ -164,12 +160,7 @@ public void finishTransaction(final @NotNull SentryDate endTimestamp) {
164160
}
165161
}
166162

167-
/**
168-
* Resets the per-start state so a stale extension can't affect a later (e.g. warm) app start. The
169-
* registered listener is intentionally kept: it is registered once at SDK init and must survive
170-
* across app starts.
171-
*/
172-
public void reset() {
163+
public void clear() {
173164
try (final @NotNull ISentryLifecycleToken ignored = lock.acquire()) {
174165
extendedSpan = null;
175166
extendedTransaction = null;

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

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -283,9 +283,7 @@ public void onAppStartSpansSent() {
283283
shouldSendStartMeasurements = false;
284284
contentProviderOnCreates.clear();
285285
activityLifecycles.clear();
286-
// Reset extension state so a stale extended span/txn can't affect a later (e.g. warm) app
287-
// start.
288-
appStartExtension.reset();
286+
appStartExtension.clear();
289287
}
290288

291289
public boolean shouldSendStartMeasurements(final boolean ignoreForegroundCheck) {
@@ -341,9 +339,6 @@ public long getClassLoadedUptimeMs() {
341339
return new TimeSpan();
342340
}
343341

344-
// region app start extension
345-
346-
/** The focused component that owns the "extend app start" lifecycle. */
347342
public @NotNull AppStartExtension getAppStartExtension() {
348343
return appStartExtension;
349344
}
@@ -359,8 +354,6 @@ public boolean isAppStartWindowOpen() {
359354
&& !firstDrawDone.get();
360355
}
361356

362-
// endregion
363-
364357
@TestOnly
365358
void setFirstIdle(final long firstIdle) {
366359
this.firstIdle = firstIdle;
@@ -402,7 +395,7 @@ public void clear() {
402395
appStartBaggageHeader = null;
403396
appStartEndTime = null;
404397
cachedStartInfo = null;
405-
appStartExtension.reset();
398+
appStartExtension.clear();
406399
}
407400

408401
public @Nullable ITransactionProfiler getAppStartProfiler() {

sentry-android-core/src/test/java/io/sentry/android/core/AppStartExtensionTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,12 +196,12 @@ class AppStartExtensionTest {
196196
}
197197

198198
@Test
199-
fun `reset clears the extension state`() {
199+
fun `clear clears the extension state`() {
200200
val ext = extension(windowOpen = true)
201201
ext.registerHandOver()
202202
ext.extendAppStart()
203203
assertTrue(ext.isActive)
204-
ext.reset()
204+
ext.clear()
205205
assertFalse(ext.isActive)
206206
assertSame(NoOpSpan.getInstance(), ext.extendedAppStartSpan)
207207
}

0 commit comments

Comments
 (0)