Failsafe way of rounding JVM byte code to text representation and vice versa

I'm looking for a foolproof way to get around between a JVM class file and a text view and vice versa.

One strict requirement is that the resulting round JVM class file is exactly functionally equivalent to the original JVM class file if the text representation remains unchanged.

In addition, the text view must be readable and editable. It should be possible to make small changes to the text representation (for example, to change the text string or class name, etc.), which are reflected in the resulting representation of the class file.

The simplest solution would be to use a Java decompiler, such as JAD, to generate a text view, which in this case would simply be a recreated Java source code. And then use javac to generate byte code. However, given the state of free Java decompilers, this approach does not work under any circumstances. It is fairly easy to create confusing bytecode that does not support the full file class file / java -source / class file round-trip file (partly because there simply is no 1: 1 mapping between the JVM bytecode and the Java source code).

Is there a safe way to achieve the JVM class of a file / text view / file class with rounding taking into account the requirements above?

Update: Before answering - save time and effort by reading all of the above requirements and note:

  • " - JVM" " Java".
+2
5

BCEL JasminVisitor jasmin .

, . , , , , . , , , , , .

jasmin , .

+5

?

+1

, ASM . ( , ShuggyCoUk, .) Jarjar , ASM .

0

, .

Krakatau , , . Jasmin, , Jasmin . "" Hotspot, pre 45.3 classfiles, Code.

, . , (, , ).

0

. - Java.

Soot http://www.sable.mcgill.ca/dava/ - , Java. , , .

- .

-2

All Articles