skylot / jadx

Dex to Java decompiler
Apache License 2.0
41.96k stars 4.9k forks source link

[core] Cannot Decompile Single Classes Using the Fallback Mode #2276

Closed thekief closed 2 months ago

thekief commented 2 months ago

Issue details

For a small show case I converted a small code sample using d8. After successfully creating a classes.dex file, I can decompile the file without passing any options. When trying to generate code using the fallback-mode an exception is thrown.

Relevant log output or stacktrace

jadx -f classes.dex
INFO  - loading ...
ERROR - Process error:
jadx.core.utils.exceptions.JadxRuntimeException: Ordering pass not found: CodeRenameVisitor, listed in 'runBefore' of pass: KotlinMetadataDecompile
 all passes: [AttachTryCatchVisitor, AttachCommentsVisitor, ProcessInstructionsVisitor, FallbackModeVisitor]
        at jadx.core.utils.PassMerge.searchInsertPos(PassMerge.java:97)
        at jadx.core.utils.PassMerge.merge(PassMerge.java:44)
        at jadx.core.dex.nodes.RootNode.mergePasses(RootNode.java:325)
        at jadx.api.JadxDecompiler.load(JadxDecompiler.java:124)
        at jadx.cli.JadxCLI.processAndSave(JadxCLI.java:51)
        at jadx.cli.JadxCLI.execute(JadxCLI.java:38)
        at jadx.cli.JadxCLI.main(JadxCLI.java:22)

Provide sample and class/method full name

class Example {
    static void main() {

        int a = 3;
        int b = 5;
        int c = a + b;

        System.out.println("Hello, World!" + c);
    }
}

Jadx version

1.5.0

skylot commented 2 months ago

Fixed. @thekief please check latest unstable build: https://nightly.link/skylot/jadx/workflows/build-artifacts/master

I disabled passes injection from plugins for predefined decompilation modes (fallback and simple for now).

Also, I opened a new issue #2277 with a feature to disable plugins, this should provide a simple workaround if plugin causes issues.