bill
bill

Reputation: 11

Having problems decompiling class files

I have been working on a game for a while now and i tried to make this game as easy to understand as possible and easy to change as well by using one variable in a few places and not write the variables value in each place so that if i decide to change the value i wont have to change it every where, i will just have to change the value of the variable. Two days ago i formatted my computer and saved in my external Hard Drive a .Jar file of the game and the Eclipse(Coding environment) folder in where i THOUGHT the game source should be located at but it wasn't thus losing my source code. I was very upset but then I remembered that you can decompile a jar file. I searched for a decompiler and found the jd gui decompiler opened my jar file and i was happy to see that its actually works but then... I noticed that the code is alliiiiitle bit different. The compiler added tons of this. all the classes which doesn't matter to me. Then i noticed that every where there was a double type number it added a .0 and a D at the end of the number and even is some places where i had for example 0.7 i saw that there is 0.699999996 which again doesn't really matter, not a big deal. But then i noticed that in all the places where i had a final variable it changed it to its value (Example : supposed to be : numRowsToDraw = Panel.WIDTH / tileHeight + 2; what it is now : numRowsToDraw = 768 / tileHeight + 2;) which ruined all the easy to change aspect of the program and i didn't want to change the numbers back to the variable in all the places there should be a variable because it will take a lot of work.

So my question is : Is there a decompiler which doesn't change your code? If there is can you tell me the name of it?

THANKS!

Oh and i forgot to mention that i tried afterwards the JAD decompiler which did the same thing...

Upvotes: 0

Views: 268

Answers (1)

Antimony
Antimony

Reputation: 39451

No, there is not. Decompilation can never get back source level constructs like comments or the particular formatting of literals. But I'm sure there are automated source formatting tools out there that let you do stuff like remove Ds on double literals.

Upvotes: 1

Related Questions