Search in sources :

Example 1 with MethodBridgeAttr

use of jadx.core.dex.attributes.nodes.MethodBridgeAttr in project jadx by skylot.

the class MethodUtils method getMethodOriginDeclClass.

public ClassInfo getMethodOriginDeclClass(MethodNode mth) {
    IMethodDetails baseMth = getOverrideBaseMth(mth);
    if (baseMth != null) {
        return baseMth.getMethodInfo().getDeclClass();
    }
    MethodBridgeAttr bridgeAttr = mth.get(AType.BRIDGED_BY);
    if (bridgeAttr != null) {
        return getMethodOriginDeclClass(bridgeAttr.getBridgeMth());
    }
    return mth.getMethodInfo().getDeclClass();
}
Also used : MethodBridgeAttr(jadx.core.dex.attributes.nodes.MethodBridgeAttr) IMethodDetails(jadx.core.dex.nodes.IMethodDetails)

Example 2 with MethodBridgeAttr

use of jadx.core.dex.attributes.nodes.MethodBridgeAttr in project jadx by skylot.

the class OverrideMethodVisitor method checkMethodSignatureCollisions.

private void checkMethodSignatureCollisions(MethodNode mth, boolean rename) {
    String mthName = mth.getMethodInfo().getAlias();
    String newSignature = MethodInfo.makeShortId(mthName, mth.getArgTypes(), null);
    for (MethodNode otherMth : mth.getParentClass().getMethods()) {
        String otherMthName = otherMth.getAlias();
        if (otherMthName.equals(mthName) && otherMth != mth) {
            String otherSignature = otherMth.getMethodInfo().makeSignature(true, false);
            if (otherSignature.equals(newSignature)) {
                if (rename) {
                    if (otherMth.contains(AFlag.DONT_RENAME) || otherMth.contains(AType.METHOD_OVERRIDE)) {
                        otherMth.addWarnComment("Can't rename method to resolve collision");
                    } else {
                        otherMth.getMethodInfo().setAlias(makeNewAlias(otherMth));
                        otherMth.addAttr(new RenameReasonAttr("avoid collision after fix types in other method"));
                    }
                }
                otherMth.addAttr(new MethodBridgeAttr(mth));
                return;
            }
        }
    }
}
Also used : MethodNode(jadx.core.dex.nodes.MethodNode) RenameReasonAttr(jadx.core.dex.attributes.nodes.RenameReasonAttr) MethodBridgeAttr(jadx.core.dex.attributes.nodes.MethodBridgeAttr)

Aggregations

MethodBridgeAttr (jadx.core.dex.attributes.nodes.MethodBridgeAttr)2 RenameReasonAttr (jadx.core.dex.attributes.nodes.RenameReasonAttr)1 IMethodDetails (jadx.core.dex.nodes.IMethodDetails)1 MethodNode (jadx.core.dex.nodes.MethodNode)1