Sun's javac
compiler does have the concept of debugging information which can be (optionally) omitted from the compiled class output.
Look at the documentation, and check out the -g
flag options:
-g
Generate all debugging information, including local
variables. By default, only line number and source
file information is generated.
-g:none
Do not generate any debugging information.
-g:{keyword list}
Generate only some kinds of debugging information,
specified by a comma separated list of keywords.
Valid keywords are:
source
Source file debugging information
lines
Line number debugging information
vars
Local variable debugging information
These are perhaps not quite as extensive as the bytecode optimisations the .NET compilers might perform (which I'm not familiar with, sorry), but I think in theory they are there for performance reasons (smaller classfiles, etc).
In practise I strongly suspect they wouldn't make much difference to runtime performance on modern hardwares + JVMs, but they are there.