Search in sources :

Example 1 with VarRef

use of jadx.api.data.annotations.VarRef in project jadx by skylot.

the class JadxDecompiler method convertNode.

@Nullable
JavaNode convertNode(Object obj) {
    if (obj instanceof VarRef) {
        VarRef varRef = (VarRef) obj;
        MethodNode mthNode = varRef.getMth();
        JavaMethod mth = getJavaMethodByNode(mthNode);
        if (mth == null) {
            return null;
        }
        return new JavaVariable(mth, varRef);
    }
    if (!(obj instanceof LineAttrNode)) {
        return null;
    }
    LineAttrNode node = (LineAttrNode) obj;
    if (node.contains(AFlag.DONT_GENERATE)) {
        return null;
    }
    if (obj instanceof ClassNode) {
        return convertClassNode((ClassNode) obj);
    }
    if (obj instanceof MethodNode) {
        return getJavaMethodByNode(((MethodNode) obj));
    }
    if (obj instanceof FieldNode) {
        return getJavaFieldByNode((FieldNode) obj);
    }
    throw new JadxRuntimeException("Unexpected node type: " + obj);
}
Also used : VarRef(jadx.api.data.annotations.VarRef) ClassNode(jadx.core.dex.nodes.ClassNode) LineAttrNode(jadx.core.dex.attributes.nodes.LineAttrNode) MethodNode(jadx.core.dex.nodes.MethodNode) FieldNode(jadx.core.dex.nodes.FieldNode) JadxRuntimeException(jadx.core.utils.exceptions.JadxRuntimeException) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

VarRef (jadx.api.data.annotations.VarRef)1 LineAttrNode (jadx.core.dex.attributes.nodes.LineAttrNode)1 ClassNode (jadx.core.dex.nodes.ClassNode)1 FieldNode (jadx.core.dex.nodes.FieldNode)1 MethodNode (jadx.core.dex.nodes.MethodNode)1 JadxRuntimeException (jadx.core.utils.exceptions.JadxRuntimeException)1 Nullable (org.jetbrains.annotations.Nullable)1