Make effectively private properties actually private to avoid accessors

This commit is contained in:
Ilya Gorbunov
2019-08-09 21:28:58 +03:00
parent f889d25287
commit a493d46a6e
+2 -2
View File
@@ -29,7 +29,7 @@ public abstract class AbstractLongClock(protected val unit: DurationUnit) : Cloc
*/
protected abstract fun read(): Long
private class LongClockMark(val startedAt: Long, val clock: AbstractLongClock, val offset: Duration) : ClockMark() {
private class LongClockMark(private val startedAt: Long, private val clock: AbstractLongClock, private val offset: Duration) : ClockMark() {
override fun elapsed(): Duration = (clock.read() - startedAt).toDuration(clock.unit) - offset
override fun plus(duration: Duration): ClockMark = LongClockMark(startedAt, clock, offset + duration)
}
@@ -51,7 +51,7 @@ public abstract class AbstractDoubleClock(protected val unit: DurationUnit) : Cl
*/
protected abstract fun read(): Double
private class DoubleClockMark(val startedAt: Double, val clock: AbstractDoubleClock, val offset: Duration) : ClockMark() {
private class DoubleClockMark(private val startedAt: Double, private val clock: AbstractDoubleClock, private val offset: Duration) : ClockMark() {
override fun elapsed(): Duration = (clock.read() - startedAt).toDuration(clock.unit) - offset
override fun plus(duration: Duration): ClockMark = DoubleClockMark(startedAt, clock, offset + duration)
}