Package jadx.core.dex.nodes

Examples of jadx.core.dex.nodes.ClassNode


    }
  }

  @Test
  public void test() {
    ClassNode cls = getClassNode(TestCls.class);
    String code = cls.getCode().toString();

    assertThat(code, countString(2, "try {"));
    assertThat(code, containsOne("if ("));
    assertThat(code, countString(2, "return f();"));
  }
View Full Code Here


    Map<CodePosition, Object> map = getCodeAnnotations();
    Object obj = map.get(new CodePosition(line, offset));
    if (!(obj instanceof LineAttrNode)) {
      return null;
    }
    ClassNode clsNode = null;
    if (obj instanceof ClassNode) {
      clsNode = (ClassNode) obj;
    } else if (obj instanceof MethodNode) {
      clsNode = ((MethodNode) obj).getParentClass();
    } else if (obj instanceof FieldNode) {
      clsNode = ((FieldNode) obj).getParentClass();
    }
    if (clsNode == null) {
      return null;
    }
    clsNode = clsNode.getTopParentClass();
    JavaClass jCls = decompiler.findJavaClass(clsNode);
    if (jCls == null) {
      return null;
    }
    jCls.decompile();
View Full Code Here

    }
  }

  @Test
  public void test() {
    ClassNode cls = getClassNode(TestCls.class);
    String code = cls.getCode().toString();

    assertThat(code, not(containsString("public static final String s2 = null;")));
    // TODO:
    // assertThat(code, containsString("public static final String s3 = null;"));
  }
View Full Code Here

    }
  }

  @Test
  public void test() {
    ClassNode cls = getClassNode(TestCls.class);
    String code = cls.getCode().toString();

    FieldNode field = cls.searchFieldByName("field");
    MethodNode func = cls.searchMethodByName("func()V");
    ClassNode inner = cls.getInnerClasses().get(0);
    MethodNode innerFunc = inner.searchMethodByName("innerFunc()V");
    MethodNode innerFunc2 = inner.searchMethodByName("innerFunc2()V");
    MethodNode innerFunc3 = inner.searchMethodByName("innerFunc3()V");
    FieldNode innerField = inner.searchFieldByName("innerField");

    // check source lines (available only for instructions and methods)
    int testClassLine = 18;
    assertEquals(testClassLine + 3, func.getSourceLine());
    assertEquals(testClassLine + 9, innerFunc.getSourceLine());
View Full Code Here

    }
  }

  @Test
  public void test() {
    ClassNode cls = getClassNode(MyException.class);
    String code = cls.getCode().toString();

    assertThat(code, containsString("MyException(String str, Exception e) {"));
    assertThat(code, containsString("super(\"msg:\" + str, e);"));

    assertThat(code, not(containsString("new StringBuilder")));
View Full Code Here

    }
  }

  @Test
  public void test() {
    ClassNode cls = getClassNode(TestCls.class);
    String code = cls.getCode().toString();

    assertThat(code, containsOne("if (a != 0) {"));
    assertThat(code, containsOne("} catch (Exception e) {"));
    assertThat(code, countString(2, "try {"));
    assertThat(code, countString(3, "f()"));
View Full Code Here

    }
  }

  @Test
  public void test() {
    ClassNode cls = getClassNode(TestCls.class);
    String code = cls.getCode().toString();

    assertThat(code, countString(4, "} catch ("));
    assertThat(code, countString(3, "Log.e("));

    assertThat(code, containsOne("Thread.currentThread().interrupt();"));
View Full Code Here

    }
  }

  @Test
  public void test() {
    ClassNode cls = getClassNode(TestCls.class);
    String code = cls.getCode().toString();

    assertThat(code, containsLines(2,
        "int sum = 0;",
        "for (int i = 0; i < b; i++) {",
        indent(1) + "sum += a[i];",
View Full Code Here

    }
  }

  @Test
  public void test() {
    ClassNode cls = getClassNode(TestCls.class);
    String code = cls.getCode().toString();

    assertThat(code, containsString("private static synchronized boolean test(Object obj) {"));
    assertThat(code, containsString("obj.toString() != null;"));
    // TODO
//    assertThat(code, containsString("return obj.toString() != null;"));
View Full Code Here

  @Test
  public void test() {
    setFallback();
    disableCompilation();

    ClassNode cls = getClassNode(TestCls.class);
    String code = cls.getCode().toString();

    assertThat(code, containsString("public int test(int r2) {"));
    assertThat(code, containsString("r1_this = this;"));
    assertThat(code, containsString("L_0x0004:"));
    assertThat(code, not(containsString("throw new UnsupportedOperationException")));
View Full Code Here

TOP

Related Classes of jadx.core.dex.nodes.ClassNode

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.