Some missed 'final' modifiers

This commit is contained in:
Andrew Golovashevich 2025-08-23 23:47:13 +03:00
parent 8f277853bd
commit 05b9fc6078
2 changed files with 10 additions and 10 deletions

View File

@ -12,14 +12,14 @@ public open class ErrorOnConcurrentAccessState : CloseableState.ExternallySynchr
private val _state = newAtomicRef(State.OPEN)
final override val isInUse: Boolean
public final override val isInUse: Boolean
get() = this._state.get() === State.IN_USE
open override fun throwClosed(): Nothing {
public open override fun throwClosed(): Nothing {
throw IllegalStateException("Object is closed")
}
open override fun throwInUse(): Nothing {
public open override fun throwInUse(): Nothing {
throw IllegalStateException("Failed close object because it is in use")
}
@ -27,16 +27,16 @@ public open class ErrorOnConcurrentAccessState : CloseableState.ExternallySynchr
throw IllegalStateException("Object is in use by another thread")
}
final override fun assertNotClosed() {
public final override fun assertNotClosed() {
if (this._state.get() === State.CLOSED)
this.throwClosed()
}
final override val isClosed: Boolean
public final override val isClosed: Boolean
get() = this._state.get() === State.CLOSED
@ManualStateManipulation
final override fun startUsage() {
public final override fun startUsage() {
when (this._state.compareAndExchange(State.OPEN, State.IN_USE)) {
State.OPEN -> {}
State.IN_USE -> this.throwConcurrent()
@ -45,7 +45,7 @@ public open class ErrorOnConcurrentAccessState : CloseableState.ExternallySynchr
}
@ManualStateManipulation
override fun finishUsage() {
public final override fun finishUsage() {
when (this._state.compareAndExchange(State.IN_USE, State.OPEN)) {
State.OPEN -> throw IllegalStateException("Can't finish usage because not it not started")
State.IN_USE -> {}
@ -54,7 +54,7 @@ public open class ErrorOnConcurrentAccessState : CloseableState.ExternallySynchr
}
@ManualStateManipulation
override fun close() {
public final override fun close() {
when (this._state.compareAndExchange(State.OPEN, State.CLOSED)) {
State.OPEN -> {}
State.IN_USE -> this.throwConcurrent()
@ -63,7 +63,7 @@ public open class ErrorOnConcurrentAccessState : CloseableState.ExternallySynchr
}
override fun toString(): String =
public open override fun toString(): String =
when (this._state.get()) {
State.OPEN -> "<closeable error-on-concurrent-access state [free]>"
State.IN_USE -> "<closeable error-on-concurrent-access state [in use]>"

View File

@ -54,7 +54,7 @@ public open class UsagesCounter : CloseableState.AllowsConcurrency {
}
}
override fun toString(): String {
public open override fun toString(): String {
val cached = this._value.get()
@Suppress("LiftReturnOrAssignment")
if (cached < 0)