Skip to content

Commit 9f3b794

Browse files
committed
Rename "old" state variables to "current" state, as suggested by Copilot: #6840 (review)
1 parent 990b568 commit 9f3b794

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

firebase-dataconnect/src/main/kotlin/com/google/firebase/dataconnect/core/DataConnectCredentialsTokenManager.kt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,12 @@ internal sealed class DataConnectCredentialsTokenManager<T : Any>(
193193
fun forceRefresh() {
194194
logger.debug { "forceRefresh()" }
195195
val oldState =
196-
state.getAndUpdate { oldState ->
197-
when (oldState) {
196+
state.getAndUpdate { currentState ->
197+
when (currentState) {
198198
is State.Closed -> State.Closed
199-
is State.New -> oldState.copy(forceTokenRefresh = true)
200-
is State.Idle -> oldState.copy(forceTokenRefresh = true)
201-
is State.Active -> State.Idle(oldState.provider, forceTokenRefresh = true)
199+
is State.New -> currentState.copy(forceTokenRefresh = true)
200+
is State.Idle -> currentState.copy(forceTokenRefresh = true)
201+
is State.Active -> State.Idle(currentState.provider, forceTokenRefresh = true)
202202
}
203203
}
204204

@@ -340,11 +340,11 @@ internal sealed class DataConnectCredentialsTokenManager<T : Any>(
340340
addTokenListener(newProvider)
341341

342342
val oldState =
343-
state.getAndUpdate { oldState ->
344-
when (oldState) {
343+
state.getAndUpdate { currentState ->
344+
when (currentState) {
345345
is State.Closed -> State.Closed
346-
is State.New -> State.Idle(newProvider, oldState.forceTokenRefresh)
347-
is State.Idle -> State.Idle(newProvider, oldState.forceTokenRefresh)
346+
is State.New -> State.Idle(newProvider, currentState.forceTokenRefresh)
347+
is State.Idle -> State.Idle(newProvider, currentState.forceTokenRefresh)
348348
is State.Active -> State.Idle(newProvider, forceTokenRefresh = false)
349349
}
350350
}

firebase-dataconnect/src/main/kotlin/com/google/firebase/dataconnect/core/FirebaseDataConnectImpl.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -425,9 +425,9 @@ internal class FirebaseDataConnectImpl(
425425
// avoid having more than one close job in progress at a time) or a close job that completed
426426
// successfully (since there is nothing to do if a previous close job was successful).
427427
val updatedCloseJobRef =
428-
closeJob.updateAndGet { oldCloseJobRef: NullableReference<Deferred<Unit>> ->
429-
if (oldCloseJobRef.ref !== null && !oldCloseJobRef.ref.isCancelled) {
430-
oldCloseJobRef
428+
closeJob.updateAndGet { currentCloseJobRef: NullableReference<Deferred<Unit>> ->
429+
if (currentCloseJobRef.ref !== null && !currentCloseJobRef.ref.isCancelled) {
430+
currentCloseJobRef
431431
} else {
432432
NullableReference(newCloseJob)
433433
}

firebase-dataconnect/testutil/src/main/kotlin/com/google/firebase/dataconnect/testutil/SuspendingCountDownLatch.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ class SuspendingCountDownLatch(count: Int) {
6161
* @throws IllegalStateException if called when the count has already reached zero.
6262
*/
6363
fun countDown(): SuspendingCountDownLatch {
64-
_count.update { oldValue ->
65-
check(oldValue > 0) { "countDown() called too many times (oldValue=$oldValue)" }
66-
oldValue - 1
64+
_count.update { currentValue ->
65+
check(currentValue > 0) { "countDown() called too many times (currentValue=$currentValue)" }
66+
currentValue - 1
6767
}
6868
return this
6969
}

0 commit comments

Comments
 (0)