Skip to content

Kotlin with AnonymousClassPatchPlugin #637

@skevy

Description

@skevy

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions