You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Does anyone use HotswapAgent + DCEVM with Compose? Any pointers on what to do to get it working?
So far, I've defined -XX:HotswapAgent=fatjar (for the Kotlin plugin to load) in compose.desktop.application.jvmArgs (in build.gradle.kts) and with DCEVM as the JDK, that works for starting the Hotswap agent. But when I recompile a class when running in debug mode in IntelliJ, the Compose window freezes and I get this exception: Exception in thread "AWT-EventQueue-0 @coroutine#7" java.lang.AbstractMethodError: Receiver class MainKt$App$1$2 does not define or inherit an implementation of the resolved method 'abstract java.lang.Object invoke(java.lang.Object, java.lang.Object, java.lang.Object)' of interface kotlin.jvm.functions.Function3.
My test code is as such:
@Composable
@Preview
fun App() {
var text by remember { mutableStateOf(updateText()) }
DesktopMaterialTheme {
Button(onClick = {
text = updateText()
}) {
Text(text)
}
}
}
fun updateText(): String {
return "test"
}
And the change that I tried to make was to change the string that updateText() returns, from "test" to "test1".
I think I need to run something else than IntelliJ's recompile for this to work. gradle build doesn't do anything visible and doesn't trigger HotswapAgent.
Do I need to run something in compose.desktop gradle extension?
Or do I need a plugin in HotswapAgent to do some trickery whilst the classes are being recompiled? I'd be interested in creating such a plugin, but alas, I have little experience or knowledge of any of these things.
P.S. Doing a recompile whilst debugging in IntelliJ, and HotswapAgent NOT running, a reload is triggered for the changed class and in the aforementioned example, the string value returned by updateText() is indeed changed upon the next click of the button. No exception thrown. For this kind of simple example, the default Hotspot reloading mechanism is enough, but it would indeed be quite nice to achieve more with HotswapAgent and DCEVM.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi!
Does anyone use HotswapAgent + DCEVM with Compose? Any pointers on what to do to get it working?
So far, I've defined
-XX:HotswapAgent=fatjar
(for the Kotlin plugin to load) incompose.desktop.application.jvmArgs
(inbuild.gradle.kts
) and with DCEVM as the JDK, that works for starting the Hotswap agent. But when I recompile a class when running in debug mode in IntelliJ, the Compose window freezes and I get this exception:Exception in thread "AWT-EventQueue-0 @coroutine#7" java.lang.AbstractMethodError: Receiver class MainKt$App$1$2 does not define or inherit an implementation of the resolved method 'abstract java.lang.Object invoke(java.lang.Object, java.lang.Object, java.lang.Object)' of interface kotlin.jvm.functions.Function3.
My test code is as such:
And the change that I tried to make was to change the string that
updateText()
returns, from"test"
to"test1"
.I think I need to run something else than IntelliJ's recompile for this to work.
gradle build
doesn't do anything visible and doesn't trigger HotswapAgent.Do I need to run something in
compose.desktop
gradle extension?Or do I need a plugin in HotswapAgent to do some trickery whilst the classes are being recompiled? I'd be interested in creating such a plugin, but alas, I have little experience or knowledge of any of these things.
P.S. Doing a recompile whilst debugging in IntelliJ, and HotswapAgent NOT running, a reload is triggered for the changed class and in the aforementioned example, the string value returned by
updateText()
is indeed changed upon the next click of the button. No exception thrown. For this kind of simple example, the default Hotspot reloading mechanism is enough, but it would indeed be quite nice to achieve more with HotswapAgent and DCEVM.Beta Was this translation helpful? Give feedback.
All reactions