Package jadx.core.dex.info

Examples of jadx.core.dex.info.AccessInfo


  private static void removeSyntheticMethods(ClassNode cls) {
    for (MethodNode mth : cls.getMethods()) {
      if (mth.isNoCode()) {
        continue;
      }
      AccessInfo af = mth.getAccessFlags();
      // remove bridge methods
      if (af.isBridge() && af.isSynthetic() && !isMethodUniq(cls, mth)) {
        // TODO add more checks before method deletion
        mth.add(AFlag.DONT_GENERATE);
      }
      // remove synthetic constructor for inner non-static classes
      if (af.isSynthetic() && af.isConstructor() && mth.getBasicBlocks().size() == 2) {
        List<InsnNode> insns = mth.getBasicBlocks().get(0).getInstructions();
        if (insns.size() == 1 && insns.get(0).getType() == InsnType.CONSTRUCTOR) {
          ConstructorInsn constr = (ConstructorInsn) insns.get(0);
          if (constr.isThis() && !mth.getArguments(false).isEmpty()) {
            mth.removeFirstArgument();
View Full Code Here


    return true;
  }

  private static void removeEmptyMethods(ClassNode cls) {
    for (MethodNode mth : cls.getMethods()) {
      AccessInfo af = mth.getAccessFlags();

      // remove public empty constructors
      if (af.isConstructor()
          && af.isPublic()
          && mth.getArguments(false).isEmpty()) {
        List<BlockNode> bb = mth.getBasicBlocks();
        if (bb == null || bb.isEmpty() || allBlocksEmpty(bb)) {
          mth.add(AFlag.DONT_GENERATE);
        }
View Full Code Here

  private List<LoopInfo> loops = Collections.emptyList();

  public MethodNode(ClassNode classNode, Method mthData) {
    this.mthInfo = MethodInfo.fromDex(classNode.dex(), mthData.getMethodIndex());
    this.parentClass = classNode;
    this.accFlags = new AccessInfo(mthData.getAccessFlags(), AFType.METHOD);
    this.noCode = (mthData.getCodeOffset() == 0);
    this.methodData = (noCode ? null : mthData);
  }
View Full Code Here

    return cls.getCode();
  }

  @Override
  public Icon getIcon() {
    AccessInfo accessInfo = cls.getAccessInfo();
    if (accessInfo.isEnum()) {
      return ICON_ENUM;
    }
    if (accessInfo.isAnnotation()) {
      return ICON_ANNOTATION;
    }
    if (accessInfo.isInterface()) {
      return ICON_INTERFACE;
    }
    if (accessInfo.isProtected()) {
      return ICON_CLASS_PROTECTED;
    }
    if (accessInfo.isPrivate()) {
      return ICON_CLASS_PRIVATE;
    }
    if (accessInfo.isPublic()) {
      return ICON_CLASS;
    }
    return ICON_CLASS_DEFAULT;
  }
View Full Code Here

  public FieldNode(ClassNode cls, Field field) {
    this.parent = cls;
    this.fieldInfo = FieldInfo.fromDex(cls.dex(), field.getFieldIndex());
    this.type = fieldInfo.getType();
    this.accFlags = new AccessInfo(field.getAccessFlags(), AFType.FIELD);
  }
View Full Code Here

*/
public class MethodInlineVisitor extends AbstractVisitor {

  @Override
  public void visit(MethodNode mth) throws JadxException {
    AccessInfo accessFlags = mth.getAccessFlags();
    if (accessFlags.isSynthetic()
        && accessFlags.isStatic()
        && mth.getBasicBlocks().size() == 2) {
      BlockNode block = mth.getBasicBlocks().get(1);
      if (block.getInstructions().isEmpty()
          || block.contains(AFlag.RETURN)) {
        inlineMth(mth);
View Full Code Here

      if (a != null) {
        accFlagsValue = (Integer) a.getValues().get("accessFlags");
      } else {
        accFlagsValue = cls.getAccessFlags();
      }
      this.accessFlags = new AccessInfo(accFlagsValue, AFType.CLASS);

    } catch (Exception e) {
      throw new DecodeException("Error decode class: " + getFullName(), e);
    }
  }
View Full Code Here

    if (offset != 0) {
      StaticValuesParser parser = new StaticValuesParser(dex, dex.openSection(offset));
      int count = parser.processFields(staticFields);
      constFields = new LinkedHashMap<Object, FieldNode>(count);
      for (FieldNode f : staticFields) {
        AccessInfo accFlags = f.getAccessFlags();
        if (accFlags.isStatic() && accFlags.isFinal()) {
          FieldValueAttr fv = f.get(AType.FIELD_VALUE);
          if (fv != null && fv.getValue() != null) {
            if (accFlags.isPublic()) {
              dex.getConstFields().put(fv.getValue(), f);
            }
            constFields.put(fv.getValue(), f);
          }
        }
View Full Code Here

  /**
   * If all static final synthetic fields have DONT_GENERATE => hide whole class
   */
  private static void checkAndHideClass(ClassNode cls) {
    for (FieldNode field : cls.getFields()) {
      AccessInfo af = field.getAccessFlags();
      if (af.isSynthetic() && af.isStatic() && af.isFinal()
          && !field.contains(AFlag.DONT_GENERATE)) {
        return;
      }
    }
    cls.add(AFlag.DONT_GENERATE);
View Full Code Here

    return mth.getDecompiledLine();
  }

  @Override
  public Icon getIcon() {
    AccessInfo accessFlags = mth.getAccessFlags();
    OverlayIcon icon = Utils.makeIcon(accessFlags, ICON_MTH_PUB, ICON_MTH_PRI, ICON_MTH_PRO, ICON_MTH_DEF);
    if (accessFlags.isConstructor()) {
      icon.add(ICON_CONSTRUCTOR);
    }
    if (accessFlags.isSynchronized()) {
      icon.add(ICON_SYNC);
    }
    return icon;
  }
View Full Code Here

TOP

Related Classes of jadx.core.dex.info.AccessInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.