Skip to content

Commit 5ad09c9

Browse files
authored
Fix JPMS access errors (#585)
1 parent 24b3f1b commit 5ad09c9

File tree

10 files changed

+26
-48
lines changed

10 files changed

+26
-48
lines changed

library/runtime-ctrl/api/runtime-ctrl.api

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,10 @@ public final class io/matthewnelson/kmp/tor/runtime/ctrl/TempTorCmdQueue : io/ma
5757

5858
public final class io/matthewnelson/kmp/tor/runtime/ctrl/TorCmdInterceptor {
5959
public static final field Companion Lio/matthewnelson/kmp/tor/runtime/ctrl/TorCmdInterceptor$Companion;
60-
public synthetic fun <init> (Lkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
60+
public fun <init> (Lkotlin/jvm/functions/Function2;)V
6161
}
6262

6363
public final class io/matthewnelson/kmp/tor/runtime/ctrl/TorCmdInterceptor$Companion {
64-
public final synthetic fun of (Lkotlin/jvm/functions/Function1;)Lio/matthewnelson/kmp/tor/runtime/ctrl/TorCmdInterceptor;
6564
}
6665

6766
public abstract interface class io/matthewnelson/kmp/tor/runtime/ctrl/TorCtrl : io/matthewnelson/kmp/tor/runtime/core/Destroyable, io/matthewnelson/kmp/tor/runtime/core/TorEvent$Processor, io/matthewnelson/kmp/tor/runtime/core/ctrl/TorCmd$Privileged$Processor {
@@ -101,12 +100,3 @@ public final class io/matthewnelson/kmp/tor/runtime/ctrl/TorCtrl$Factory {
101100
public final fun connectAsync (Ljava/io/File;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
102101
}
103102

104-
public final class io/matthewnelson/kmp/tor/runtime/ctrl/internal/TorCmdJob : io/matthewnelson/kmp/tor/runtime/core/EnqueuedJob {
105-
public synthetic fun <init> (Lio/matthewnelson/kmp/tor/runtime/core/ctrl/TorCmd;Lio/matthewnelson/kmp/tor/runtime/core/OnSuccess;Lio/matthewnelson/kmp/tor/runtime/core/OnFailure;Lio/matthewnelson/kmp/tor/runtime/core/UncaughtException$Handler;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
106-
public final fun getCmd ()Lio/matthewnelson/kmp/tor/runtime/core/ctrl/TorCmd;
107-
}
108-
109-
public final class io/matthewnelson/kmp/tor/runtime/ctrl/internal/_DebuggerKt {
110-
public static final fun commonAsDebugger (Lio/matthewnelson/kmp/tor/runtime/core/ItBlock;Lkotlin/jvm/functions/Function0;)Lio/matthewnelson/kmp/tor/runtime/ctrl/TorCtrl$Debugger;
111-
}
112-

library/runtime-ctrl/api/runtime-ctrl.klib.api

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,13 @@ abstract class io.matthewnelson.kmp.tor.runtime.ctrl/AbstractTorEventProcessor :
8989
}
9090

9191
final class <#A: io.matthewnelson.kmp.tor.runtime.core.ctrl/TorCmd<*>> io.matthewnelson.kmp.tor.runtime.ctrl/TorCmdInterceptor { // io.matthewnelson.kmp.tor.runtime.ctrl/TorCmdInterceptor|null[0]
92+
constructor <init>(kotlin/Function2<io.matthewnelson.kmp.tor.runtime.core/EnqueuedJob, io.matthewnelson.kmp.tor.runtime.core.ctrl/TorCmd<*>, io.matthewnelson.kmp.tor.runtime.core.ctrl/TorCmd<*>?>) // io.matthewnelson.kmp.tor.runtime.ctrl/TorCmdInterceptor.<init>|<init>(kotlin.Function2<io.matthewnelson.kmp.tor.runtime.core.EnqueuedJob,io.matthewnelson.kmp.tor.runtime.core.ctrl.TorCmd<*>,io.matthewnelson.kmp.tor.runtime.core.ctrl.TorCmd<*>?>){}[0]
93+
9294
final object Companion { // io.matthewnelson.kmp.tor.runtime.ctrl/TorCmdInterceptor.Companion|null[0]
93-
final fun <#A2: io.matthewnelson.kmp.tor.runtime.core.ctrl/TorCmd<*>> of(kotlin/Function1<io.matthewnelson.kmp.tor.runtime.ctrl.internal/TorCmdJob<*>, #A2?>): io.matthewnelson.kmp.tor.runtime.ctrl/TorCmdInterceptor<#A2> // io.matthewnelson.kmp.tor.runtime.ctrl/TorCmdInterceptor.Companion.of|of(kotlin.Function1<io.matthewnelson.kmp.tor.runtime.ctrl.internal.TorCmdJob<*>,0:0?>){0§<io.matthewnelson.kmp.tor.runtime.core.ctrl.TorCmd<*>>}[0]
9495
final inline fun <#A2: reified io.matthewnelson.kmp.tor.runtime.core.ctrl/TorCmd<*>> intercept(crossinline kotlin/Function2<io.matthewnelson.kmp.tor.runtime.core/EnqueuedJob, #A2, #A2>): io.matthewnelson.kmp.tor.runtime.ctrl/TorCmdInterceptor<#A2> // io.matthewnelson.kmp.tor.runtime.ctrl/TorCmdInterceptor.Companion.intercept|intercept(kotlin.Function2<io.matthewnelson.kmp.tor.runtime.core.EnqueuedJob,0:0,0:0>){0§<io.matthewnelson.kmp.tor.runtime.core.ctrl.TorCmd<*>>}[0]
9596
}
9697
}
9798

98-
final class <#A: kotlin/Any> io.matthewnelson.kmp.tor.runtime.ctrl.internal/TorCmdJob : io.matthewnelson.kmp.tor.runtime.core/EnqueuedJob { // io.matthewnelson.kmp.tor.runtime.ctrl.internal/TorCmdJob|null[0]
99-
final val cmd // io.matthewnelson.kmp.tor.runtime.ctrl.internal/TorCmdJob.cmd|{}cmd[0]
100-
final fun <get-cmd>(): io.matthewnelson.kmp.tor.runtime.core.ctrl/TorCmd<#A> // io.matthewnelson.kmp.tor.runtime.ctrl.internal/TorCmdJob.cmd.<get-cmd>|<get-cmd>(){}[0]
101-
}
102-
10399
final class io.matthewnelson.kmp.tor.runtime.ctrl/TempTorCmdQueue : io.matthewnelson.kmp.tor.runtime.core.ctrl/TorCmd.Unprivileged.Processor, io.matthewnelson.kmp.tor.runtime.core/Destroyable { // io.matthewnelson.kmp.tor.runtime.ctrl/TempTorCmdQueue|null[0]
104100
final val connection // io.matthewnelson.kmp.tor.runtime.ctrl/TempTorCmdQueue.connection|{}connection[0]
105101
final fun <get-connection>(): io.matthewnelson.kmp.tor.runtime.ctrl/TorCtrl? // io.matthewnelson.kmp.tor.runtime.ctrl/TempTorCmdQueue.connection.<get-connection>|<get-connection>(){}[0]
@@ -109,5 +105,3 @@ final class io.matthewnelson.kmp.tor.runtime.ctrl/TempTorCmdQueue : io.matthewne
109105
final fun destroy() // io.matthewnelson.kmp.tor.runtime.ctrl/TempTorCmdQueue.destroy|destroy(){}[0]
110106
final fun isDestroyed(): kotlin/Boolean // io.matthewnelson.kmp.tor.runtime.ctrl/TempTorCmdQueue.isDestroyed|isDestroyed(){}[0]
111107
}
112-
113-
final inline fun (io.matthewnelson.kmp.tor.runtime.core/ItBlock<kotlin/String>).io.matthewnelson.kmp.tor.runtime.ctrl.internal/commonAsDebugger(crossinline kotlin/Function0<kotlin/Boolean>): io.matthewnelson.kmp.tor.runtime.ctrl/TorCtrl.Debugger // io.matthewnelson.kmp.tor.runtime.ctrl.internal/commonAsDebugger|commonAsDebugger@io.matthewnelson.kmp.tor.runtime.core.ItBlock<kotlin.String>(kotlin.Function0<kotlin.Boolean>){}[0]

library/runtime-ctrl/src/commonMain/kotlin/io/matthewnelson/kmp/tor/runtime/ctrl/TorCmdInterceptor.kt

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
**/
16+
@file:Suppress("unused")
17+
1618
package io.matthewnelson.kmp.tor.runtime.ctrl
1719

1820
import io.matthewnelson.kmp.tor.runtime.core.EnqueuedJob
@@ -52,15 +54,15 @@ import kotlin.jvm.JvmSynthetic
5254
*
5355
* @see [intercept]
5456
* */
55-
public class TorCmdInterceptor<C: TorCmd<*>> private constructor(
56-
private val _intercept: (job: TorCmdJob<*>) -> C?,
57+
public class TorCmdInterceptor<C: TorCmd<*>> @PublishedApi internal constructor(
58+
private val _intercept: (job: EnqueuedJob, cmd: TorCmd<*>) -> TorCmd<*>?,
5759
) {
5860

5961
@JvmSynthetic
6062
internal fun invoke(job: TorCmdJob<*>): TorCmd<*>? {
6163
if (job.state != EnqueuedJob.State.Executing) return null
6264

63-
val result = _intercept(job) ?: return null
65+
val result = _intercept(job, job.cmd) ?: return null
6466

6567
if (job.cmd is TorCmd.Onion.Add) return null
6668
if (job.cmd is TorCmd.Onion.Delete) return null
@@ -81,16 +83,9 @@ public class TorCmdInterceptor<C: TorCmd<*>> private constructor(
8183
* */
8284
@JvmStatic
8385
public inline fun <reified C: TorCmd<*>> intercept(
84-
crossinline intercept: (job: EnqueuedJob, cmd: C) -> C
85-
): TorCmdInterceptor<C> = of { job ->
86-
if (job.cmd !is C) return@of null
87-
intercept(job, job.cmd)
86+
crossinline intercept: (job: EnqueuedJob, cmd: C) -> C,
87+
): TorCmdInterceptor<C> = TorCmdInterceptor { job, cmd ->
88+
if (cmd !is C) null else intercept(job, cmd)
8889
}
89-
90-
@JvmSynthetic
91-
@PublishedApi
92-
internal fun <C: TorCmd<*>> of(
93-
intercept: (job: TorCmdJob<*>) -> C?,
94-
): TorCmdInterceptor<C> = TorCmdInterceptor(intercept)
9590
}
9691
}

library/runtime-ctrl/src/commonMain/kotlin/io/matthewnelson/kmp/tor/runtime/ctrl/internal/-Debugger.kt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,9 @@
1717

1818
package io.matthewnelson.kmp.tor.runtime.ctrl.internal
1919

20-
import io.matthewnelson.kmp.tor.runtime.core.ItBlock
2120
import io.matthewnelson.kmp.tor.runtime.core.UncaughtException
2221
import io.matthewnelson.kmp.tor.runtime.ctrl.TorCtrl.Debugger
2322

24-
@PublishedApi
25-
internal inline fun ItBlock<String>.commonAsDebugger(
26-
crossinline isEnabled: () -> Boolean,
27-
): Debugger = object : Debugger() {
28-
override fun isEnabled(): Boolean = isEnabled.invoke()
29-
override fun invoke(log: String) { this@commonAsDebugger(log) }
30-
}
31-
3223
internal inline fun Debugger?.d(lazyText: () -> String) {
3324
if (this?.isEnabled() != true) return
3425
invoke(lazyText())

library/runtime-ctrl/src/commonMain/kotlin/io/matthewnelson/kmp/tor/runtime/ctrl/internal/TorCmdJob.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ import kotlin.concurrent.Volatile
2121
import kotlin.coroutines.cancellation.CancellationException
2222
import kotlin.jvm.JvmSynthetic
2323

24-
@PublishedApi
2524
internal class TorCmdJob<Success: Any> private constructor(
26-
@PublishedApi
2725
internal val cmd: TorCmd<Success>,
2826
onSuccess: OnSuccess<Success>,
2927
onFailure: OnFailure,

library/runtime-ctrl/src/jsMain/kotlin/io/matthewnelson/kmp/tor/runtime/ctrl/TorCtrl.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import io.matthewnelson.kmp.tor.runtime.core.*
2626
import io.matthewnelson.kmp.tor.runtime.core.net.IPAddress
2727
import io.matthewnelson.kmp.tor.runtime.core.net.IPSocketAddress
2828
import io.matthewnelson.kmp.tor.runtime.core.ctrl.TorCmd
29+
import io.matthewnelson.kmp.tor.runtime.ctrl.TorCtrl.Debugger.Companion.asDebugger
2930
import io.matthewnelson.kmp.tor.runtime.ctrl.internal.*
3031
import kotlinx.coroutines.*
3132
import org.khronos.webgl.Uint8Array
@@ -90,7 +91,10 @@ public actual interface TorCtrl : Destroyable, TorEvent.Processor, TorCmd.Privil
9091

9192
public actual inline fun ItBlock<String>.asDebugger(
9293
crossinline isEnabled: () -> Boolean,
93-
): Debugger = commonAsDebugger(isEnabled)
94+
): Debugger = object : Debugger() {
95+
override fun isEnabled(): Boolean = isEnabled.invoke()
96+
override fun invoke(log: String) = this@asDebugger(log)
97+
}
9498
}
9599
}
96100

@@ -167,7 +171,7 @@ public actual interface TorCtrl : Destroyable, TorEvent.Processor, TorCmd.Privil
167171
observers,
168172
interceptors,
169173
defaultExecutor,
170-
debugger?.commonAsDebugger { true },
174+
debugger?.asDebugger { true },
171175
handler,
172176
)
173177

library/runtime-ctrl/src/jvmMain/java9/module-info.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module io.matthewnelson.kmp.tor.runtime.ctrl {
22
requires io.matthewnelson.immutable.collections;
33
requires transitive io.matthewnelson.kmp.file;
4+
requires io.matthewnelson.kmp.process;
45
requires io.matthewnelson.kmp.tor.common.core;
56
requires transitive io.matthewnelson.kmp.tor.runtime.core;
67
requires kotlinx.coroutines.core;

library/runtime-ctrl/src/nonJsMain/kotlin/io/matthewnelson/kmp/tor/runtime/ctrl/TorCtrl.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import io.matthewnelson.kmp.tor.common.api.InternalKmpTorApi
2727
import io.matthewnelson.kmp.tor.runtime.core.*
2828
import io.matthewnelson.kmp.tor.runtime.core.net.IPSocketAddress
2929
import io.matthewnelson.kmp.tor.runtime.core.ctrl.TorCmd
30+
import io.matthewnelson.kmp.tor.runtime.ctrl.TorCtrl.Debugger.Companion.asDebugger
3031
import io.matthewnelson.kmp.tor.runtime.ctrl.internal.*
3132
import kotlinx.coroutines.*
3233
import kotlin.contracts.ExperimentalContracts
@@ -98,7 +99,10 @@ public actual interface TorCtrl : Destroyable, TorEvent.Processor, TorCmd.Privil
9899
@JvmName("from")
99100
public actual inline fun ItBlock<String>.asDebugger(
100101
crossinline isEnabled: () -> Boolean,
101-
): Debugger = commonAsDebugger(isEnabled)
102+
): Debugger = object : Debugger() {
103+
override fun isEnabled(): Boolean = isEnabled.invoke()
104+
override fun invoke(log: String) = this@asDebugger(log)
105+
}
102106
}
103107
}
104108

