-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support the Java Module System #2237
Comments
I use kotlinx coroutines with jpms in my project. But I got error "cannot find module: kotlinx.coroutines.core.jvm". Does kotlinx coroutines not support jpms even using automatic module ? |
As a stop gap, for now add |
This stopgap doesn't work for me. First there is no "kotlinx.coroutines" I can add to module-info. I can get IntelliJ to accept kotlinx.coroutines.core.jvm … But trying to add any with addExtraDependencies doesn't help, it still says:
or
|
Hi, have there been any further developments regarding this issue? |
anyone know how to fix this? StacktraceException in thread "JavaFX Application Thread" java.lang.IllegalAccessError: class kotlin.coroutines.jvm.internal.DebugProbesKt (in module kotlin.stdlib) cannot access class kotlinx.coroutines.debug.internal.DebugProbesImpl (in module kotlinx.coroutines.core.jvm) because module kotlin.stdlib does not read module kotlinx.coroutines.core.jvm at kotlin.stdlib/kotlin.coroutines.jvm.internal.DebugProbesKt.probeCoroutineCreated(DebugProbes.kt:10) at kotlin.stdlib/kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt.createCoroutineUnintercepted(IntrinsicsJvm.kt:122) at kotlinx.coroutines.core.jvm@1.5.0-RC/kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable(Cancellable.kt:30) at kotlinx.coroutines.core.jvm@1.5.0-RC/kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable$default(Cancellable.kt:25) at kotlinx.coroutines.core.jvm@1.5.0-RC/kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:110) at kotlinx.coroutines.core.jvm@1.5.0-RC/kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:126) at kotlinx.coroutines.core.jvm@1.5.0-RC/kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:56) at kotlinx.coroutines.core.jvm@1.5.0-RC/kotlinx.coroutines.BuildersKt.launch(Unknown Source) at kotlinx.coroutines.core.jvm@1.5.0-RC/kotlinx.coroutines.BuildersKt__Builders_commonKt.launch$default(Builders.common.kt:47) at kotlinx.coroutines.core.jvm@1.5.0-RC/kotlinx.coroutines.BuildersKt.launch$default(Unknown Source) at com.abysl.harryplotter@1.0/com.abysl.harryplotter.data.JobProcess.reset(JobProcess.kt:41) at com.abysl.harryplotter@1.0/com.abysl.harryplotter.controller.MainController.onStop(MainController.kt:174) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:567) at com.sun.javafx.reflect.Trampoline.invoke(MethodUtil.java:76) at jdk.internal.reflect.GeneratedMethodAccessor2.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:567) at javafx.base/com.sun.javafx.reflect.MethodUtil.invoke(MethodUtil.java:273) at javafx.fxml/com.sun.javafx.fxml.MethodHelper.invoke(MethodHelper.java:83) at javafx.fxml/javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1859) at javafx.fxml/javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1729) at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86) at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:234) at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191) at javafx.base/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59) at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58) at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at javafx.base/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74) at javafx.base/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49) at javafx.base/javafx.event.Event.fireEvent(Event.java:198) at javafx.graphics/javafx.scene.Node.fireEvent(Node.java:8889) at javafx.controls/javafx.scene.control.Button.fire(Button.java:203) at javafx.controls/com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:208) at javafx.controls/com.sun.javafx.scene.control.inputmap.InputMap.handle(InputMap.java:274) at javafx.base/com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:247) at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80) at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:234) at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191) at javafx.base/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59) at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58) at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at javafx.base/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74) at javafx.base/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54) at javafx.base/javafx.event.Event.fireEvent(Event.java:198) at javafx.graphics/javafx.scene.Scene$MouseHandler.process(Scene.java:3856) at javafx.graphics/javafx.scene.Scene.processMouseEvent(Scene.java:1851) at javafx.graphics/javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2584) at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:409) at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:299) at java.base/java.security.AccessController.doPrivileged(AccessController.java:391) at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:447) at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:412) at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:446) at javafx.graphics/com.sun.glass.ui.View.handleMouseEvent(View.java:556) at javafx.graphics/com.sun.glass.ui.View.notifyMouse(View.java:942) at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method) at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174) at java.base/java.lang.Thread.run(Thread.java:831)module-info.javamodule com.abysl.harryplotter { build.gradle.ktsimport org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { group = "com.abysl" repositories { dependencies { application { javafx { tasks.withType { val currentOs = org.gradle.internal.os.OperatingSystem.current() jlink {
} It happens whenever I launch a coroutine, the program compiles and runs fine, but then throws and exception when the coroutine is called. |
It happens because you are using JDK 16. Previously, an illegal access was only logged once and your program would continue to run. Since JDK 16 the new default behavior is to throw an exception. See https://openjdk.java.net/jeps/396 for more details. You can use this JVM argument as a workaround: Note that there are a lot of libraries that make use of this now considered illegal (reflective) access. Eventually they should all be fixed / refactored, but I have no idea how realistic that would be. |
@lion7 thanks so much i've been banging my head against the wall trying to figure out what this meant. |
@lion7 weird so I enabled --illegal-access=permit through out all my gradle settings & configuration stuff where there was an xmx. running through gradle, its fine, there's no exceptions. its only when I run through intellij idea's gradle task does it throw an exception, even though in that run configuration i have it set. |
The VM options in your run configuration are passed to the Gradle JVM and not your application. You would probably have to configure it somewhere in your jpackage config, so that the packaged application will run with that parameter. Note that the |
Yeah I did do that, but the fact that its happening only in intellij says something weird is going on. I even set idea's own jvm parameters to have it. it even starts up the gradle task with downgrading to kotlin 1.4.3 dependencies didn't work either build.gradle.ktsimport org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { group = "com.abysl" repositories { dependencies { val jvmOptions = listOf("-Xms256m", "-Xmx2048m", "--illegal-access=permit") application { javafx { tasks.withType { val currentOs = org.gradle.internal.os.OperatingSystem.current() jlink {
} gradle.propertieskotlin.code.style=official |
@abueide Have u solved the problem? I have the same error . Exception in thread "JavaFX Application Thread" java.lang.IllegalAccessError: class kotlin.coroutines.jvm.internal.DebugProbesKt (in module kotlin.stdlib) cannot access class kotlinx.coroutines.debug.internal.DebugProbesImpl (in module kotlinx.coroutines.core.jvm) because module kotlin.stdlib does not read module kotlinx.coroutines.core.jvm at |
@Lazyii no sadly i never figured it out. I ended up switching to badassruntime so I didn't have to deal with the modules system. |
The JVM parameter |
@p-schneider thx. config below: But when i click run, it still throws an exception. "module kotlin.stdlib does not read module kotlinx.coroutines.core.jvm ....." /(ㄒoㄒ)/~~ |
For some reason IntelliJ ignores the applicationDefaultJvmArgs setting in some cases when running via gradle. (See https://youtrack.jetbrains.com/issue/KTIJ-18424) |
@p-schneider yeah this is exactly what I experienced as well |
|
@lion7 did you make any headway with this? |
Not much, compilation fails because |
Any reason why #2901 has not been merged yet? |
Im also having this issue! Would love to see it fixed |
It has been…. 5? years since the release of JPMS, and it has been 6 months since a fix has been posted. Can SOMEONE please merge #2901? “Hacking” JPMS for a project that, with quite literally 2 mouse clicks, could support JPMS is just frustrating beyond belief. Maybe @qwwdfsad can help figure this out? |
FWIW, getting #2901 merged is certainly a step forwards, but @lion7 's blocked (stalled?) change for full JPMS support is the big win. |
I opened PR #3297 with full support for JPMS. |
I've published |
I recently had the same issue while debugging using IntelliJ, used this fix disable the coroutine agent in settings |
I'm quoting directly from Kotlin/kotlinx.serialization#940 because the same reasoning applies:
Additionally,
jlink
andjpackage
) is extremely handy and I would love to usekotlinx.coroutines
without additional non-trivial build-system hacks.kotlinx.coroutines
is not possible because the latter does not have a stable module name.A temporary (and fairly simple) solution for
2.
would be providing stableAutomatic-Module-Name
entries.The text was updated successfully, but these errors were encountered: