Skip to content

Commit 12da789

Browse files
author
Oleksandr Dzhychko
committed
fix(light-model-client): Do not implement org.modelix.incremental interfaces in public classes
Implementing `IStateVariableGroup` but not exposing `org.modelix.incremental` as API dependency resulted in the following error when using the light-model-client library: Cannot access 'org.modelix.incremental.IStateVariableGroup' which is a super type of 'org.modelix.client.light.LightModelClient'. Check your module class path for missing or conflicting dependencies. Exposing `org.modelix.incremental` as an API dependency would have been a solution too, but we should not expose its API accidentally. When consumers want to use the light-model-client with its incremental functionality, they should add `org.modelix.incremental` as a dependency themselves.
1 parent cbbb215 commit 12da789

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

light-model-client/src/commonMain/kotlin/org/modelix/client/light/LightModelClient.kt

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class LightModelClient internal constructor(
6363
val autoFilterNonLoadedNodes: Boolean,
6464
val debugName: String = "",
6565
val modelQLClient: ModelQLClient? = null,
66-
) : IStateVariableGroup {
66+
) {
6767

6868
private val nodes = NodesMap<NodeData>(this)
6969
private val area = Area()
@@ -107,10 +107,6 @@ class LightModelClient internal constructor(
107107
}
108108
}
109109

110-
override fun getGroup(): IStateVariableGroup? {
111-
return null
112-
}
113-
114110
fun dispose() {
115111
connection.disconnect()
116112
}
@@ -904,11 +900,17 @@ fun INode.isLoaded() = isValid
904900
fun <T : INode> Iterable<T>.filterLoaded() = filter { it.isLoaded() }
905901
fun <T : INode> Sequence<T>.filterLoaded() = filter { it.isLoaded() }
906902

907-
data class NodeDataDependency(val client: LightModelClient, val id: NodeId) : IStateVariableReference<NodeData> {
903+
private data class ClientDependency(val client: LightModelClient) : IStateVariableGroup {
904+
override fun getGroup(): IStateVariableGroup? {
905+
return null
906+
}
907+
}
908+
909+
private data class NodeDataDependency(val client: LightModelClient, val id: NodeId) : IStateVariableReference<NodeData> {
908910
override fun getGroup(): IStateVariableGroup {
909911
return client.tryGetParentId(id)
910912
?.let { NodeDataDependency(client, it) }
911-
?: client
913+
?: ClientDependency(client)
912914
}
913915

914916
override fun read(): NodeData {

0 commit comments

Comments
 (0)