@@ -217,7 +221,7 @@ public actual interface TorCtrl : Destroyable, TorEvent.Processor, TorCmd.Privil
217221
observers,
218222
interceptors,
219223
defaultExecutor,
220-
debugger?.commonAsDebugger { true },
224+
debugger?.asDebugger { true },
221225
handler,
222226
)
223227

library/runtime/src/commonTest/kotlin/io/matthewnelson/kmp/tor/runtime/ActionJobUnitTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import kotlin.test.*
2727
class ActionJobUnitTest {
2828

2929
private val handler = UncaughtException.Handler.THROW
30-
private val tempQueue = TorCtrl.Factory(debugger = null, handler = handler).tempQueue()
30+
private val tempQueue = TorCtrl.Factory(debug = null, handler = handler).tempQueue()
3131

3232
@Test
3333
fun givenStart_whenImmediate_thenIsExecuting() {

library/runtime/src/jvmMain/java9/module-info.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
requires io.matthewnelson.encoding.core;
44
requires io.matthewnelson.immutable.collections;
55
requires io.matthewnelson.kmp.process;
6+
requires io.matthewnelson.kmp.tor.common.core;
67
requires io.matthewnelson.kmp.tor.runtime.ctrl;
78
requires transitive io.matthewnelson.kmp.tor.runtime.core;
89
requires kotlinx.coroutines.core;

0 commit comments

Comments
 (0)