Removed 'throw*' methods
This commit is contained in:
parent
05b9fc6078
commit
ed06e6c2a0
@ -15,12 +15,6 @@ public sealed class ChildCloseableState<T : CloseableState> : CloseableState {
|
|||||||
this._state = state
|
this._state = state
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun throwClosed(): Nothing =
|
|
||||||
this._state.throwClosed()
|
|
||||||
|
|
||||||
override fun throwInUse(): Nothing =
|
|
||||||
this._state.throwInUse()
|
|
||||||
|
|
||||||
override fun assertNotClosed(): Unit =
|
override fun assertNotClosed(): Unit =
|
||||||
this._state.assertNotClosed()
|
this._state.assertNotClosed()
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,6 @@
|
|||||||
package ru.landgrafhomyak.utility.closeable_state_1
|
package ru.landgrafhomyak.utility.closeable_state_1
|
||||||
|
|
||||||
public interface CloseableState : AutoCloseable {
|
public interface CloseableState {
|
||||||
public fun throwClosed(): Nothing
|
|
||||||
public fun throwInUse(): Nothing
|
|
||||||
|
|
||||||
public fun assertNotClosed()
|
public fun assertNotClosed()
|
||||||
|
|
||||||
public val isClosed: Boolean
|
public val isClosed: Boolean
|
||||||
@ -15,7 +12,7 @@ public interface CloseableState : AutoCloseable {
|
|||||||
public fun finishUsage()
|
public fun finishUsage()
|
||||||
|
|
||||||
@ManualStateManipulation
|
@ManualStateManipulation
|
||||||
public override fun close()
|
public fun close()
|
||||||
|
|
||||||
public interface AllowsConcurrency : CloseableState {
|
public interface AllowsConcurrency : CloseableState {
|
||||||
|
|
||||||
|
|||||||
@ -8,12 +8,6 @@ public class CloseableStateCloseableWrapper(
|
|||||||
override val isInUse: Boolean by this._self::isInUse
|
override val isInUse: Boolean by this._self::isInUse
|
||||||
override val isClosed: Boolean by this._self::isInUse
|
override val isClosed: Boolean by this._self::isInUse
|
||||||
|
|
||||||
override fun throwClosed(): Nothing =
|
|
||||||
this._self.throwClosed()
|
|
||||||
|
|
||||||
override fun throwInUse(): Nothing =
|
|
||||||
this._self.throwInUse()
|
|
||||||
|
|
||||||
override fun assertNotClosed(): Unit =
|
override fun assertNotClosed(): Unit =
|
||||||
this._self.assertNotClosed()
|
this._self.assertNotClosed()
|
||||||
|
|
||||||
|
|||||||
@ -15,15 +15,15 @@ public open class ErrorOnConcurrentAccessState : CloseableState.ExternallySynchr
|
|||||||
public final override val isInUse: Boolean
|
public final override val isInUse: Boolean
|
||||||
get() = this._state.get() === State.IN_USE
|
get() = this._state.get() === State.IN_USE
|
||||||
|
|
||||||
public open override fun throwClosed(): Nothing {
|
protected open fun throwClosed(): Nothing {
|
||||||
throw IllegalStateException("Object is closed")
|
throw IllegalStateException("Object is closed")
|
||||||
}
|
}
|
||||||
|
|
||||||
public open override fun throwInUse(): Nothing {
|
protected open fun throwInUse(): Nothing {
|
||||||
throw IllegalStateException("Failed close object because it is in use")
|
throw IllegalStateException("Failed close object because it is in use")
|
||||||
}
|
}
|
||||||
|
|
||||||
public open fun throwConcurrent(): Nothing {
|
protected open fun throwConcurrent(): Nothing {
|
||||||
throw IllegalStateException("Object is in use by another thread")
|
throw IllegalStateException("Object is in use by another thread")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -17,11 +17,11 @@ public open class UsagesCounter : CloseableState.AllowsConcurrency {
|
|||||||
|
|
||||||
public fun getCurrentUsagesCount(): Long = this._value.get()
|
public fun getCurrentUsagesCount(): Long = this._value.get()
|
||||||
|
|
||||||
public open override fun throwClosed(): Nothing {
|
protected open fun throwClosed(): Nothing {
|
||||||
throw IllegalStateException("Object is closed")
|
throw IllegalStateException("Object is closed")
|
||||||
}
|
}
|
||||||
|
|
||||||
public open override fun throwInUse(): Nothing {
|
protected open fun throwInUse(): Nothing {
|
||||||
throw IllegalStateException("Failed close object because it is in use")
|
throw IllegalStateException("Failed close object because it is in use")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user