Skip to content

Dev loop on a JetBrains Runtime: a call through executeJs(Class) fails after a method of the interface changes #27451

Description

@mcollovati

Description

The dev loop runs the application on a JetBrains Runtime (JBR) when one is
found, so that a structural change can be redefined without a restart. When
such a change adds or changes a method of an interface that
Element.executeJs(Class) returns a proxy for, the redefine succeeds, but the
next call of the new method fails with AbstractMethodError. A plain apply
after that does not restart, so the error stays until a manual restart.

HotswapAgent's ProxyPlugin should regenerate the JDK proxy class, but it
fails because java.base does not open jdk.internal.loader to it. The dev
loop adds --add-opens java.base/jdk.internal.loader=ALL-UNNAMED only for
the embedded Maven goal runtime (MavenGoalRuntime.extraJvmFlags), not when
it launches the main class (Launch.ADD_OPENS, which has java.lang,
java.lang.reflect, java.io, java.util and java.beans).

The same probably happens for every JDK dynamic proxy of a changed interface,
not only for executeJs(Class). I tested only executeJs(Class).

Steps to reproduce

Branch repro/js-definition-hierarchy-hotswap of
https://github.com/mcollovati/skeleton-starter-flow-spring (Flow main
bf9a1a9 installed locally, JBR 21.0.11).

  1. mvn vaadin:install-dev-cli, then
    VAADIN_DEV_DAEMON_OPTS="-Dvaadin.frontend.hotdeploy=true -Dvaadin.dev.javaHome=<JBR 21>" .vaadin/vaadin-dev start.
    The daemon log shows enhancedRedefinition=true.
  2. Open http://localhost:8097/ and press "Run DirectJs.show": direct v1: clicked.
  3. In DirectJs, change the method to
    @JsExpression("this.textContent = 'direct v2: ' + $0 + $1")
    void show(String value, String extra);
    and the call in MainView to .show("clicked", " twice").
  4. Run .vaadin/vaadin-dev apply --no-restart, reload the page and press the
    button again.

Expected behavior

direct v2: clicked twice

Actual behavior

Nothing changes in the browser. target/devloop/app.log has:

HOTSWAP AGENT: ERROR (org.hotswap.agent.annotation.handler.PluginClassFileTransformer) - InvocationTargetException in transform method on plugin 'class org.hotswap.agent.plugin.proxy.ProxyPlugin' class 'jdk/proxy2/$Proxy117' ...
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make public void jdk.internal.loader.AbstractClassLoaderValue.removeAll(java.lang.ClassLoader) accessible: module java.base does not "exports jdk.internal.loader" to unnamed module ...

ERROR c.v.flow.server.DefaultErrorHandler : Unexpected error: Receiver class jdk.proxy2.$Proxy117 does not define or inherit an implementation of the resolved method 'abstract void show(java.lang.String, java.lang.String)' of interface org.vaadin.example.DirectJs.
java.lang.AbstractMethodError: ...

A following .vaadin/vaadin-dev apply reports redefineClasses(2) with one
error in the app log, and the button still fails.

With .vaadin/vaadin-dev start --jvm-args "--add-opens java.base/jdk.internal.loader=ALL-UNNAMED",
the same steps give direct v2: clicked twice without a restart, and the log
has no error. --add-exports is not needed.

On a JDK that is not a JBR, the redefine is rejected ("attempted to delete a
method") and the dev loop restarts, so the problem does not show there.

Proposed fix

Add java.base/jdk.internal.loader to Launch.ADD_OPENS. The comment in
MavenGoalRuntime.extraJvmFlags already explains that HotswapAgent needs
this package.

Versions

Activity

  1. totally-not-ai commented on Nov 26, 2026

    @totally-not-ai
    Contributor

    Triage: confirmed bug. On a JetBrains Runtime, after a method of an interface with a JDK proxy (such as one from executeJs(Class)) changes, calling it fails with AbstractMethodError until a manual restart.

    • Affects: dev loop on a JBR (enhanced redefinition), launched as a main class or a forked server; not the embedded Maven goal runtime, which already opens the package. A plain JDK restarts instead, so it doesn't show there.
    • Affected branches: main, 25.4 and 25.3 (the dev loop isn't on earlier branches).
    • Severity: moderate — the change looks applied, but the call fails at runtime; the only trace is in the app log.
    • Impact: anyone on a JBR who changes such an interface; likely every JDK dynamic proxy, not only executeJs(Class).
    • Workaround: vaadin-dev start --jvm-args "--add-opens java.base/jdk.internal.loader=ALL-UNNAMED", at no cost.
    • Root cause: the app JVM does not open jdk.internal.loader, so HotswapAgent's ProxyPlugin cannot regenerate the proxy class.
    • Next step: draft PR fix(devloop): open the packages HotswapAgent needs in the app JVM #27452 adds the open, as proposed in the issue.
    Root cause
    • The flags for the app JVM come from Launch.ADD_OPENS, which lacks java.base/jdk.internal.loader.
    • Only the embedded goal runtime adds it, in MavenGoalRuntime.extraJvmFlags, for a different HotswapAgent feature.
    • ProxyPlugin calls AbstractClassLoaderValue.removeAll to drop the cached proxy class, which fails with InaccessibleObjectException, so the old proxy class stays.
    • Forked servers deliberately don't get java.net opened (it lets HotswapAgent swap URLClassLoader.ucp and broke WildFly). jdk.internal.loader alone doesn't allow that swap, so adding it for every app JVM should be safe. This hasn't been tested on WildFly.
  2. added theissue type on Nov 27, 2026
  3. added a commit that references this issue on Nov 30, 2026
    aa40a23
  4. added a commit that references this issue on Dec 1, 2026
    f998ff9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions