Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What code changes are automatically reflected in eclipse in debug mode?

Tags:

java

eclipse

I use eclipse (to write, debug ) as an IDE. In debug mode when I make some changes,like initializing a local variable, they are reflected automatically.

But other changes like changing the value of a static variable; sometimes I get a message saying I need to restart the VM and sometimes I don't.

Now the question is what sort of changes are automatically reflected and what doesn't.

I use remote debugging, but will be there any difference when running the program from eclipse?

like image 732
Rig Veda Avatar asked Oct 13 '22 20:10

Rig Veda


2 Answers

You're seeing Hotswap in action. It's limited to changing method bodies only. More info here.

like image 80
darioo Avatar answered Oct 19 '22 15:10

darioo


It is not the IDE feature, but VM feature of remote debugging. VM now can handle simple changes in logic inside the methods of variable initializers, but can't treat with changed class structure.

The reloading is treated normally, when your class structure doesn't change: you don't remove or add members, methods or inner classes, because adding members or inner classes changes the size of allocated for the class memory. Methods doesn't change the memory size, but changes their structure.

Here you can find some explanations.

like image 2
Vladimir Ivanov Avatar answered Oct 19 '22 14:10

Vladimir Ivanov