Rohan Kishibe
Rohan Kishibe

Reputation: 667

decompiled code is different from original code

I decompiled a .jar file using jd-gui and checked codes, I found it different from original .java file.

Why this happens?

In addition, decompiled code seems grammatically wrong( where curly bracket goes?)

Upvotes: 2

Views: 3144

Answers (2)

Benjamin Seche
Benjamin Seche

Reputation: 326

Decompile code always tries to do the same thing as the source code, but are written in a different way because of the optimizations of the compiler. They are some decompiler that are better than other, check that article

Upvotes: 1

Ognyan Tsvetkov
Ognyan Tsvetkov

Reputation: 36

It's impossible to get the original code by decompiling just because different code can lead to the same java byte code statements. However, you are getting an equivalent version which performs exactly the same actions as the original.

Upvotes: 2

Related Questions