If all the bytecode which compiled from java sources can be decompiled to java sources?

I wonder if all the bytecode which comes from java (not other JVM language) can be decompiled to java sources again?

The answer is No.

Decompilers aren't guaranteed to work for all Java bytecodes:

  • A good obfuscator will deliberately rearrange the bytecodes in such a way that the common decompilers won't produce readable source code ... and probably won't produce valid source code.

  • Many decompilers out there have problems dealing with newer Java constructs.

  • Many decompilers have problems with bytecodes compiled from "complicated" source code.

  • Even if they generate compilable code, there is no guarantee that the code will be correct.

The bottom line is that a decompiler is only as good as the intelligence and diligence of its author can make it. I've never heard of a perfect one.


Java byctecode can be decompiled back to java source code. The decompiled source will generally not look the exact same, but will have the same functionality. If you're concerned that someone might decompile your source, you can use obfuscators (like ProGuard) to help.