U
U
user.2019-02-13 15:01:17
Java
user., 2019-02-13 15:01:17

Any Java byte code can be successfully decompiled and viewed?

Good afternoon,
I have some questions about reversing/decompiling.
Java code is executed on a Java machine, but nevertheless, if third-party ones (cryptors, obfuscators) were not used to complicate its decompilation, is it always possible to see exactly the original code?
Doesn't matter what we will decompile?
These can be any types of java applications containing java byte code, for example: apk, jar files... in any case, we can get the primary java code (once again, if cryptors, obfuscators were not used)?
For example, if a program is written in a high-level language and compiled into a binary, then the maximum that we can see is its assembler code (as far as I understand, it is not possible to translate the tasm / masm / fasm code into a high-level language into the original version) ... With Java, as far as I understand, things are a little different?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
GavriKos, 2019-02-13
@GavriKos

No, you will not receive the original code. It will lack comments, some constants, some calls may be inlined, the code will be more optimal (if optimization is enabled). I don’t know yet what about preprocessors and defines - but they won’t be there either, if they are in Java.

D
Dmitry Alexandrov, 2019-02-13
@jamakasi666

It is the completely original code that will not work (unless, of course, all debug symbols are included). The code will be restored to similar constructions, i.e.:
relatively speaking constructions

for(int i:0;i<100;i++){}

или
for(Object o: objects){}

и еще тонна вариантов

In bytecode it will have the same form (do not take it literally, but this is figuratively speaking). This means that the decompiler will see a similar bytecode and restore the construction that it considers the most convenient, but not the one that was in the original.
Similarly with other cases, constants, functions, classes.
In addition, tons of subtleties will not be taken into account, at least take annotations.
Those. in general, the code will be readable, most likely but not the fact we compile, it is likely that it will work but with glitches that were not in the original.
In general, everything directly depends on the compiler, the code style, the features used that do something at the compilation stage, the sugar of the libraries and the language.
In the same c\c++, you can decompile to assembler and then restore it to C, which is also quite readable and sometimes working. If there are debug symbols, then tons of other things will be restored (names of constants\variables\functions\comments).
In short, everything is very relative, but in general, java code even compiled with optimizations is much more readable, but this is due to the peculiarities of the work of the binary files themselves.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question