Javac produces inverted comparison instructions in general

Hi all

i've observed with JDK5.0 that java uses byte code instructions for comparisons which are the direct negation of what has been used in the source code. E.g. an equals (==) comparison with 2 integers is translated into IF_ICMPNE and vice versa (!= becomes IF_ICMPEQ). That's true for all types of byte code comparison instructions and i've not come up yet with an example where this behaviour can not be observed. Does anyone know why this general negation is used ? I know that the compiler can just translate in anything what is semantically correct. But as I want to do a byte code analysis and need to reference the source later on (not just by linenumber but additionally with a description what issue has been found in the code including an appropriate description) this behaviour is counter-productive.

So again the question: is this behviour intended ? Is there any reason for that ? Or is that some kind of bug which did not lead to obvious incompatibilities ?

Regards Alex

[1016 byte] By [rauara] at [2007-11-27 5:04:35]
# 1
This is normal for a compiler. Otherwise the 'else' block would have to be generated before the 'if' block. Think about the generated code.
ejpa at 2007-7-12 10:22:58 > top of Java-index,Developer Tools,Java Compiler...