Skip to content
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

Kotlin with AnonymousClassPatchPlugin #637

Open
skevy opened this issue Feb 5, 2025 · 1 comment
Open

Kotlin with AnonymousClassPatchPlugin #637

skevy opened this issue Feb 5, 2025 · 1 comment
Labels

Comments

@skevy
Copy link

skevy commented Feb 5, 2025

Hi there.

Latest JBR 21 build + latest HotSwapAgent build. When changing a class that contains anonymous classes created by the Kotlin compiler, I get an error like:

HOTSWAP AGENT: 23:01:58.968 ERROR (org.hotswap.agent.annotation.handler.PluginClassFileTransformer) - InvocationTargetException in transform method on plugin 'class org.hotswap.agent.plugin.jvm.AnonymousClassPatchPlugin' class 'viaduct/engine/runtime/execution/FieldResolver$fetchObjectSerially$1' of classLoader 'jdk.internal.loader.ClassLoaders$AppClassLoader'
java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:118)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.hotswap.agent.annotation.handler.PluginClassFileTransformer.transform(PluginClassFileTransformer.java:220)
	at org.hotswap.agent.annotation.handler.PluginClassFileTransformer.transform(PluginClassFileTransformer.java:112)
	at org.hotswap.agent.util.HotswapTransformer.transform(HotswapTransformer.java:264)
	at java.instrument/java.lang.instrument.ClassFileTransformer.transform(ClassFileTransformer.java:244)
	at java.instrument/sun.instrument.TransformerManager.transform(TransformerManager.java:188)
	at java.instrument/sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:610)
Caused by: java.lang.IllegalArgumentException: Class viaduct.engine.runtime.execution.FieldResolver$fetchObjectSerially not found.
	at org.hotswap.agent.plugin.jvm.AnonymousClassInfos.<init>(AnonymousClassInfos.java:117)
	at org.hotswap.agent.plugin.jvm.AnonymousClassPatchPlugin.getStateInfo(AnonymousClassPatchPlugin.java:244)
	at org.hotswap.agent.plugin.jvm.AnonymousClassPatchPlugin.patchAnonymousClass(AnonymousClassPatchPlugin.java:104)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	... 7 more

This is a little different from #420 AFAICT.

I'm going to disable the AnonymousClassPatchPlugin in order to workaround this for now, but I wanted to make sure I filed an issue to see if anyone has taken a look at this issue. Note, this is also with the latest version of IntelliJ so it's using a 2.x version of the Kotlin compiler.

@skevy
Copy link
Author

skevy commented Feb 5, 2025

One guess I have actually -- I wonder if the plugin doesn't support nested anonymous classes...which seems to be what this is (it's a suspend function).

@skybber skybber added the bug label Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants