Convert Java bytecode to other presentation and programming languages

I am looking for ways / tools / projects to convert Java bytecode to other programming languages, or at least in structured representations (such as XML) Ideal open source, natural

I've seen ASM, "bytecode operation and analysis framework" It does not support translation to other representations, but looks like a good foundation for such a project Sadly, none of the items listed on the users page are over

Solution

ASM has a tree API, which basically provides you with the complete structure of bytecode It seems easy to use, even if the visitor API is printed in XML or other formats I don't know what that is for

Converting back to Java is a decompilation, and a job like JAD does a good job But this is difficult because a) information is lost during source to bytecode conversion, and b) there is ambiguity that multiple sources can produce the same bytecode

If you really want to convert directly from bytecode to another high-level language, it is difficult to do both things comprehensively and meaningfully, because decompilation is difficult, unless it is worse in another language

If you want to switch from Java source code to another language source code, you have done it before, just like in Java to Python converter It's a little easy because you can convert java to ast similar to ANTLR, or the built-in java compiler tool, project jackpot. Even then, I don't think you will get very habitual code in the target language

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>