Search in sources :

Example 1 with JavaClass

use of jadx.api.JavaClass in project jadx by skylot.

the class CodeLinesInfo method addClass.

public void addClass(JavaClass cls) {
    map.put(cls.getDecompiledLine(), cls);
    for (JavaClass innerCls : cls.getInnerClasses()) {
        map.put(innerCls.getDecompiledLine(), innerCls);
        addClass(innerCls);
    }
    for (JavaMethod mth : cls.getMethods()) {
        map.put(mth.getDecompiledLine(), mth);
    }
}
Also used : JavaClass(jadx.api.JavaClass) JavaMethod(jadx.api.JavaMethod)

Example 2 with JavaClass

use of jadx.api.JavaClass in project jadx by skylot.

the class TextSearchIndex method addSkippedClasses.

private void addSkippedClasses(List<CodeNode> list, String text) {
    for (JavaClass javaClass : skippedClasses) {
        String code = javaClass.getCode();
        int pos = 0;
        while (pos != -1) {
            pos = searchNext(list, text, javaClass, code, pos);
        }
        if (list.size() > CommonSearchDialog.MAX_RESULTS_COUNT) {
            return;
        }
    }
}
Also used : JavaClass(jadx.api.JavaClass)

Example 3 with JavaClass

use of jadx.api.JavaClass in project jadx by skylot.

the class JClass method update.

public synchronized void update() {
    removeAllChildren();
    if (!loaded) {
        add(new TextNode(NLS.str("tree.loading")));
    } else {
        for (JavaClass javaClass : cls.getInnerClasses()) {
            JClass innerCls = new JClass(javaClass, this);
            add(innerCls);
            innerCls.update();
        }
        for (JavaField f : cls.getFields()) {
            add(new JField(f, this));
        }
        for (JavaMethod m : cls.getMethods()) {
            add(new JMethod(m, this));
        }
    }
}
Also used : JavaField(jadx.api.JavaField) JavaClass(jadx.api.JavaClass) JavaMethod(jadx.api.JavaMethod)

Example 4 with JavaClass

use of jadx.api.JavaClass in project jadx by skylot.

the class QuarkReportPanel method resolveMethod.

public MutableTreeNode resolveMethod(String descr) {
    try {
        String[] parts = removeQuotes(descr).split(" ", 3);
        String cls = Utils.cleanObjectName(parts[0].replace('$', '.'));
        String mth = parts[1] + parts[2].replace(" ", "");
        MainWindow mainWindow = getTabbedPane().getMainWindow();
        JadxWrapper wrapper = mainWindow.getWrapper();
        JavaClass javaClass = wrapper.searchJavaClassByRawName(cls);
        if (javaClass == null) {
            return new TextTreeNode(cls + "." + mth);
        }
        JavaMethod javaMethod = javaClass.searchMethodByShortId(mth);
        if (javaMethod == null) {
            return new TextTreeNode(javaClass.getFullName() + "." + mth);
        }
        return new MethodTreeNode(javaMethod);
    } catch (Exception e) {
        LOG.error("Failed to parse method descriptor string", e);
        return new TextTreeNode(descr);
    }
}
Also used : JadxWrapper(jadx.gui.JadxWrapper) JavaClass(jadx.api.JavaClass) MainWindow(jadx.gui.ui.MainWindow) JavaMethod(jadx.api.JavaMethod)

Example 5 with JavaClass

use of jadx.api.JavaClass in project jadx by skylot.

the class DecompileTask method scheduleJobs.

@Override
public List<Runnable> scheduleJobs() {
    IndexService indexService = mainWindow.getCacheObject().getIndexService();
    List<JavaClass> classes = wrapper.getIncludedClasses();
    expectedCompleteCount = classes.size();
    indexService.setComplete(false);
    complete.set(0);
    List<List<JavaClass>> batches;
    try {
        batches = wrapper.buildDecompileBatches(classes);
    } catch (Exception e) {
        LOG.error("Decompile batches build error", e);
        return Collections.emptyList();
    }
    List<Runnable> jobs = new ArrayList<>(batches.size());
    for (List<JavaClass> batch : batches) {
        jobs.add(() -> {
            for (JavaClass cls : batch) {
                try {
                    cls.decompile();
                } catch (Throwable e) {
                    LOG.error("Failed to decompile class: {}", cls, e);
                } finally {
                    complete.incrementAndGet();
                }
            }
        });
    }
    return jobs;
}
Also used : JavaClass(jadx.api.JavaClass) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList)

Aggregations

JavaClass (jadx.api.JavaClass)20 JavaMethod (jadx.api.JavaMethod)7 JavaField (jadx.api.JavaField)5 JavaNode (jadx.api.JavaNode)3 JNode (jadx.gui.treemodel.JNode)3 CodePosition (jadx.api.CodePosition)2 JClass (jadx.gui.treemodel.JClass)2 CodeLinesInfo (jadx.gui.utils.CodeLinesInfo)2 JNodeCache (jadx.gui.utils.JNodeCache)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Nullable (org.jetbrains.annotations.Nullable)2 JavaVariable (jadx.api.JavaVariable)1 IJavaNodeRef (jadx.api.data.IJavaNodeRef)1 ICodeRawOffset (jadx.api.data.annotations.ICodeRawOffset)1 JadxRuntimeException (jadx.core.utils.exceptions.JadxRuntimeException)1 JadxWrapper (jadx.gui.JadxWrapper)1 CodeNode (jadx.gui.treemodel.CodeNode)1 JField (jadx.gui.treemodel.JField)1 JMethod (jadx.gui.treemodel.JMethod)1