Skip to content

Implement JVM HotSwap via Java Agent#124

Draft
m-dzianishchyts wants to merge 1 commit into
dflib:mainfrom
m-dzianishchyts:119-fix-variable-not-updating-on-redeclaration
Draft

Implement JVM HotSwap via Java Agent#124
m-dzianishchyts wants to merge 1 commit into
dflib:mainfrom
m-dzianishchyts:119-fix-variable-not-updating-on-redeclaration

Conversation

@m-dzianishchyts

Copy link
Copy Markdown
Contributor

What does this PR do?

Implements JVM HotSwap via a Java Agent to enable in-place class redefinition while preserving static field values.
Fixes #119.

Details

The root issue is that URLClassLoader natively caches already-loaded classes, preventing the JVM from picking up updated bytecodes when a variable is redeclared. The solution leverages Instrumentation.redefineClasses() to perform in-place (HotSwap) class redefinition, mirroring how the jshell tool redefines classes through JDI.

Testing

Added a test to cover the detected regression.

@m-dzianishchyts m-dzianishchyts marked this pull request as ready for review June 24, 2026 16:00
@m-dzianishchyts m-dzianishchyts marked this pull request as draft June 26, 2026 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Adding an import in a later cell nullifies variables defined in earlier cells

1 participant