Examples of ClassDef


Examples of org.jf.dexlib2.iface.ClassDef

        ImmutableMethodImplementation methodImpl = new ImmutableMethodImplementation(1, instructions, null, null);
        ImmutableMethod method = new ImmutableMethod("Lblah;", "blah", null, "V", AccessFlags.STATIC.getValue(), null,
                methodImpl);

        ClassDef classDef = new ImmutableClassDef("Lblah;", AccessFlags.PUBLIC.getValue(), "Ljava/lang/Object;", null,
                null, null, null, null, ImmutableList.of(method), null);

        DexFile dexFile = new ImmutableDexFile(ImmutableList.of(classDef));

        ClassPath classPath = ClassPath.fromClassPath(ImmutableList.<String>of(), ImmutableList.<String>of(), dexFile,
View Full Code Here

Examples of org.jf.dexlib2.iface.ClassDef

        ImmutableMethodImplementation methodImpl = new ImmutableMethodImplementation(1, instructions, null, null);
        ImmutableMethod method = new ImmutableMethod("Lblah;", "blah", null, "V", AccessFlags.PRIVATE.getValue(), null,
                methodImpl);

        ClassDef classDef = new ImmutableClassDef("Lblah;", AccessFlags.PUBLIC.getValue(), "Ljava/lang/Object;", null,
                null, null, null, null, ImmutableList.of(method), null);

        DexFile dexFile = new ImmutableDexFile(ImmutableList.of(classDef));

        ClassPath classPath = ClassPath.fromClassPath(ImmutableList.<String>of(), ImmutableList.<String>of(), dexFile,
View Full Code Here

Examples of org.jf.dexlib2.iface.ClassDef

        } catch (IOException ex) {
            throw new RuntimeException(ex);
        }

        DexBackedDexFile dexFile = new DexBackedDexFile(new Opcodes(15), dataStore.getData());
        ClassDef dbClassDef = Iterables.getFirst(dexFile.getClasses(), null);
        Assert.assertNotNull(dbClassDef);
        Annotation dbAnnotation = Iterables.getFirst(dbClassDef.getAnnotations(), null);
        Assert.assertNotNull(dbAnnotation);
        List<AnnotationElement> dbElements = Lists.newArrayList(dbAnnotation.getElements());

        // Ensure that the elements were written out in sorted order
        Assert.assertEquals(2, dbElements.size());
View Full Code Here

Examples of org.jf.dexlib2.iface.ClassDef

        Assert.assertNotNull(url);
        DexFile f = DexFileFactory.loadDexFile(url.getFile(), 15);

        SyntheticAccessorResolver sar = new SyntheticAccessorResolver(f.getClasses());

        ClassDef accessorTypesClass = null;
        ClassDef accessorsClass = null;

        for (ClassDef classDef: f.getClasses()) {
            String className = classDef.getType();

            if (className.equals("Lorg/jf/dexlib2/AccessorTypes;")) {
                accessorTypesClass = classDef;
            } else if (className.equals("Lorg/jf/dexlib2/AccessorTypes$Accessors;")) {
                accessorsClass = classDef;
            }
        }

        Assert.assertNotNull(accessorTypesClass);
        Assert.assertNotNull(accessorsClass);

        for (Method method: accessorsClass.getMethods()) {
            Matcher m = accessorMethodPattern.matcher(method.getName());
            if (!m.matches()) {
                continue;
            }
            String type = m.group(1);
View Full Code Here

Examples of org.jf.dexlib2.iface.ClassDef

public class SuperclassChainTest {


    @Test
    public void testGetSuperclassChain() throws IOException {
        ClassDef objectClassDef = TestUtils.makeClassDef("Ljava/lang/Object;", null);
        ClassDef oneClassDef = TestUtils.makeClassDef("Ltest/one;", "Ljava/lang/Object;");
        ClassDef twoClassDef = TestUtils.makeClassDef("Ltest/two;", "Ltest/one;");
        ClassDef threeClassDef = TestUtils.makeClassDef("Ltest/three;", "Ltest/two;");

        ImmutableSet<ClassDef> classes = ImmutableSet.<ClassDef>of(
                objectClassDef, oneClassDef, twoClassDef, threeClassDef);

        ClassPath classPath = new ClassPath(new ImmutableDexFile(classes));
View Full Code Here

Examples of org.jf.dexlib2.iface.ClassDef

    @Test
    public void testGetSuperclassChain_Unresolved() throws IOException {
        // Ltest/one; isn't defined

        ClassDef twoClassDef = TestUtils.makeClassDef("Ltest/two;", "Ltest/one;");
        ClassDef threeClassDef = TestUtils.makeClassDef("Ltest/three;", "Ltest/two;");
        ImmutableSet<ClassDef> classes = ImmutableSet.<ClassDef>of(twoClassDef, threeClassDef);
        ClassPath classPath = new ClassPath(new ImmutableDexFile(classes));

        TypeProto unknownClassProto = classPath.getUnknownClass();
        TypeProto oneClassProto = classPath.getClass("Ltest/one;");
View Full Code Here

Examples of org.jf.dexlib2.iface.ClassDef

import java.io.StringWriter;

public class ImplicitReferenceTest {
    @Test
    public void testImplicitMethodReferences() throws IOException, RecognitionException {
        ClassDef classDef = SmaliTestUtils.compileSmali("" +
                ".class public LHelloWorld;\n" +
                ".super Ljava/lang/Object;\n" +
                ".method public static main([Ljava/lang/String;)V\n" +
                "    .registers 1\n" +
                "    invoke-static {p0}, LHelloWorld;->toString()V\n" +
View Full Code Here

Examples of org.jf.dexlib2.iface.ClassDef

                TextUtils.normalizeWhitespace(stringWriter.toString()));
    }

    @Test
    public void testExplicitMethodReferences() throws IOException, RecognitionException {
        ClassDef classDef = SmaliTestUtils.compileSmali("" +
                ".class public LHelloWorld;\n" +
                ".super Ljava/lang/Object;\n" +
                ".method public static main([Ljava/lang/String;)V\n" +
                "    .registers 1\n" +
                "    invoke-static {p0}, LHelloWorld;->toString()V\n" +
View Full Code Here

Examples of org.jf.dexlib2.iface.ClassDef

                TextUtils.normalizeWhitespace(stringWriter.toString()));
    }

    @Test
    public void testImplicitMethodLiterals() throws IOException, RecognitionException {
        ClassDef classDef = SmaliTestUtils.compileSmali("" +
                ".class public LHelloWorld;\n" +
                ".super Ljava/lang/Object;\n" +
                ".field public static field1:Ljava/lang/reflect/Method; = LHelloWorld;->toString()V\n" +
                ".field public static field2:Ljava/lang/reflect/Method; = LHelloWorld;->V()V\n" +
                ".field public static field3:Ljava/lang/reflect/Method; = LHelloWorld;->I()V\n" +
View Full Code Here

Examples of org.jf.dexlib2.iface.ClassDef

                TextUtils.normalizeWhitespace(stringWriter.toString()));
    }

    @Test
    public void testExplicitMethodLiterals() throws IOException, RecognitionException {
        ClassDef classDef = SmaliTestUtils.compileSmali("" +
                ".class public LHelloWorld;\n" +
                ".super Ljava/lang/Object;\n" +
                ".field public static field1:Ljava/lang/reflect/Method; = LHelloWorld;->toString()V\n" +
                ".field public static field2:Ljava/lang/reflect/Method; = LHelloWorld;->V()V\n" +
                ".field public static field3:Ljava/lang/reflect/Method; = LHelloWorld;->I()V\n" +
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.