In Eclipse, if you run a program under "Debug" you can make changes to the code, and most of the time it will take effect immediately.
Sometimes, though, it will not -- in which case it pops up a message, or says "(may be out of sync)" next to the threads in the Debug pane.
What determines the kind of changes that can be hot-swapped? I've noticed these changes usually fail:
- introducing new anonymous inner classes
- changing classes (renaming/adding/removing fields and methods) when the class is instantiated
- adding a try-catch block
but sometimes it seems to be almost random. What is the logic behind determining whether code can be replaced or not?