Package org.apache.harmony.unpack200.bytecode

Examples of org.apache.harmony.unpack200.bytecode.CPUTF8


            };
        }

        private ClassFileEntry entry(String string) {
            return new CPUTF8(string, ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ);
        }
View Full Code Here


    public void setUp() {
        pool = new ClassConstantPool();
    }

    public void testDuplicateUTF8() {
        CPUTF8 u1 = new CPUTF8("thing", ClassConstantPool.DOMAIN_NORMALASCIIZ, 1);
        CPUTF8 u2 = new CPUTF8("thing", ClassConstantPool.DOMAIN_NORMALASCIIZ, 1);
        pool.add(u1);
        pool.add(u2);
        assertEquals(1, pool.size());
    }
View Full Code Here

        pool.add(u2);
        assertEquals(1, pool.size());
    }

    public void testDuplicateField() {
        CPMember cp1 = new CPMember(new CPUTF8("name",
                ClassConstantPool.DOMAIN_NORMALASCIIZ, 1), new CPUTF8("I",
                ClassConstantPool.DOMAIN_NORMALASCIIZ, 2), 0, null);
        pool.add(cp1);
        pool.addNestedEntries();
        assertEquals(2, pool.size());
        CPMember cp2 = new CPMember(new CPUTF8("name",
                ClassConstantPool.DOMAIN_NORMALASCIIZ, 1), new CPUTF8("I",
                ClassConstantPool.DOMAIN_NORMALASCIIZ, 2), 0, null);
        pool.add(cp2);
        pool.addNestedEntries();
        assertEquals(2, pool.size());
    }
View Full Code Here

        assertEquals(2, pool.size());
    }

    public void testIndex() {
        pool
                .add(new CPUTF8("OtherThing",
                        ClassConstantPool.DOMAIN_NORMALASCIIZ, 1));
        CPUTF8 u1 = new CPUTF8("thing", ClassConstantPool.DOMAIN_NORMALASCIIZ, 2);
        pool.add(u1);
        pool.resolve(new Segment());
        assertTrue(pool.indexOf(u1) > 0);
    }
View Full Code Here

        pool.resolve(new Segment());
        assertTrue(pool.indexOf(u1) > 0);
    }

    public void testAllClasses() {
        pool.add(new CPClass(new CPUTF8("RandomClass",
                ClassConstantPool.DOMAIN_NORMALASCIIZ, 1), 10));
        pool.add(new CPClass(new CPUTF8("RandomClass2",
                ClassConstantPool.DOMAIN_NORMALASCIIZ, 2), 20));
        assertEquals(2, pool.allClasses().size());
    }
View Full Code Here

import org.apache.harmony.unpack200.bytecode.SourceFileAttribute;

public class ClassFileEntryTest extends TestCase {

    public void testUTF8() {
        CPUTF8 u1 = new CPUTF8(
                new String("thing"), ClassConstantPool.DOMAIN_NORMALASCIIZ, 1); //$NON-NLS-1$
        CPUTF8 u2 = new CPUTF8(
                new String("thing"), ClassConstantPool.DOMAIN_NORMALASCIIZ, 1); //$NON-NLS-1$
        CPUTF8 u3 = new CPUTF8(
                new String("otherthing"), ClassConstantPool.DOMAIN_NORMALASCIIZ, 2); //$NON-NLS-1$
        checkEquality(u1, u2, "thing", u3);
    }
View Full Code Here

        assertFalse(unequal.equals(equal2));
    }

    public void testSourceAttribute() {
        SourceFileAttribute sfa1 = new SourceFileAttribute(
                new CPUTF8(
                        new String("Thing.java"), ClassConstantPool.DOMAIN_NORMALASCIIZ, 1)); //$NON-NLS-1$
        SourceFileAttribute sfa2 = new SourceFileAttribute(
                new CPUTF8(
                        new String("Thing.java"), ClassConstantPool.DOMAIN_NORMALASCIIZ, 1)); //$NON-NLS-1$
        SourceFileAttribute sfa3 = new SourceFileAttribute(
                new CPUTF8(
                        new String("OtherThing.java"), ClassConstantPool.DOMAIN_NORMALASCIIZ, 2)); //$NON-NLS-1$
        checkEquality(sfa1, sfa2, "Thing.java", sfa3); //$NON-NLS-1$
    }
View Full Code Here

        CPFloat cp3 = new CPFloat(new Float(5), 5);
        checkEquality(cp1, cp2, "3", cp3); //$NON-NLS-1$
    }

    public void testCPString() {
        CPString cp1 = new CPString(new CPUTF8(new String("3"),
                ClassConstantPool.DOMAIN_NORMALASCIIZ, 3), 3);
        CPString cp2 = new CPString(new CPUTF8(new String("3"),
                ClassConstantPool.DOMAIN_NORMALASCIIZ, 3), 3);
        CPString cp3 = new CPString(new CPUTF8(new String("5"),
                ClassConstantPool.DOMAIN_NORMALASCIIZ, 5), 5);
        checkEquality(cp1, cp2, "3", cp3); //$NON-NLS-1$
    }
View Full Code Here

                ClassConstantPool.DOMAIN_NORMALASCIIZ, 5), 5);
        checkEquality(cp1, cp2, "3", cp3); //$NON-NLS-1$
    }

    public void testCPField() {
        CPMember cp1 = new CPMember(new CPUTF8("Name",
                ClassConstantPool.DOMAIN_NORMALASCIIZ, 3), new CPUTF8("I",
                ClassConstantPool.DOMAIN_NORMALASCIIZ, 4), 0, null);
        CPMember cp2 = new CPMember(new CPUTF8("Name",
                ClassConstantPool.DOMAIN_NORMALASCIIZ, 3), new CPUTF8("I",
                ClassConstantPool.DOMAIN_NORMALASCIIZ, 4), 0, null);
        CPMember cp3 = new CPMember(new CPUTF8("Name",
                ClassConstantPool.DOMAIN_NORMALASCIIZ, 3), new CPUTF8("Z",
                ClassConstantPool.DOMAIN_NORMALASCIIZ, 5), 0, null);
        CPMember cp4 = new CPMember(new CPUTF8("GName",
                ClassConstantPool.DOMAIN_NORMALASCIIZ, 6), new CPUTF8("I",
                ClassConstantPool.DOMAIN_NORMALASCIIZ, 4), 0, null);
        checkEquality(cp1, cp2, "Name", cp3); //$NON-NLS-1$
        checkEquality(cp1, cp2, "I", cp4); //$NON-NLS-1$
    }
View Full Code Here

    public void setUp() {
        pool = new ClassConstantPool();
    }

    public void testDuplicateUTF8() {
        CPUTF8 u1 = new CPUTF8("thing", 1);
        CPUTF8 u2 = new CPUTF8("thing", 1);
        pool.add(u1);
        pool.add(u2);
        assertEquals(1, pool.size());
    }
View Full Code Here

TOP

Related Classes of org.apache.harmony.unpack200.bytecode.CPUTF8

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.