views:

88

answers:

3

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...

A: 

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 ...)

Stephen C
+1  A: 

The first thought that popped into my head is to write some kind of crazy aspect and use compile time weaving, so that your dead code isn't dead anymore... but then my head exploded.

bwawok
*"... but then my head exploded"* Messy! I guess we need to consider dead coder removal as well :-)
Stephen C
A: 

I would suggest you to think again, and try to achieve your goal with some different way. What are you trying to do looks like a 'hack' and even if you succeed, you will never be sure, that your dead code retention mechanism still works.

Shaman