Search in sources :

Example 6 with IDexTreeVisitor

use of jadx.core.dex.visitors.IDexTreeVisitor in project jadx by skylot.

the class ProcessClass method process.

public static void process(ClassNode cls, List<IDexTreeVisitor> passes, @Nullable CodeGen codeGen) {
    if (codeGen == null && cls.getState() == PROCESSED) {
        return;
    }
    synchronized (cls) {
        try {
            if (cls.getState() == NOT_LOADED) {
                cls.load();
                cls.setState(STARTED);
                for (IDexTreeVisitor visitor : passes) {
                    DepthTraversal.visit(visitor, cls);
                }
                cls.setState(PROCESSED);
            }
            if (cls.getState() == PROCESSED && codeGen != null) {
                processDependencies(cls, passes);
                codeGen.visit(cls);
                cls.setState(GENERATED);
            }
        } catch (Exception e) {
            ErrorsCounter.classError(cls, e.getClass().getSimpleName(), e);
        } finally {
            if (cls.getState() == GENERATED) {
                cls.unload();
                cls.setState(UNLOADED);
            }
        }
    }
}
Also used : IDexTreeVisitor(jadx.core.dex.visitors.IDexTreeVisitor)

Aggregations

IDexTreeVisitor (jadx.core.dex.visitors.IDexTreeVisitor)6 File (java.io.File)3 CodeGen (jadx.core.codegen.CodeGen)2 ArrayList (java.util.ArrayList)2 JadxArgs (jadx.api.JadxArgs)1 ClassModifier (jadx.core.dex.visitors.ClassModifier)1 CodeShrinker (jadx.core.dex.visitors.CodeShrinker)1 ConstInlineVisitor (jadx.core.dex.visitors.ConstInlineVisitor)1 DebugInfoVisitor (jadx.core.dex.visitors.DebugInfoVisitor)1 DependencyCollector (jadx.core.dex.visitors.DependencyCollector)1 EnumVisitor (jadx.core.dex.visitors.EnumVisitor)1 ExtractFieldInit (jadx.core.dex.visitors.ExtractFieldInit)1 FallbackModeVisitor (jadx.core.dex.visitors.FallbackModeVisitor)1 JadxVisitor (jadx.core.dex.visitors.JadxVisitor)1 MethodInlineVisitor (jadx.core.dex.visitors.MethodInlineVisitor)1 ModVisitor (jadx.core.dex.visitors.ModVisitor)1 PrepareForCodeGen (jadx.core.dex.visitors.PrepareForCodeGen)1 ReSugarCode (jadx.core.dex.visitors.ReSugarCode)1 RenameVisitor (jadx.core.dex.visitors.RenameVisitor)1 SimplifyVisitor (jadx.core.dex.visitors.SimplifyVisitor)1