- Notifications
You must be signed in to change notification settings - Fork723
Decompiler from Java bytecode to Java, used in IntelliJ IDEA.
License
JetBrains/fernflower
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Fernflower is the first actually working analytical decompiler for Java and probably for a high-level programming language in general.
Releases are published in theIntellij Community repository.
Please send your bug reports and feature requests to theissue tracker (in subsystemJava. Decompiler. Engine).
Fernflower is bundles as in IntelliJ IDEA and is primarily used to show Java code when debugging or navigating through class files.
Fernflower can be run from the command line in stand-alone mode using the following command:
java -jar fernflower.jar [-<option>=<value>]* [<source>]+ <destination>`* means zero or more times
+ means one or more times
<source>: file or directory with files to be decompiled.Directories are recursively scanned.Allowed file extensions are class, zip and jar.Sources prefixed with -e= mean "library" files that won't be decompiled but taken into account when analyzingrelationships between classes or methods.Especially renaming of identifiers (see theren option) can benefit from information about external classes.
<destination>: destination directory to place the resulting Java source into
<option>=<value>: a command-line option with the corresponding value (see "Command-line options" below).
java -jar fernflower.jar -hes=0 -hdc=0 c:\Temp\binary\ -e=c:\Java\rt.jar c:\Temp\source\java -jar fernflower.jar -dgs=1 c:\Temp\binary\library.jar c:\Temp\binary\Boot.class c:\Temp\source\Except formpm andurc the value of 1 means the option is activated, 0 - deactivated.The default value, if any, is given between parentheses.
Typically, the following options will be changed by user, if any: hes, hdc, dgs, mpm, ren, urcThe rest of options can be left as they are: they are aimed at professional reverse engineers.
rbr(1): hide bridge methodsrsy(0): hide synthetic class membersdin(1): decompile inner classesdc4(1): collapse 1.4 class referencesdas(1): decompile assertionshes(1): hide empty super invocationhdc(1): hide empty default constructordgs(0): decompile generic signaturesner(1): assume return not throwing exceptionsden(1): decompile enumerationsrgn(1): removegetClass()invocation, when it is part of a qualified new statementlit(0): output numeric literals "as-is"asc(0): encode non-ASCII characters in string and character literals as Unicode escapesbto(1): interpret int 1 as boolean true (workaround to a compiler bug)nns(0): allow for not set synthetic attribute (workaround to a compiler bug)uto(1): consider nameless types asjava.lang.Object(workaround to a compiler architecture flaw)udv(1): reconstruct variable names from debug information, if presentump(1): reconstruct parameter names from corresponding attributes, if presentrer(1): remove empty exception rangesfdi(1): de-inline finally structuresmpm(0): maximum allowed processing time per decompiled method, in seconds. 0 means no upper limitren(0): rename ambiguous (resp. obfuscated) classes and class elementsurc(-): full name of a user-supplied class implementingIIdentifierRenamerinterface. It is used to determine which class identifiers should be renamed and provides new identifier names (see "Renaming identifiers")inn(1): check for IntelliJ IDEA-specific @NotNull annotation and remove inserted code if foundlac(0): decompile lambda expressions to anonymous classesnls(0): define a new line character to be used for output. 0 -'\r\n'(Windows), 1 -'\n'(Unix), default is OS-dependentind: indentation string (default is 3 spaces)crp(0): use record patterns where it is possiblecps(0): use switch with patterns where it is possiblelog(INFO): a logging level, possible values are TRACE, INFO, WARN, ERRORiec(0): include the entire classpath in context when decompilingisl(1): inline simple lambda expressionsucrc(1): hide unnecessary record constructor and getterscci(1): check if resource in try-with-resources actually implementsAutoCloseableinterfacejvn(0): overwrite any local variable names with JAD style namesjpr(0): include parameter names in JAD naming
Some obfuscators give classes and their member elements short, meaningless and above all ambiguous names. Recompiling of suchcode leads to a great number of conflicts. Therefore, it is advisable to let the decompiler rename elements in its turn,ensuring uniqueness of each identifier.
Optionren (i.e.-ren=1) activates renaming functionality. The default renaming strategy goes as follows:
- rename an element if its name is a reserved word or is shorter than 3 characters
- new names are built according to a simple pattern: (class|method|field)_<consecutive unique number>
You can overwrite these rules by providing your own implementation of the 4 key methods invoked by the decompiler while renaming. Simplypass a class that implementsorg.jetbrains.java.decompiler.main.extern.IMemberIdentifierRenamerin the optionurc(e.g. -urc=com.example.MyRenamer) to Fernflower. The class must be available on the application classpath.
The meaning of each method should be clear from naming: toBeRenamed determine whether the element will be renamed, while the other threeprovide new names for classes, methods and fields respectively.
Build an executable start-up script:
./gradlew :installDistThe startup script is generated inbuild/install/engine/bin.
Fernflower is part of theIntelliJ Community project, contributions are welcome, thepreferred way of sending patches is by creating a pull request in the IntelliJ community repository. When submitting patches, pleasefollow thecontribution guidelines.
Fernflower is licensed under theApache License Version 2.0.
Fernflower was originally developed byStiver but has been maintained byJetBrains since 2014. Some patches fromForgeFlower were merged into this repository. Themirror of Fernflower was also maintained byAndrew McRae for a very long time.
About
Decompiler from Java bytecode to Java, used in IntelliJ IDEA.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.