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

[Feature Request]: Java Hot Code Replacement support #252

Closed
Frederick888 opened this issue Sep 5, 2020 · 8 comments · Fixed by #372
Closed

[Feature Request]: Java Hot Code Replacement support #252

Frederick888 opened this issue Sep 5, 2020 · 8 comments · Fixed by #372
Labels
enhancement New feature or request

Comments

@Frederick888
Copy link

Is your feature request related to a problem? Please describe.
I'm using Vimspector with coc.nvim, coc-java and coc-java-debug.

Right now if I change my code during debug, the code gets compiled automatically and then I can see Unhandled event: hotcodereplace. It'd be nice if Vimspector can handle this event and send the new class files to JVM.

Describe the solution you'd like
HCR support, so that hot replacement happens wherever possible during debug.

Describe alternatives you've considered
DCEVM + Auto HotSwap. But this is usually very resource intensive as the JVM needs to watch all the class files. I'm looking at ~5x CPU usage with auto HotSwap. If I configure some extraClassPaths the CPU usage can further sky rockets to 20x.

@puremourning
Copy link
Owner

dansomething/coc-java-debug#9 (comment)

Sorry it's not feasible for me to support custom DAP protocol additions. I'm just one person in my spare time. This custom exetnsion to the protocol is not documented at all (I looked at the code to find that it even exists).

If DAP is updated to support 'hot code replace' in a fully documented and supported way then I would consider it, but while it remains a complexly custom server-specific event, that's a rabbit hole I don't have the capacity to enter.

I'm loath to open up any kind of API for custom even handling in Vimsepctor because custom events are a scourge on a standard protocol and just create work for client authors rather than enhancing the protocol centrally and sensibly.

@Frederick888
Copy link
Author

Cool, that's totally understandable. Thanks for your time and effort in developing and maintaining this project and hope some JVM developer can document this functionality better.

@puremourning
Copy link
Owner

Thanks for understanding.

@puremourning
Copy link
Owner

If anyone just wants this to "work" by magic, add this to python3/vimspector/debug_session.py after the OnEvent_stopped definition:

  def OnEvent_hotcodereplace( self, message ):
    # Hack for java debug server hot-code-replace
    self._connection.DoRequest( None, {
      'command': 'redefineClasses',
      'arguments': {},
    } )
 

@Frederick888
Copy link
Author

@puremourning Wow, terrific! Thank you! May I know if this is gonna be merged down the line?

@puremourning
Copy link
Owner

Possibly. No promises.

@puremourning
Copy link
Owner

@puremourning
Copy link
Owner

@puremourning puremourning added the enhancement New feature or request label Feb 25, 2021
@mergify mergify bot closed this as completed in #372 Mar 19, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants