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] Jadx generates incorrect code for NULL pointer #1828

Closed
xxh160 opened this issue Apr 19, 2023 · 2 comments
Closed

[core] Jadx generates incorrect code for NULL pointer #1828

xxh160 opened this issue Apr 19, 2023 · 2 comments
Labels
bug Core Issues in jadx-core module

Comments

@xxh160
Copy link

xxh160 commented Apr 19, 2023

Hi! I am an undergraduate, and I am doing some research based on Jadx.

I found a problem related to the NULL pointer, and here is an example:

class T2 {
    public long l;
}
class T1<H, P extends Byte> {
    public T2 t2;
    public T1(T2 t2) {
        this.t2 = t2;
    }
}
public class Demo {
    static public final Long foo(Double d1) {
        T1<T2, Byte> t1 = (T1<T2, Byte>) null;
        return t1.t2.l;
    }
}

I decompiled the classes.dex the code above compiled into, and I got this:

package defpackage;
public class Demo {
    public static final Long foo(Double d) {
        return Long.valueOf(null.t2.l);
    }
}

The null.t2 raised a compilation error:

./out/sources/defpackage/Demo.java:6: error: <null> cannot be dereferenced
        return Long.valueOf(null.t2.l);
                                ^
1 error

Would you please take a look at this? It is important for me!
Thanks a lot!

Jadx version: the newest jadx binary in Arch Linux.
Java version: 11.0.18
I also attach the source files and the decompilation results and I hope they will be helpful: demo.zip.

@xxh160 xxh160 added bug Core Issues in jadx-core module labels Apr 19, 2023
@skylot
Copy link
Owner

skylot commented Apr 19, 2023

Fixed

@skylot skylot closed this as completed Apr 19, 2023
@xxh160
Copy link
Author

xxh160 commented Apr 19, 2023

Thanks for the help!!!!!!

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