Search in sources :

Example 6 with MethodOverrideAttr

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

the class Deobfuscator method applyMethodAlias.

private void applyMethodAlias(MethodNode mth, String alias) {
    setSingleMethodAlias(mth, alias);
    MethodOverrideAttr overrideAttr = mth.get(AType.METHOD_OVERRIDE);
    if (overrideAttr != null) {
        for (MethodNode ovrdMth : overrideAttr.getRelatedMthNodes()) {
            if (ovrdMth != mth) {
                setSingleMethodAlias(ovrdMth, alias);
            }
        }
    }
}
Also used : MethodNode(jadx.core.dex.nodes.MethodNode) MethodOverrideAttr(jadx.core.dex.attributes.nodes.MethodOverrideAttr)

Example 7 with MethodOverrideAttr

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

the class OverrideMethodVisitor method processMth.

private void processMth(MethodNode mth, SuperTypesData superData) {
    if (mth.isConstructor() || mth.getAccessFlags().isStatic() || mth.getAccessFlags().isPrivate()) {
        return;
    }
    MethodOverrideAttr attr = processOverrideMethods(mth, superData);
    if (attr != null) {
        if (attr.getBaseMethods().isEmpty()) {
            throw new JadxRuntimeException("No base methods for override attribute: " + attr.getOverrideList());
        }
        mth.addAttr(attr);
        IMethodDetails baseMth = Utils.getOne(attr.getBaseMethods());
        if (baseMth != null) {
            boolean updated = fixMethodReturnType(mth, baseMth, superData);
            updated |= fixMethodArgTypes(mth, baseMth, superData);
            if (updated) {
                // check if new signature cause method collisions
                checkMethodSignatureCollisions(mth, mth.root().getArgs().isRenameValid());
            }
        }
    }
}
Also used : JadxRuntimeException(jadx.core.utils.exceptions.JadxRuntimeException) MethodOverrideAttr(jadx.core.dex.attributes.nodes.MethodOverrideAttr) IMethodDetails(jadx.core.dex.nodes.IMethodDetails)

Aggregations

MethodOverrideAttr (jadx.core.dex.attributes.nodes.MethodOverrideAttr)7 MethodNode (jadx.core.dex.nodes.MethodNode)6 AccessInfo (jadx.core.dex.info.AccessInfo)3 ArgType (jadx.core.dex.instructions.args.ArgType)3 IMethodDetails (jadx.core.dex.nodes.IMethodDetails)3 AType (jadx.core.dex.attributes.AType)2 ClassNode (jadx.core.dex.nodes.ClassNode)2 Utils (jadx.core.utils.Utils)2 Collections (java.util.Collections)2 List (java.util.List)2 CommentsLevel (jadx.api.CommentsLevel)1 ICodeWriter (jadx.api.ICodeWriter)1 InsnCodeOffset (jadx.api.data.annotations.InsnCodeOffset)1 VarDeclareRef (jadx.api.data.annotations.VarDeclareRef)1 AccessFlags (jadx.api.plugins.input.data.AccessFlags)1 EncodedValue (jadx.api.plugins.input.data.annotations.EncodedValue)1 JadxAttrType (jadx.api.plugins.input.data.attributes.JadxAttrType)1 AnnotationMethodParamsAttr (jadx.api.plugins.input.data.attributes.types.AnnotationMethodParamsAttr)1 Consts (jadx.core.Consts)1 Jadx (jadx.core.Jadx)1