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

Hot Code Replace returns Cannot find any changed classes for hot replace! message #1481

Closed
peerpalo opened this issue May 25, 2024 · 13 comments · Fixed by microsoft/java-debug#555
Assignees

Comments

@peerpalo
Copy link

Similar to #1474, in this particular project configuration any attempt to use Hot Code Replace will produce a NullPointerException in Java Debugger. You can find a minimum sample project attached at the bottom.

[Error - 5:37:33 PM] May 25, 2024, 5:37:33 PM Problems occurred when invoking code from plug-in: "org.eclipse.jdt.ls.core".
Cannot invoke "java.lang.String.split(java.lang.String)" because "fullyQualifiedTypeName" is null
java.lang.NullPointerException: Cannot invoke "java.lang.String.split(java.lang.String)" because "fullyQualifiedTypeName" is null
	at com.microsoft.java.debug.plugin.internal.ResolveClasspathsHandler.getJavaProjectFromType(ResolveClasspathsHandler.java:117)
	at com.microsoft.java.debug.plugin.internal.Compile.compile(Compile.java:52)
	at com.microsoft.java.debug.plugin.internal.JavaDebugDelegateCommandHandler.executeCommand(JavaDebugDelegateCommandHandler.java:72)
	at org.eclipse.jdt.ls.core.internal.handlers.WorkspaceExecuteCommandHandler$1.run(WorkspaceExecuteCommandHandler.java:230)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
	at org.eclipse.jdt.ls.core.internal.handlers.WorkspaceExecuteCommandHandler.executeCommand(WorkspaceExecuteCommandHandler.java:220)
	at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$4(JDTLanguageServer.java:616)
	at org.eclipse.jdt.ls.core.internal.BaseJDTLanguageServer.lambda$0(BaseJDTLanguageServer.java:87)
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:646)
	at java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:483)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)

[Error - 5:37:33 PM] May 25, 2024, 5:37:33 PM Error in calling delegate command handler
Cannot invoke "java.lang.String.split(java.lang.String)" because "fullyQualifiedTypeName" is null
java.lang.NullPointerException: Cannot invoke "java.lang.String.split(java.lang.String)" because "fullyQualifiedTypeName" is null
	at com.microsoft.java.debug.plugin.internal.ResolveClasspathsHandler.getJavaProjectFromType(ResolveClasspathsHandler.java:117)
	at com.microsoft.java.debug.plugin.internal.Compile.compile(Compile.java:52)
	at com.microsoft.java.debug.plugin.internal.JavaDebugDelegateCommandHandler.executeCommand(JavaDebugDelegateCommandHandler.java:72)
	at org.eclipse.jdt.ls.core.internal.handlers.WorkspaceExecuteCommandHandler$1.run(WorkspaceExecuteCommandHandler.java:230)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
	at org.eclipse.jdt.ls.core.internal.handlers.WorkspaceExecuteCommandHandler.executeCommand(WorkspaceExecuteCommandHandler.java:220)
	at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$4(JDTLanguageServer.java:616)
	at org.eclipse.jdt.ls.core.internal.BaseJDTLanguageServer.lambda$0(BaseJDTLanguageServer.java:87)
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:646)
	at java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:483)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)

[Error - 5:37:33 PM] Request workspace/executeCommand failed.
  Message: Cannot invoke "java.lang.String.split(java.lang.String)" because "fullyQualifiedTypeName" is null
  Code: -32001 
[object Object]
Environment
  • Operating System: Windows 11 23H2 (OS Build 22631.3593)
  • JDK version: openjdk 17.0.6 2023-01-17, IBM Semeru Runtime Open Edition 17.0.6.0 (build 17.0.6+10)
  • Visual Studio Code version: 1.89.1
  • Java extension version: v1.30.0
  • Java Debugger extension version: v0.57.0
Steps To Reproduce
  1. Start a Maven Spring Boot project with multiple dependencies
  2. Attach debugger
  3. Change code, save and press "Hot Code Replace"
Additional Informations

https://github.com/peerpalo/hotcode-exception

@Alexand3r
Copy link

@peerpalo I got it to work, I've downgraded the "Debugger for Java" extension to v0.50.0 and it started to work, slowly, but it restarts now and detects changes (my project is huge so I expected the slow restart)

I haven't tried higher/newer versions of the extension

@peerpalo
Copy link
Author

peerpalo commented May 29, 2024

Thanks @Alexand3r, did some trial and errors and latest working version is v0.53.0, so v0.54.0 broke something on this specific configuration. Maybe it's this?

slowly, but it restarts now and detects changes

In my case it's really impossible to use it, very slow, could take more than 5 minutes

@testforstephen
Copy link
Contributor

this duplicates with microsoft/java-debug#554. It happens when the autobuild is disabled. We will provide a fix soon.

Currently a workaround is to enable autobuild via java.autobuild.enabled. With this, Hot code replace still works.

@Anonymous2416
Copy link

Anonymous2416 commented Jun 1, 2024

Currently a workaround is to enable autobuild via java.autobuild.enabled. With this, Hot code replace still works.

im working in vscode making forge Minecraft mods, for me it says "Cannot find any changed classes for hot replace " no matter what I do.

I've tried new projects, I've tried setting hot code replace to "auto".

@Anonymous2416
Copy link

@jdneo awesome. that's great. Am I able to get the fix now or I have to wait for it to be merged. Do I just do what you have under "How to test the change" section and it'll be fine or no?

@jdneo
Copy link
Member

jdneo commented Jun 5, 2024

@Anonymous2416 If you want to build it locally to try the change, you can follow the How to test the change section.

If you are not blocked by this issue, I would recommend to wait for it being merged and use the nightly build. I'll inform here once the nightly build is released.

@Anonymous2416
Copy link

@Anonymous2416 If you want to build it locally to try the change, you can follow the How to test the change section.

I tried that but still have the same issue Cannot find any changed classes for hot replace

@jdneo
Copy link
Member

jdneo commented Jun 5, 2024

@Anonymous2416 Can you give a sample project with a repro steps?

@Anonymous2416
Copy link

Anonymous2416 commented Jun 5, 2024

@jdneo https://github.com/Anonymous2416/GrenadeTest
need jdk 17

  • clone repo and open VSCode
  • wait for java/gradle stuff to build/run
  • run gradle task genVSCodeRuns
  • run gradle task runClient in debug
  • open ThrowableGrenadeRenderer.java and comment out lines 36
  • test out hot code replace

let me know if there's any issues running the project or anything at all. thanks

@jdneo
Copy link
Member

jdneo commented Jun 6, 2024

I don't know how to validate the effect after comment out the line 36. But the UI response shows that the HCR works.

See:

after.mp4

Please make sure that:

  1. Jar file in the vscode-gradle extension is replaced as described in Support HCR for gradle build server projects java-debug#555.
  2. The debugger is built according to the new PR.
  3. After you changed your file and before you trigger the HCR, makes sure you save the file.

@Anonymous2416
Copy link

@jdneo I replaced the jar file. what do you mean build the debugger according to the PR?
Im just replacing the jar file and launching vscode, I need to do anything else?

@Anonymous2416
Copy link

@jdneo I replaced the jar file. what do you mean build the debugger according to the PR? Im just replacing the jar file and launching vscode, I need to do anything else?

CleanShot 2024-06-06 at 08 43 54@2x

I also see this when I run runClient in debug mode

@Anonymous2416
Copy link

nvm I built it and was able to get it working. Thank you! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants