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] Failed to find minimal casts for resolve overloaded methods #856

Closed
bagipro opened this issue Feb 17, 2020 · 4 comments
Closed

[core] Failed to find minimal casts for resolve overloaded methods #856

bagipro opened this issue Feb 17, 2020 · 4 comments
Labels
bug Core Issues in jadx-core module

Comments

@bagipro
Copy link
Collaborator

bagipro commented Feb 17, 2020

Hi, seems that this issue was caused by a recent commit
Example in class com.ludashi.dualspace.util.pref.SharedPrefProvider

    /* JADX DEBUG: Failed to find minimal casts for resolve overloaded methods, cast all args instead
     method: ClspMth{android.content.ContentValues.put(java.lang.String, java.lang.Integer):void}
     arg types: [java.lang.String, int]
     candidates:
      ClspMth{android.content.ContentValues.put(java.lang.String, java.lang.Byte):void}
      ClspMth{android.content.ContentValues.put(java.lang.String, java.lang.Float):void}
      ClspMth{android.content.ContentValues.put(java.lang.String, java.lang.String):void}
      ClspMth{android.content.ContentValues.put(java.lang.String, java.lang.Long):void}
      ClspMth{android.content.ContentValues.put(java.lang.String, java.lang.Boolean):void}
      ClspMth{android.content.ContentValues.put(java.lang.String, byte[]):void}
      ClspMth{android.content.ContentValues.put(java.lang.String, java.lang.Double):void}
      ClspMth{android.content.ContentValues.put(java.lang.String, java.lang.Short):void}
      ClspMth{android.content.ContentValues.put(java.lang.String, java.lang.Integer):void} */
    /* renamed from: b */
    public static java.lang.String m12990b(java.lang.String str, java.lang.String str2, java.lang.String str3) {
        android.net.Uri insert;
        android.content.ContentValues contentValues = new android.content.ContentValues();
        contentValues.put(f9944c, (java.lang.Integer) 4);
        contentValues.put(f9945d, str);
        contentValues.put(f9946e, str2);
        contentValues.put(f9947f, str3);
        try {
            if (m12981a() == null || (insert = m12981a().insert(f9942a, contentValues)) == null) {
                return str2;
            }
            return java.lang.String.valueOf(insert.toString().substring(f9943b));
        } catch (java.lang.Exception e) {
            return str2;
        }
    }

APK: https://drive.google.com/file/d/17DWQeByOGkCFdEC6h1yQzMSDpuhO5Fcx/view?usp=sharing

@bagipro bagipro added bug Core Issues in jadx-core module labels Feb 17, 2020
@bagipro
Copy link
Collaborator Author

bagipro commented Feb 25, 2020

Another simpler example is in class com.ss.a.b.h

package com.ss.p678a.p680b;

/* renamed from: com.ss.a.b.h */
public class C14932h {
    /* JADX DEBUG: Failed to find minimal casts for resolve overloaded methods, cast all args instead
     method: ClspMth{java.lang.String.replace(char, char):java.lang.String}
     arg types: [int, int]
     candidates:
      ClspMth{java.lang.String.replace(java.lang.CharSequence, java.lang.CharSequence):java.lang.String}
      ClspMth{java.lang.String.replace(char, char):java.lang.String} */
    /* renamed from: a */
    public static java.lang.String m20842a(java.lang.String str) {
        return (str == null || str.length() <= 0) ? "" : str.trim().replace('\'', ' ').replace('\"', ' ').replace(13, ' ').replace(10, ' ');
    }
}

in this case value 13 should be casted to char, because of that the method cannot be resolved
APK: https://drive.google.com/file/d/1wrBR3UgxGNoIpSMmuyqEC1fXcgiFmJvq/view?usp=sharing

@bagipro
Copy link
Collaborator Author

bagipro commented Jul 16, 2020

@skylot
Let's fix this one please. It's very popular issue, must be number 1 among all existing errors

@skylot
Copy link
Owner

skylot commented Jul 20, 2020

@sergey-wowwow second case is fixed.
In the first case, I don't see errors in code. Actually, the big jadx comment has 'debug' severity and it is just a reminder for me to make code better. The fallback solution here just adds unnecessary cast ((java.lang.Integer) 4), this is safe and not critical for now. Anyway, I hide this comment, so it will not bloat code anymore :)

@skylot skylot closed this as completed Jul 20, 2020
@bagipro
Copy link
Collaborator Author

bagipro commented Jul 20, 2020

@skylot
Thanks! Looks like fixed all char related cases without errors :)

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