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] Miss of casts among primitive types #921

Open
bagipro opened this issue Apr 29, 2020 · 7 comments
Open

[core] Miss of casts among primitive types #921

bagipro opened this issue Apr 29, 2020 · 7 comments
Assignees
Labels
bug Core Issues in jadx-core module
Milestone

Comments

@bagipro
Copy link
Collaborator

bagipro commented Apr 29, 2020

Hi, a small test case for the issue in kotlin.NumbersKt__NumbersKt

    public static final byte rotateLeft(byte b, int i) {
        byte b2 = i & 7; // missing cast
        return (byte) (((b & 255) >>> (8 - b2)) | (b << b2));
    }

    public static final short rotateLeft(short s, int i) {
        short s2 = i & 15; // missing cast
        return (short) (((s & 65535) >>> (16 - s2)) | (s << s2));
    }

    public static final byte rotateRight(byte b, int i) {
        byte b2 = i & 7; // missing cast
        return (byte) (((b & 255) >>> b2) | (b << (8 - b2)));
    }

    public static final short rotateRight(short s, int i) {
        short s2 = i & 15; // missing cast
        return (short) (((s & 65535) >>> s2) | (s << (16 - s2)));
    }

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

@bagipro
Copy link
Collaborator Author

bagipro commented Aug 10, 2020

@skylot
May you please also fix this one too?

@skylot skylot added this to the v1.2.0 milestone Aug 10, 2020
@skylot skylot self-assigned this Aug 10, 2020
@skylot
Copy link
Owner

skylot commented Sep 11, 2020

@sergey-wowwow I commit a fix, hope it will resolve some cases.

@skylot skylot closed this as completed Sep 11, 2020
@bagipro
Copy link
Collaborator Author

bagipro commented Sep 12, 2020

@skylot
I've noticed a different error. Class com.ebay.mobile.common.RefineContentFragment

    /* JADX DEBUG: Multi-variable search result rejected for r3v0, resolved type: boolean */
    /* JADX WARN: Multi-variable type inference failed */
    private void setRefineVisible(boolean z) {
        if (this.isRefineEnabled) {
            this.refineButton.setVisibility(z != 0 ? 0 : 8); // <<< should be only "z ? 0 : 8"
            this.drawerLayout.setDrawerLockMode(!z);
        }
    }

@skylot
Copy link
Owner

skylot commented Sep 12, 2020

@sergey-wowwow thanks!

@skylot skylot reopened this Sep 12, 2020
skylot added a commit that referenced this issue Sep 13, 2020
@bagipro
Copy link
Collaborator Author

bagipro commented Sep 14, 2020

@skylot
And one more thing in kotlinx.coroutines.CompletedExceptionally

    private volatile int _handled;
    /* JADX WARN: Type inference failed for: r0v0, types: [int, boolean] */
    public final boolean getHandled() {
        return this._handled;
    }

@skylot
Copy link
Owner

skylot commented Sep 14, 2020

@sergey-wowwow yeah, this time it is int to boolean conversion 🤦

@bagipro
Copy link
Collaborator Author

bagipro commented Sep 14, 2020

@skylot
And a few more invalid operations.

Class com.ebay.common.view.DefaultItemAdapter

    /* JADX DEBUG: Multi-variable search result rejected for r6v3, resolved type: boolean */
    /* JADX DEBUG: Multi-variable search result rejected for r6v4, resolved type: boolean */
    /* JADX WARN: Multi-variable type inference failed */
    /* access modifiers changed from: protected */
    public boolean setCurrencyWithBaseUnitPriceAuctionWithBin(android.widget.TextView textView, com.ebay.nautilus.domain.data.ItemCurrency itemCurrency, com.ebay.nautilus.domain.data.ItemCurrency itemCurrency2, com.ebay.nautilus.domain.data.ItemCurrency itemCurrency3, com.ebay.nautilus.domain.data.ItemCurrency itemCurrency4, boolean z, Item item) {
        com.ebay.nautilus.domain.data.ItemCurrency convertedPrice;
        com.ebay.nautilus.domain.data.ItemCurrency convertedPrice2 = getConvertedPrice(itemCurrency, itemCurrency2);
        android.text.Spannable spannable = null;
        spannable = null;
        spannable = null;
        if (convertedPrice2 != null) {
            int i = 1;
            i = 1;
            boolean z2 = !convertedPrice2.code.equals(itemCurrency.code);
            java.lang.String formatCurrency = formatCurrency(convertedPrice2.value, convertedPrice2.code, z2 | 2); // invalid operation on boolean `z2 | 2`
            if (!(z2 == 0 || formatCurrency == null)) { // also invalid operation `z2 == 0`

Class com.ebay.nautilus.shell.databinding.UxcompDiscoverySelectionCapsuleBindingImpl

    /* access modifiers changed from: protected */
    @Override // androidx.databinding.ViewDataBinding
    public void executeBindings() {
        long j;
        boolean z;
        boolean z2;
        java.lang.String str;
        synchronized (this) {
            j = this.mDirtyFlags;
            this.mDirtyFlags = 0;
        }
        com.ebay.nautilus.shell.uxcomponents.viewmodel.SelectionViewModel selectionViewModel = this.mUxContent;
        int i = ((j & 11) > 0 ? 1 : ((j & 11) == 0 ? 0 : -1));
        java.lang.CharSequence charSequence = null;
        charSequence = null;
        boolean z3 = false;
        z3 = false;
        if (i != 0) {
            androidx.databinding.ObservableBoolean observableBoolean = selectionViewModel != null ? selectionViewModel.isSelected : null;
            updateRegistration(0, observableBoolean);
            if (observableBoolean != null) {
                z3 = observableBoolean.get();
            }
            if (i != 0) {
                j |= z3 ? 32 : 16;
            }
            boolean z4 = !z3 ? 1 : 0; // invalid assignment
            if ((j & 10) == 0 || selectionViewModel == null) {
                z = z4;
                str = null;
            } else {
                charSequence = selectionViewModel.getTitle();
                str = selectionViewModel.getTitleContentDescription();
                z = z4;
            }
            z2 = z3 ? 1 : 0; // invalid assignment

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