Search in sources :

Example 1 with InheritanceEdge

use of org.mapleir.app.service.ClassTree.InheritanceEdge in project maple-ir by LLVM-but-worse.

the class ClassTree method addVertex.

@Override
public boolean addVertex(ClassNode cn) {
    if (cn == null) {
        LOGGER.error("Received null to ClassTree.addVertex");
        return false;
    }
    if (!super.addVertex(cn))
        return false;
    if (cn != rootNode) {
        Set<InheritanceEdge> edges = new HashSet<>();
        ClassNode sup = cn.node.superName != null ? requestClass0(cn.node.superName, cn.getName()) : rootNode;
        if (sup == null) {
            LOGGER.error(String.format("No superclass %s for %s", cn.node.superName, cn.getName()));
            removeVertex(cn);
            return false;
        }
        edges.add(new ExtendsEdge(cn, sup));
        for (String s : cn.node.interfaces) {
            ClassNode iface = requestClass0(s, cn.getName());
            if (iface == null) {
                LOGGER.error(String.format("No superinterface %s for %s", s, cn.getName()));
                removeVertex(cn);
                return false;
            }
            edges.add(new ImplementsEdge(cn, iface));
        }
        for (InheritanceEdge e : edges) {
            super.addEdge(e);
        }
    }
    return true;
}
Also used : InheritanceEdge(org.mapleir.app.service.ClassTree.InheritanceEdge) ClassNode(org.mapleir.asm.ClassNode)

Example 2 with InheritanceEdge

use of org.mapleir.app.service.ClassTree.InheritanceEdge in project maple-ir by LLVM-but-worse.

the class ClassTree method blockToString.

public static void blockToString(TabbedStringWriter sw, ClassTree ct, ClassNode cn) {
    sw.print(String.format("%s", cn.getDisplayName()));
    sw.tab();
    for (InheritanceEdge e : ct.getEdges(cn)) {
        sw.print("\n^ " + e.toString());
    }
    for (InheritanceEdge p : ct.getReverseEdges(cn)) {
        sw.print("\nV " + p.toString());
    }
    sw.untab();
    sw.print("\n");
}
Also used : InheritanceEdge(org.mapleir.app.service.ClassTree.InheritanceEdge)

Aggregations

InheritanceEdge (org.mapleir.app.service.ClassTree.InheritanceEdge)2 ClassNode (org.mapleir.asm.ClassNode)1