Debug info not updated when code dynamically re-loaded
- Dominant language
- Java
- Stars
- 3.1k
- Forks
- 935
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 17
Description
### Apache NetBeans version
Apache NetBeans 15
### What happened
Rather than compiling code and then running it, my system compiles, dynamically loads, and then runs code all at runtime. The benefit of this is that code can be changed at runtime on a live system without having to compile or re-boot a production server. This is something I have been using for years in production environments. It works well. The actual source code for this is at [https://github.com/blakemcbride/Kiss](https://github.com/blakemcbride/Kiss)
Previously, I used IntelliJ. Debugging this code in a live environment and changing it dynamically worked as expected. However, NetBeans doesn't seem to update its debug info when I dynamically change code. The first time I execute the code, NetBeans debugs fine. However, after I change the code, NetBeans seems to have its line numbers off. So, the new code is executing, but NetBeans is using debug info from the original load.
Again, this is production code that has been working perfectly for years. With IntelliJ, I have been able to debug updated code without a problem. And there has never been a problem in production. When I update a file, the new code gets executed just fine.
I created two videos that demonstrate the problem. The first video shows code that is dynamically loaded. It debugs just fine. The second video shows the same debug session, but after the code has been changed and re-loaded. You can see that NetBeans is using the wrong line number information.
Although the video is showing Groovy code, the same problem exists with Java code. The example code I make available shows both.
Here are links to the two videos.
[https://private.stack360.io/files/debug-1.mkv](https://private.stack360.io/files/debug-1.mkv)
[https://private.stack360.io/files/debug-2.mkv](https://private.stack360.io/files/debug-2.mkv)
(Please let me know if you need a different movie file type.)
### How to reproduce
_No response_
### Did this work correctly in an earlier version?
No / Don't know
### Operating System
Fedora Linux
### JDK
17
### Apache NetBeans packaging
Apache NetBeans binary zip
### Anything else
Although my example and use is with Groovy code. I am very inclined to believe that this same issue would occur with Java code as well because, in essence, it is just a dynamic re-load of a class into the JVM.
### Are you willing to submit a pull request?
No
### Code of Conduct
Yes
Contributor guide
Research direction
Start with the Kiss example repository and compare the two linked videos: first-load debugging versus debugging after dynamically reloading the code. Reproduce the stale line information on Fedora with JDK 17, then determine what evidence is needed for NetBeans to track updated Java and Groovy debug information.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- groovy, java
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100