Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More user friendly API #14

Open
sirinath opened this issue Dec 15, 2020 · 4 comments
Open

More user friendly API #14

sirinath opened this issue Dec 15, 2020 · 4 comments

Comments

@sirinath
Copy link

Can some helper API be added so the end user can be insulated from lower level details like: ([Ljava/lang/String;)V, Ljava/io/PrintStream; where one writes in more families code constructors which is converted to the current lower level API calls.

Similarly one can search and replace byte-code slightly more higher level and close to source code.

@EricLafortune
Copy link
Contributor

Thanks for your note. Java bytecode indeed has its own format and structures, which are close to but different from Java/Kotlin/etc source code. Being insulated is not the intention at this level, but ProGuardCORE has classes to work with these structures and to go back and forth between more readable notations. Notably:

  • proguard.classfile.util.ClassUtil with conversion methods
  • proguard.classfile.util.InternalTypeEnumeration to extract types from a bytecode type descriptor
  • proguard.classfile.util.ExternalTypeEnumeration to extract types from a Java-style type descriptor
  • proguard.classfile.util.DescriptorClassEnumeration to extract class names from a bytecode type descriptor
  • proguard.classfile.ClassConstants, etc. with bytecode constants
  • proguard.classfile.Java*Constants with Java-style constants

At the code level, Java bytecode looks even more different from Java source code indeed. ProGuardCORE does not intend to be a compiler. For that purpose, you can use a standard compiler, but you still need to understand the resulting bytecode to manipulate it.

@sirinath
Copy link
Author

As a side note Spoon has reverse engineering to get back to a more high level view which is closer to the source.

@EricLafortune
Copy link
Contributor

Spoon looks nice indeed and is definitely better suited if you prefer working with Java source code. Decompilation may then be the weakest link, since not all Java bytecode can be easily/successfully/completely reverted to Java source code.

@sirinath
Copy link
Author

It would be great if something can be done to bridge the gap. Not fully Java but high level and not too low level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants