Skip to content

Commit

Permalink
[#3146] Make implementation classes internal (#3147)
Browse files Browse the repository at this point in the history
  • Loading branch information
mustafaozhan committed Feb 2, 2024
1 parent c59e1a5 commit a93beff
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.russhwolf.settings.coroutines.FlowSettings
import kotlinx.coroutines.flow.Flow

@Suppress("OPT_IN_USAGE")
class FlowPersistenceImpl(private val flowSettings: FlowSettings) : FlowPersistence {
internal class FlowPersistenceImpl(private val flowSettings: FlowSettings) : FlowPersistence {
@Suppress("UNCHECKED_CAST")
override fun <T : Any> getFlow(key: String, defaultValue: T): Flow<T> =
when (defaultValue) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import com.oztechan.ccc.client.core.persistence.error.UnsupportedPersistenceExce
import com.russhwolf.settings.coroutines.SuspendSettings

@Suppress("OPT_IN_USAGE")
class SuspendPersistenceImpl(private val suspendSettings: SuspendSettings) : SuspendPersistence {
internal class SuspendPersistenceImpl(private val suspendSettings: SuspendSettings) :
SuspendPersistence {

@Suppress("UNCHECKED_CAST")
override suspend fun <T : Any> getSuspend(key: String, defaultValue: T): T =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.oztechan.ccc.client.storage.calculation

import com.oztechan.ccc.client.core.persistence.SuspendPersistence

class CalculationStorageImpl(
internal class CalculationStorageImpl(
private val suspendPersistence: SuspendPersistence
) : CalculationStorage {

Expand Down
10 changes: 10 additions & 0 deletions test/src/test/kotlin/com/oztechan/ccc/test/ConventionTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.lemonappdev.konsist.api.declaration.KoFunctionDeclaration
import com.lemonappdev.konsist.api.declaration.KoPropertyDeclaration
import com.lemonappdev.konsist.api.ext.list.indexOfFirstInstance
import com.lemonappdev.konsist.api.ext.list.indexOfLastInstance
import com.lemonappdev.konsist.api.ext.list.withNameEndingWith
import com.lemonappdev.konsist.api.verify.assertFalse
import com.lemonappdev.konsist.api.verify.assertTrue
import org.junit.Test
Expand Down Expand Up @@ -106,4 +107,13 @@ internal class ConventionTest {
}
}
}

@Test
fun `Impl classes should be internal`() {
Konsist
.scopeFromProject()
.classes()
.withNameEndingWith("Impl")
.assertTrue { it.hasInternalModifier }
}
}

0 comments on commit a93beff

Please sign in to comment.