Rig Veda
Rig Veda

Reputation: 811

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

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?

Upvotes: 5

Views: 4316

Answers (5)

snorbi
snorbi

Reputation: 2900

HotSwap is very limited, it can reload only simple method body changes.

Take a look at JRebel, it can reload other code changes as well (like adding/removing fields/methods/annotations/enum values, etc). See its detailed feature list.

(Please note that JRebel is a commercial product, with free licenses available for OSS and Scala developers.)

Upvotes: 0

Buhake Sindi
Buhake Sindi

Reputation: 89169

Static variables are class variables that are instantiated once the class. They are instantiated at class loading time. Changing static variables will therefore require the VM to reload and instantiated the changed static variable.

That's all I can provide for your question.

Upvotes: 0

Andreas Dolk
Andreas Dolk

Reputation: 114767

In remote debugging, hot code replacement isn't possible at all because eclipse can't swap class files inside a different JVM.

The remote debugger connects to a different virtual machine and monitors the code that is executed inside that remote machine. Just the source files are local.

Upvotes: -1

darioo
darioo

Reputation: 47183

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

Upvotes: 3

Vladimir Ivanov
Vladimir Ivanov

Reputation: 43098

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.

Upvotes: 2

Related Questions