Javac weirdness

At work we discovered some weirdness with Javac and we are wondering why it acts the way it does.
Our setup is:

A project with many classfiles that needed to be reformatted.
Only we found out that after compiling them (with SDK 1.3) both source trees generate different binary’s.

We wanted to ensure that the code itself remains unchanged (we are talking about formatting about 1500 files).
However if we decompile the source or use Javap, the code is the same again.

What is causing this?

Could it be the debug information in the class files, detailing line numbers etc? Try turning off debug information (-O) and see how similar the generated classes are without it.

Is it active by default then?

Hmmm, after looking at the info on the sun site, I saw this:

-g
Generate all debugging information, including local variables. By default, only line number and source file information is generated.

Hmmm, thanks for the hint 8)

[quote]…only line number and source file information is generated…
[/quote]
If the source trees are different and the source code is formatted differently then both of those things could have different binary data.
That must be it.

BTW, I don’t think -O removes debugging info, it isn’t even a real option anymore. It’s not listed with -help.
You want: -g:none

I really never expected the end result to be different.
All that changed was the ammount of whitespace per tab and some of the indentation rules.

But ofcourse this enough to change the ammount of lines everywhere.
Thats why javap and jad returned the same code.

Anyways, thank you very much for pointing out what I overlooked ;D

[quote]BTW, I don’t think -O removes debugging info, it isn’t even a real option anymore. It’s not listed with -help.
You want: -g:none
[/quote]
Yes, quite true. I hadn’t spotted that!