This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Created attachment 157503 [details] test project Hello, I think the "Apply Code Changes" feature is broken. I tests it via remote debugging on a Windows system (maven webapp) and with a local project on MacOsX (maven java application). #HOW TO REPRODUCE# 1) Open my attached maven project 2) Set a breakpoint to line 15 3) Hit "Debug File" 4) Change System.out.println line to print out another line 5) Hit "Apply Code Changes" When you step over or continue program execution the changed line is not applied. If you need any further information I'll try to provide them. Thanks in advance Benjamin
This can not work. Apply code changes does not work that way. It uses redefineClasses() method to change the user code, there's nothing else debugger could use: http://docs.oracle.com/javase/8/docs/jdk/api/jpda/jdi/com/sun/jdi/VirtualMachine.html#redefineClasses-java.util.Map- According to the description: "If a redefined method has active stack frames, those active frames continue to run the bytecodes of the previous version of the method." If the program is modified in following way: public static void main(String[] args) throws InterruptedException { print(); } private static void print() { System.out.println("TEST1"); System.out.println("TEST3"); } and you pot a breakpoint on the println() call, after you apply code changes, debugger will pop from the print() method and re-enter the updated code. In this case, apply code changes will work. Or if you call the print() method in a loop, after a change of the method body and a re-enter of the method, it will start executing the new code.
Thanks for you fast feedback. It seems that reproducing the problem is not as easy as I thought. I'll try to provide another test case for the problem and repoen the ticket in that case.
O.K.