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

[core] Weird if-else statements #1674

Closed
bagipro opened this issue Sep 18, 2022 · 1 comment
Closed

[core] Weird if-else statements #1674

bagipro opened this issue Sep 18, 2022 · 1 comment
Labels
bug Core Issues in jadx-core module

Comments

@bagipro
Copy link
Collaborator

bagipro commented Sep 18, 2022

Hey!

I've noticed weird conditions when decompiled. Let's assume that we have the following code:

    void test(String action) {
        if ("a".equals(action)) {
            do1();
        } else if ("b".equals(action)) {
            do2();
        } else if ("c".equals(action)) {
            do3();
        }
    }

However, it's always decompiled to

    void test(String action) {
        if ("a".equals(action)) {
            do1();
        } else if ("b".equals(action)) {
            do2();
        } else if (!"c".equals(action)) {
        } else {
            do3();
        }
    }

It includes not only string conditions, but all of them. Is there a way to make the decompiled code more pretty?

An example is in method com.samsung.android.aircommandmanager.AirCommandManager.AirCmdBroadcastReceiver.onReceive() in APK https://drive.google.com/file/d/1-awUDVr7qOf6ao_H7-f_bnWHgluavt7M/view?usp=sharing:

        } else if ("com.sec.android.facm.START_WIFI_SOCKET_CONNECT".equals(action)) {
            m369s(stringExtra, stringExtra2);
        } else if (!"com.sec.android.facm.START_WIFI_AP_CONNECT".equals(action)) {
        } else {
            m373o(stringExtra, stringExtra2);
        }
@bagipro bagipro added bug Core Issues in jadx-core module labels Sep 18, 2022
@skylot
Copy link
Owner

skylot commented Sep 23, 2022

@bagipro fixed, thanks for report 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Core Issues in jadx-core module
Projects
None yet
Development

No branches or pull requests

2 participants