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] Multi-variable type inference failed (simple test case #2) #695

Closed
bagipro opened this issue Jun 23, 2019 · 3 comments
Closed

[core] Multi-variable type inference failed (simple test case #2) #695

bagipro opened this issue Jun 23, 2019 · 3 comments
Labels
bug Core Issues in jadx-core module

Comments

@bagipro
Copy link
Collaborator

bagipro commented Jun 23, 2019

Hi, here is an example of one more pretty simple code that produces this issue in class com.grab.pax.api.model.MultiPoi

    /* JADX WARNING: type inference failed for: r0v2, types: [java.util.Map$Entry, java.lang.Object] */
    /* JADX WARNING: Multi-variable type inference failed. Error: jadx.core.utils.exceptions.JadxRuntimeException: No candidate types for var: r0v2, types: [java.util.Map$Entry, java.lang.Object]
      assigns: [java.lang.Object]
      uses: [java.util.Map$Entry]
      mth insns count: 18
    	at jadx.core.dex.visitors.typeinference.TypeSearch.fillTypeCandidates(TypeSearch.java:237)
    	at java.base/java.util.ArrayList.forEach(ArrayList.java:1540)
    	at jadx.core.dex.visitors.typeinference.TypeSearch.run(TypeSearch.java:53)
    	at jadx.core.dex.visitors.typeinference.TypeInferenceVisitor.runMultiVariableSearch(TypeInferenceVisitor.java:99)
    	at jadx.core.dex.visitors.typeinference.TypeInferenceVisitor.visit(TypeInferenceVisitor.java:92)
    	at jadx.core.dex.visitors.DepthTraversal.visit(DepthTraversal.java:27)
    	at jadx.core.dex.visitors.DepthTraversal.lambda$visit$1(DepthTraversal.java:14)
    	at java.base/java.util.ArrayList.forEach(ArrayList.java:1540)
    	at jadx.core.dex.visitors.DepthTraversal.visit(DepthTraversal.java:14)
    	at jadx.core.ProcessClass.process(ProcessClass.java:30)
    	at jadx.core.ProcessClass.lambda$processDependencies$0(ProcessClass.java:49)
    	at java.base/java.util.ArrayList.forEach(ArrayList.java:1540)
    	at jadx.core.ProcessClass.processDependencies(ProcessClass.java:49)
    	at jadx.core.ProcessClass.process(ProcessClass.java:35)
    	at jadx.api.JadxDecompiler.processClass(JadxDecompiler.java:311)
    	at jadx.api.JavaClass.decompile(JavaClass.java:62)
    	at jadx.api.JadxDecompiler.lambda$appendSourcesSave$0(JadxDecompiler.java:217)
     */
    /* JADX WARNING: Unknown variable types count: 1 */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public void writeToParcel(android.os.Parcel parcel, int i) {
        p343e.p345f.p347b.C5608m.m19675b(parcel, "parcel");
        java.util.Map<java.lang.Integer, com.grab.pax.api.model.Poi> map = this.poiMap;
        parcel.writeInt(map.size());
        for (? next : map.entrySet()) {
            parcel.writeInt(((java.lang.Integer) next.getKey()).intValue());
            ((com.grab.pax.api.model.Poi) next.getValue()).writeToParcel(parcel, 0);
        }
    }

And a simpler test case for different issue in the same class :)

    /* JADX WARNING: Code restructure failed: missing block: B:4:0x0010, code lost:
        if (p343e.p345f.p347b.C5608m.m19673a((java.lang.Object) r1.poiMap, (java.lang.Object) ((com.grab.pax.api.model.MultiPoi) r2).poiMap) != false) goto L_0x0015;
     */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public boolean equals(java.lang.Object obj) {
        if (this != obj) {
            if (obj instanceof com.grab.pax.api.model.MultiPoi) {
            }
            return false;
        }
        return true;
    }

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

@bagipro bagipro added bug Core Issues in jadx-core module labels Jun 23, 2019
@skylot
Copy link
Owner

skylot commented Jul 6, 2019

@sergey-wowwow I commit an initial version of generic types propagation, this fixes the first case :)

@skylot
Copy link
Owner

skylot commented Jul 7, 2019

@sergey-wowwow commit fix for the second case

@skylot skylot closed this as completed Jul 7, 2019
@bagipro
Copy link
Collaborator Author

bagipro commented Jul 7, 2019

Thanks! But looks like package com.grab.rewards.models contains a lot of small methods which are incorrectly decompiled. I will file a new report to don't miss in old codes

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