FernFlower | Unofficial mirror of FernFlower Java decompiler

 by   MinecraftForge Java Version: Current License: No License

kandi X-RAY | FernFlower Summary

kandi X-RAY | FernFlower Summary

FernFlower is a Java library. FernFlower has build file available and it has low support. However FernFlower has 68 bugs and it has 2 vulnerabilities. You can download it from GitHub.

Fernflower is the first actually working analytical decompiler for Java and probably for a high-level programming language in general. Naturally it is still under development, please send your bug reports and improvement suggestions to the issue tracker.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              FernFlower has a low active ecosystem.
              It has 66 star(s) with 19 fork(s). There are 13 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 1 open issues and 3 have been closed. On average issues are closed in 214 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of FernFlower is current.

            kandi-Quality Quality

              OutlinedDot
              FernFlower has 68 bugs (4 blocker, 1 critical, 38 major, 25 minor) and 2764 code smells.

            kandi-Security Security

              FernFlower has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              OutlinedDot
              FernFlower code analysis shows 2 unresolved vulnerabilities (2 blocker, 0 critical, 0 major, 0 minor).
              There are 17 security hotspots that need review.

            kandi-License License

              FernFlower does not have a standard license declared.
              Check the repository for any license declaration and review the terms closely.
              OutlinedDot
              Without a license, all rights are reserved, and you cannot use the library in your applications.

            kandi-Reuse Reuse

              FernFlower releases are not available. You will need to build from source code and install.
              Build file is available. You can build the component from source.
              FernFlower saves you 42838 person hours of effort in developing the same functionality from scratch.
              It has 50657 lines of code, 2346 functions and 341 files.
              It has high code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed FernFlower and discovered the below as its top functions. This is intended to give you an instant insight into FernFlower implemented functionality, and help decide if they suit your requirements.
            • Convert the bytecode to a text buffer
            • Builds a method signature from a method descriptor
            • Finds a method in the classpath and returns it
            • Returns the set of parameters which are ambiguous
            • Generate the Java representation of the switch definition
            • Evaluates the case labels for a list of case labels
            • Simplifies a switch statement
            • Converts the literal string to a text buffer
            • Wraps an expression into a text buffer
            • Returns a text representation of the variable declaration
            • Returns a string representation of this block
            • Get the set of exceptions for a given basic block
            • Converts an expression into a text buffer
            • Initialize the destination table
            • Parse generic arguments list
            • Init entries
            • Read method arguments from the stream
            • Convert the variable definitions into Java code
            • Generate the bytecode for the return value
            • Returns a string representation of the variable declaration
            • Main entry point
            • Returns the default values
            • Returns a string representation of the variable definition
            • Returns a Java representation of the variable definitions
            • Checks the formal type bounds of the expression
            • Converts the variable definition into a text buffer
            Get all kandi verified functions for this library.

            FernFlower Key Features

            No Key Features are available at this moment for FernFlower.

            FernFlower Examples and Code Snippets

            No Code Snippets are available at this moment for FernFlower.

            Community Discussions

            QUESTION

            error: Source option 6 is no longer supported. Use 7 or later. When decompiling MCP
            Asked 2021-Apr-13 at 14:07

            Im trying to decompile the MCP v1.8.8 on mac but when I run the decompile.sh file I get this error:

            ...

            ANSWER

            Answered 2021-Apr-13 at 14:07

            Turns out the decompiled code was in the src folder

            Dragging the contents from that into the Client folder worked

            I have no idea why it didn't decompile into the Eclipse folder

            Source https://stackoverflow.com/questions/65837296

            QUESTION

            Java try-with-resource implementation done by compiler
            Asked 2021-Mar-30 at 14:18

            I was wondering, when exception occurs how try with resource statement manages to close resources before entering catch block. When exception occurs execution immediately jumps to catch block. So where actually try-with-resource closes the resources.

            To get better understanding of how it works I decided to see how compiler implements it. I wrote following code and and compiled it.

            ...

            ANSWER

            Answered 2021-Mar-30 at 13:53

            The behavior of try-with-resources is fully documented in the Java Language Specification, section 14.20.3. try-with-resources.

            It specifically shows that the following abbreviated version of the question code:

            Source https://stackoverflow.com/questions/66871966

            QUESTION

            Java byte code, calling method is not working properly
            Asked 2020-Aug-10 at 14:02

            Current situation & context

            For a school assignment, we have to write our own programming language. Currently, I am stuck trying at the point of making a method call.

            I can successfully make a method, but at the point where I am trying to call it, the program breaks.

            Test code

            The code that I am using to test is

            ...

            ANSWER

            Answered 2020-Aug-10 at 14:02

            As explained by @apangin in the comments, you are trying to call an instance method, so you need an object to call it on, but you did not supply one. You need to create a test instance and push it to the stack prior to calling testMethod, or alternatively mark testMethod as static and invoke it via invokestatic, which is probably easier in this case.

            That being said, I would also recommend using the Krakatau assembler rather than Jasmin. Krakatau uses a slightly modified form of Jasmin's syntax which is simpler and less error prone. In particular, in Krakatau, the class name, method name, and method descriptor are separated by spaces, removing a lot of the confusion you had about where you need to put the slashes when calling a method. Krakatau also has other advantages like full support for the bytecode format including Java 14 features, as well as a round trip disassembler which greatly assists with troubleshooting bytecode related issues.

            Source https://stackoverflow.com/questions/63341184

            QUESTION

            MCP940 Decompile.bat errors
            Asked 2020-May-16 at 23:29

            So I Downloaded mcp940 a few weeks ago and have been having massive problems, first when I tried using the newest version (1.12) it gave me an error:

            C:\Program Files (x86)\Java\jdk1.8.0_251\bin\java" -jar runtime\bin\fernflower.jar -din=1 -rbr=1 -dgs=1 -asc=1 -rsy=1 -iec=1 -jvn=1 -log=TRACE "-e=jars\libraries\net/java/jinput\jinput\2.0.5\jinput-2.0.5.jar" "-e=jars\libraries\com/ibm/icu\icu4j-core-mojang\51.2\icu4j-core-mojang-51.2.jar" "-e=jars\libraries\org/apache/httpcomponents\httpcore\4.3.2\httpcore-4.3.2.jar" "-e=jars\libraries\org/apache/logging/log4j\log4j-api\2.8.1\log4j-api-2.8.1.jar" "-e=jars\libraries\org/apache/commons\commons-lang3\3.5\commons-lang3-3.5.jar" "-e=jars\libraries\net/java/dev/jna\jna\4.4.0\jna-4.4.0.jar" "-e=jars\libraries\org/lwjgl/lwjgl\lwjgl-platform\2.9.4-nightly-20150209\lwjgl-platform-2.9.4-nightly-20150209-natives-windows.jar" "-e=jars\libraries\com/paulscode\libraryjavasound\20101123\libraryjavasound-20101123.jar" "-e=jars\libraries\net/sf/jopt-simple\jopt-simple\5.0.3\jopt-simple-5.0.3.jar" "-e=jars\libraries\com/mojang\text2speech\1.10.3\text2speech-1.10.3.jar" "-e=jars\libraries\com/google/guava\guava\21.0\guava-21.0.jar" "-e=jars\libraries\oshi-project\oshi-core\1.1\oshi-core-1.1.jar" "-e=jars\libraries\org/apache/httpcomponents\httpclient\4.3.3\httpclient-4.3.3.jar" "-e=jars\libraries\org/apache/commons\commons-compress\1.8.1\commons-compress-1.8.1.jar" "-e=jars\libraries\com/mojang\text2speech\1.10.3\text2speech-1.10.3-natives-windows.jar" "-e=jars\libraries\it/unimi/dsi\fastutil\7.1.0\fastutil-7.1.0.jar" "-e=jars\libraries\net/java/dev/jna\platform\3.4.0\platform-3.4.0.jar" "-e=jars\libraries\com/paulscode\codecjorbis\20101023\codecjorbis-20101023.jar" "-e=jars\libraries\com/paulscode\soundsystem\20120107\soundsystem-20120107.jar" "-e=jars\libraries\com/paulscode\librarylwjglopenal\20100824\librarylwjglopenal-20100824.jar" "-e=jars\libraries\org/lwjgl/lwjgl\lwjgl_util\2.9.4-nightly-20150209\lwjgl_util-2.9.4-nightly-20150209.jar" "-e=jars\libraries\commons-codec\commons-codec\1.10\commons-codec-1.10.jar" "-e=jars\libraries\net/java/jutils\jutils\1.0.0\jutils-1.0.0.jar" "-e=jars\libraries\com/mojang\patchy\1.1\patchy-1.1.jar" "-e=jars\libraries\commons-logging\commons-logging\1.1.3\commons-logging-1.1.3.jar" "-e=jars\libraries\org/lwjgl/lwjgl\lwjgl\2.9.4-nightly-20150209\lwjgl-2.9.4-nightly-20150209.jar" "-e=jars\libraries\commons-io\commons-io\2.5\commons-io-2.5.jar" "-e=jars\libraries\com/mojang\realms\1.10.17\realms-1.10.17.jar" "-e=jars\libraries\com/mojang\authlib\1.5.25\authlib-1.5.25.jar" "-e=jars\libraries\com/google/code/gson\gson\2.8.0\gson-2.8.0.jar" "-e=jars\libraries\net/java/jinput\jinput-platform\2.0.5\jinput-platform-2.0.5-natives-windows.jar" "-e=jars\libraries\com/paulscode\codecwav\20101023\codecwav-20101023.jar" "-e=jars\libraries\org/apache/logging/log4j\log4j-core\2.8.1\log4j-core-2.8.1.jar" "-e=jars\libraries\io/netty\netty-all\4.1.9.Final\netty-all-4.1.9.Final.jar" temp/minecraft_ff_in.jar temp\src\minecraft' failed : 1 Decompile failed

            I've been searching around and have had no luck, first I found someone saying I should add -Xmx2G to the beginning of a string in mcp.cfg Here it is before and after

            CmdFernflower = %s -jar %s -din=1 -rbr=1 -dgs=1 -asc=1 -rsy=1 -iec=1 -jvn=1 -log=TRACE {extra} {indir} {outdir}

            CmdFernflower = %s -Xmx2G -jar %s -din=1 -rbr=1 -dgs=1 -asc=1 -rsy=1 -iec=1 -jvn=1 -log=TRACE {extra} {indir} {outdir}

            after I added that it gave me another error:

            '"C:\Program Files (x86)\Java\jdk1.8.0_251\bin\java" -Xmx2G -jar runtime\bin\fernflower.jar -din=1 -rbr=1 -dgs=1 -asc=1 -rsy=1 -iec=1 -jvn=1 -log=TRACE "-e=jars\libraries\net/java/jinput\jinput\2.0.5\jinput-2.0.5.jar" "-e=jars\libraries\com/ibm/icu\icu4j-core-mojang\51.2\icu4j-core-mojang-51.2.jar" "-e=jars\libraries\org/apache/httpcomponents\httpcore\4.3.2\httpcore-4.3.2.jar" "-e=jars\libraries\org/apache/logging/log4j\log4j-api\2.8.1\log4j-api-2.8.1.jar" "-e=jars\libraries\org/apache/commons\commons-lang3\3.5\commons-lang3-3.5.jar" "-e=jars\libraries\net/java/dev/jna\jna\4.4.0\jna-4.4.0.jar" "-e=jars\libraries\org/lwjgl/lwjgl\lwjgl-platform\2.9.4-nightly-20150209\lwjgl-platform-2.9.4-nightly-20150209-natives-windows.jar" "-e=jars\libraries\com/paulscode\libraryjavasound\20101123\libraryjavasound-20101123.jar" "-e=jars\libraries\net/sf/jopt-simple\jopt-simple\5.0.3\jopt-simple-5.0.3.jar" "-e=jars\libraries\com/mojang\text2speech\1.10.3\text2speech-1.10.3.jar" "-e=jars\libraries\com/google/guava\guava\21.0\guava-21.0.jar" "-e=jars\libraries\oshi-project\oshi-core\1.1\oshi-core-1.1.jar" "-e=jars\libraries\org/apache/httpcomponents\httpclient\4.3.3\httpclient-4.3.3.jar" "-e=jars\libraries\org/apache/commons\commons-compress\1.8.1\commons-compress-1.8.1.jar" "-e=jars\libraries\com/mojang\text2speech\1.10.3\text2speech-1.10.3-natives-windows.jar" "-e=jars\libraries\it/unimi/dsi\fastutil\7.1.0\fastutil-7.1.0.jar" "-e=jars\libraries\net/java/dev/jna\platform\3.4.0\platform-3.4.0.jar" "-e=jars\libraries\com/paulscode\codecjorbis\20101023\codecjorbis-20101023.jar" "-e=jars\libraries\com/paulscode\soundsystem\20120107\soundsystem-20120107.jar" "-e=jars\libraries\com/paulscode\librarylwjglopenal\20100824\librarylwjglopenal-20100824.jar" "-e=jars\libraries\org/lwjgl/lwjgl\lwjgl_util\2.9.4-nightly-20150209\lwjgl_util-2.9.4-nightly-20150209.jar" "-e=jars\libraries\commons-codec\commons-codec\1.10\commons-codec-1.10.jar" "-e=jars\libraries\net/java/jutils\jutils\1.0.0\jutils-1.0.0.jar" "-e=jars\libraries\com/mojang\patchy\1.1\patchy-1.1.jar" "-e=jars\libraries\commons-logging\commons-logging\1.1.3\commons-logging-1.1.3.jar" "-e=jars\libraries\org/lwjgl/lwjgl\lwjgl\2.9.4-nightly-20150209\lwjgl-2.9.4-nightly-20150209.jar" "-e=jars\libraries\commons-io\commons-io\2.5\commons-io-2.5.jar" "-e=jars\libraries\com/mojang\realms\1.10.17\realms-1.10.17.jar" "-e=jars\libraries\com/mojang\authlib\1.5.25\authlib-1.5.25.jar" "-e=jars\libraries\com/google/code/gson\gson\2.8.0\gson-2.8.0.jar" "-e=jars\libraries\net/java/jinput\jinput-platform\2.0.5\jinput-platform-2.0.5-natives-windows.jar" "-e=jars\libraries\com/paulscode\codecwav\20101023\codecwav-20101023.jar" "-e=jars\libraries\org/apache/logging/log4j\log4j-core\2.8.1\log4j-core-2.8.1.jar" "-e=jars\libraries\io/netty\netty-all\4.1.9.Final\netty-all-4.1.9.Final.jar" temp/minecraft_ff_in.jar temp\src\minecraft' failed : 1 Decompile failed

            It's very similar to the old error and not the same as the first error I got when adding -Xmx2G

            Strangely enough, I don't get this error in 1.7.10 (mcp908) and can edit the game fine, I was also able to go in the Wayback machine and use 1.8 (mcp910?) can somebody please help?

            Thanks, Arik

            ...

            ANSWER

            Answered 2020-May-16 at 23:29

            The problem is apparent from the end of mcp.log:

            Source https://stackoverflow.com/questions/61826353

            QUESTION

            how to keep private members in pro-guard rules
            Asked 2020-May-06 at 20:21

            I am trying to use Proguard to keep my private fields, but it won't work. I stole most of this from Proguard keep classmembers because that question is similar to what I'm asking, and also followed this link How to tell ProGuard to keep private fields without specifying each field

            But it still doesn't work.

            I want to make a library for another company and still keep my access level modifiers fields and methods.

            Proguard:

            ...

            ANSWER

            Answered 2020-May-06 at 20:21

            It seems like R8 is causing this issue and not Proguard.

            Go into gradle.properties, and set android.enableR8=false. Next time you build, it will use Proguard.

            R8 is Google's answer to Proguard and in the recent versions of The Android Gradle Plugin (3.4.0+) it defaults to R8's code shrinker/obfuscator. There are some pros and cons to using Google's version instead of Guardsquare's technology.

            For more information, look at the documentation

            Source https://stackoverflow.com/questions/61632213

            QUESTION

            How to use ASM Opcodes.ACC_SYNTHETIC
            Asked 2020-Mar-05 at 14:19

            I am testing ACC_SYNTHETIC on a method by using ASM. The follows is my code

            ...

            ANSWER

            Answered 2020-Mar-05 at 14:19

            Thats the idea behind synthetic methods, these are methods generated by compiler, so decompilers often skip it by default, as by definition they should not be needed in source code.

            Like java specification states that

            1. A construct emitted by a Java compiler must be marked as synthetic if it does not correspond to a construct declared explicitly or implicitly in source code, unless the emitted construct is a class initialization method (JVMS §2.9).

            And jvm one:

            The ACC_SYNTHETIC flag indicates that this method was generated by a compiler and does not appear in source code [with some exceptions]

            Try to use javap -verbose -private -s -classpath yourJar.jar my.Class (or just directly to class filed) instead, it should list all your methods. Or just generate second normal method that will invoke this synthetic method and check if you can run it. Or just use reflections and getDeclaredMethods method to get all declared methods, including synthetic ones.

            Source https://stackoverflow.com/questions/60544549

            QUESTION

            1 out of 1 hunk FAILED Minecraft Mod Coder Pack Error
            Asked 2019-Sep-26 at 17:31

            While decompiling MCP 9.18 (Version 1.8.8 of Minecraft) I start the decompilation process and while decompiling it comes up with this error multiple times

            I have allocated more ram and such but nothing I have tried has fixed it.

            Keep in mind this only happens on MCP 9.18. 9.10 and above works fine from what I have tested.

            == ERRORS FOUND ==

            ...

            ANSWER

            Answered 2017-Apr-27 at 17:22

            @Pokechu22 Told me what the problem was.

            I used -Xmx2G AFTER -jar Which caused it to ignore important fernflower arguments.

            Source https://stackoverflow.com/questions/43613753

            QUESTION

            How much information of the source code does the compiled class file keep in Java?
            Asked 2019-Sep-19 at 12:59

            When a class file from another project of my own was decompiled by IntelliJ (by Fernflower de-compiler), I was marveled at the closeness of the decompiled code compared to the source code, even the method local variable names are the same as the original source code.

            I don't know anything about how the Java compilation process works and how the JVM works, my naive understanding is that the names of the public stuff may need to be kept after compilation, but names of local variables, they are simply mnemonics to facilitate human reading, totally useless outside of their scope, and I don’t think the JVM needs this information.

            So, is this information simply figured out by the de-compiler through some magic or does the compiled class retain a lot of information and what for?

            ...

            ANSWER

            Answered 2019-Sep-19 at 12:04

            In the end, it depends on the actual compiler and the exact compilation settings.

            As you noted, the JVM itself does not need any local variable names. (Strictly speaking, it doesn't really need method names either. It is even possible to have two methods with the same name and arguments that only differ in the return type, but I'd have to look up some more details about this in the spec to say something more profoundly). But the class file can contain additional debug information that goes beyond the information that is required by the JVM.

            The standard Java compiler is javac. And the documentation already contains some hints about the possible debug information:

            -g

            Generates all debugging information, including local variables. By default, only line number and source file information is generated.

            -g:none

            Does not generate any debugging information.

            -g:[keyword list]

            Generates only some kinds of debugging information, specified by a comma separated list of keywords. Valid keywords are:

            • source : Source file debugging information.
            • lines: Line number debugging information.
            • vars: Local variable debugging information.

            One can try this out with an example:

            Source https://stackoverflow.com/questions/58009717

            QUESTION

            Android: Service Class without onCreate() method
            Asked 2019-Jul-24 at 15:27

            I'm a beginner in Android Studio. I've recently picked up some Demo Apps for managing BLE devices, made them work separately, and am now trying to join two of them in a single App. Both Apps used a BLE Service, so I have to join them into a single service (or have them work together). While looking at the code I noticed that one of these Service classes has no onCreate() method. Then I looked into the implementation and found the Service is Instantiated using a nested class of the Service that extends the Binder class.

            Here's the relevant code from the service class:

            ...

            ANSWER

            Answered 2019-Jul-24 at 14:51

            There's a default implementation of onCreate in the Service class. If you don't override it, you just use that default implementation. That's sufficient to create the Service correctly, if you don't need additional logic.

            Your other question should be asked separately (1 question per post), but there's not enough code for me to answer it- I have no idea what the variable service is. However, you never create a service via constructor- it will not be initialized properly. You always call startService or bindService and let Android create it.

            Source https://stackoverflow.com/questions/57185472

            QUESTION

            Decompiling for-each loop
            Asked 2019-Apr-18 at 14:00

            Decompiling the .class file of the following for-each loop produces interesting results.

            Source - Main.java:

            ...

            ANSWER

            Answered 2019-Apr-18 at 14:00

            On the bytecode level, there are no formal declarations of local variables, at least not the way known from source code. A method has a declaration of the maximum number of local variables existing at the same time or “slots” to reserve for them. A local variable comes into life when an actual value is assigned to it (by “slot” index) and exists at least to the last read of that value.

            With these operations, it is impossible to recognize when a variable’s scope ends or whether two variables with disjunct scopes share a slot (compared to multiple assignments to the same variable). Well, if they have completely incompatible types, their assignments give a hint.

            To help debugging, there is an optional code attribute providing hints about declared local variables and their scope, but this is not required to be complete and won’t affect the way the JVM will execute the bytecode. But here, it seems the attribute was present and has been used by the decompiler.

            When I compile your example code with javac -g, I get

            Source https://stackoverflow.com/questions/55667359

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install FernFlower

            You can download it from GitHub.
            You can use FernFlower like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the FernFlower component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/MinecraftForge/FernFlower.git

          • CLI

            gh repo clone MinecraftForge/FernFlower

          • sshUrl

            git@github.com:MinecraftForge/FernFlower.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Consider Popular Java Libraries

            CS-Notes

            by CyC2018

            JavaGuide

            by Snailclimb

            LeetCodeAnimation

            by MisterBooo

            spring-boot

            by spring-projects

            Try Top Libraries by MinecraftForge

            MinecraftForge

            by MinecraftForgeJava

            ForgeGradle

            by MinecraftForgeJava

            Documentation

            by MinecraftForgeHTML

            FML

            by MinecraftForgeJava

            MCPConfig

            by MinecraftForgeJava