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

[gui] decompile incorrect when use class static variable/function if variable with the same name exists #2187

Open
3 tasks done
zhengbili opened this issue May 19, 2024 · 0 comments
Labels
bug GUI Issues in jadx-gui module

Comments

@zhengbili
Copy link

Issue details

For example, the source code is

class a{
    public static int length(){
        return -1;
    }
    public static int length2 = -2;
}

public class Test{
    static String a = "";
    public static void main(String[] args){
        for(int i=0;i<args.length;i++)a+=args[i];
        System.out.println(a.length());
        System.out.println(((a)null).length());
        System.out.println(((a)null).length2);
    }
}

the decompile result is

public class Test {
    static String a = "";

    public static void main(String[] strArr) {
        for (String str : strArr) {
            a += str;
        }
        System.out.println(a.length());
        System.out.println(a.length());
        System.out.println(a.length2);
    }
}

Jadx ignores the existence of a variable with the same name, which may lead to semantic errors in the code. Is it possible to do simple identification, or to represent such code in the form of ((ClassName)null).variableName and ((ClassName)null).functionName() while decompiling?

Jadx version

1.5.0

Java version

1.8+

OS

  • Windows
  • Linux
  • macOS
@zhengbili zhengbili added bug GUI Issues in jadx-gui module labels May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug GUI Issues in jadx-gui module
Projects
None yet
Development

No branches or pull requests

1 participant