ByteBuddy - how to save the Java source code?

116 views Asked by At

It seems quite common to save the .class file with ByteBuddy Display generated bytebuddy bytecode

Would it be possible to save the Java source code (.java file) as well in some way?

I found saveIn(File) (https://bytebuddy.net/#/tutorial) can only write the byte code (.class file).

Any help to get this answered much appreciated.

1

There are 1 answers

0
Rafael Winterhalter On BEST ANSWER

If you need source code, you'd ideally generate it and compile it. Decompiling class files (there's tools for that too) is normally not equally reliable.