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] Primitive is compared with null #723

Closed
bagipro opened this issue Jul 26, 2019 · 1 comment
Closed

[core] Primitive is compared with null #723

bagipro opened this issue Jul 26, 2019 · 1 comment
Labels
bug Core Issues in jadx-core module

Comments

@bagipro
Copy link
Collaborator

bagipro commented Jul 26, 2019

Checks before report

Describe error

But regressions are expected, feel free to report :)

Probably it's a regression one :)

File com/paypal/android/p2pmobile/activityitems/model/ActivityItemsModel.java

    /* JADX WARNING: Incorrect type for immutable var: ssa=java.lang.Long, code=long, for r6v0, types: [java.lang.Long] */
    public boolean hasValidItem(com.paypal.android.foundation.activity.model.ActivityItem.Id id, long j) {
        if (j == null) { // <<<
            j = 900000L;
        }
        android.util.Pair pair = (android.util.Pair) this.mItemLruCache.get(id);
        if (pair == null) {
            return false;
        }
        if (java.lang.Long.valueOf(((java.lang.Long) pair.first).longValue() + /* >>> */j.longValue()).longValue() > java.lang.Long.valueOf(android.os.SystemClock.uptimeMillis()).longValue()) {
            return true;
        }
        return false;
    }

APK: https://drive.google.com/file/d/1fCN9PXu8Zw4Kdnhgd0_qmzEvgWLfEU-9/view?usp=sharing

@skylot
Copy link
Owner

skylot commented Jul 26, 2019

@sergey-wowwow in this case jadx was incorrectly change type of method parameter from Long to long. I commit a fix for that.
Also, this method is a nice sample to show how many boxing (and unboxing) methods can be removed:

public boolean hasValidItem(Id id, Long l) {
    if (l == null) {
        l = 900000L;
    }
    Pair<Long, ActivityItem> pair = this.mItemLruCache.get(id);
    if (pair == null) {
        return false;
    }
    return pair.first + l > SystemClock.uptimeMillis();
}

Anyway, now jadx only replace boxing of constants, like: Long.valueOf(900000) to 900000L.

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