javaeclipsedead-code

How to disable dead code elimination in the Java compiler?


This may seem a strange question... Why would anyone want to disable such a thing? But I know what I'm doing (and why I want/need to do this) and I really want to disable dead code elimination.

Is it possible somehow?

I use Eclipse by the way, if it's relevant...


Solution

  • Is it possible somehow?

    I haven't come across any method for doing this. There don't seem to be any relevant options.

    But to be clear, dead code elimination could (potentially) be done by either or both of the bytecode compiler and the JIT. So you need to be clear which case you are concerned about. (I guess it is the bytecode compiler ...)