Class ProcessAnonymous

java.lang.Object
jadx.core.dex.visitors.AbstractVisitor
jadx.core.dex.visitors.ProcessAnonymous
All Implemented Interfaces:
IDexTreeVisitor

public class ProcessAnonymous extends AbstractVisitor
  • Field Details

    • inlineAnonymousClasses

      private boolean inlineAnonymousClasses
  • Constructor Details

    • ProcessAnonymous

      public ProcessAnonymous()
  • Method Details

    • init

      public void init(RootNode root)
      Description copied from interface: IDexTreeVisitor
      Called after loading dex tree, but before visitor traversal.
      Specified by:
      init in interface IDexTreeVisitor
      Overrides:
      init in class AbstractVisitor
    • visit

      public boolean visit(ClassNode cls) throws JadxException
      Description copied from interface: IDexTreeVisitor
      Visit class
      Specified by:
      visit in interface IDexTreeVisitor
      Overrides:
      visit in class AbstractVisitor
      Returns:
      false for disable child methods and inner classes traversal
      Throws:
      JadxException
    • visitClassAndInners

      private void visitClassAndInners(ClassNode cls)
    • processClass

      private static void processClass(ClassNode cls)
    • markAnonymousClass

      private static void markAnonymousClass(ClassNode cls)
    • undoAnonymousMark

      private static void undoAnonymousMark(ClassNode cls)
    • mergeAnonymousDeps

      private void mergeAnonymousDeps(RootNode root)
    • updateDeps

      private void updateDeps(ClassNode leafCls, Map<ClassNode,ClassNode> inlineMap, Set<ClassNode> added)
    • canBeAnonymous

      private static boolean canBeAnonymous(ClassNode cls)
    • checkUsage

      private static AnonymousClassAttr.InlineType checkUsage(ClassNode cls, MethodNode ctr)
      Checks: - class have only one constructor which used only once (allow common code for field init) - methods or fields not used outside (allow only nested inner classes with synthetic usage) - if constructor used only in class init check if possible inline by instance field
      Returns:
      decided inline type
    • checkMethodsUsage

      private static boolean checkMethodsUsage(ClassNode cls, MethodNode ctr, MethodNode ctrUseMth)
    • checkForInstanceFieldUsage

      private static boolean checkForInstanceFieldUsage(ClassNode cls, MethodNode ctr)
    • badMethodUsage

      private static boolean badMethodUsage(ClassNode cls, MethodNode useMth, AccessInfo accessFlags)
    • checkForCommonFieldInit

      private static boolean checkForCommonFieldInit(MethodNode ctrMth)
      Checks: + all in constructors + all usage in one class - same field put (ignored: methods not loaded yet)
    • getBaseType

      @Nullable private static @Nullable ArgType getBaseType(ClassNode cls)
    • getName

      public String getName()
      Description copied from interface: IDexTreeVisitor
      Visitor short id
      Specified by:
      getName in interface IDexTreeVisitor
      Overrides:
      getName in class AbstractVisitor