Examples of CPUTF8


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

        public CPFieldRef cpFieldValue(int index) {
            return null;
        }

        public CPString cpStringValue(int index) {
            return new CPString(new CPUTF8("Hello", ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ), -1);
        }
View Full Code Here

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

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

public class CPUTF8Test extends TestCase {

    public void testEquality() {
        CPUTF8 one = new CPUTF8("(III)V",
                ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ, 1);
        CPUTF8 two = new CPUTF8("((I[II)V",
                ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ, 2);
        CPUTF8 three = new CPUTF8("([III)V",
                ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ, 3);
        assertFalse(one.equals(two));
        assertFalse(one.equals(three));
        assertFalse(two.equals(three));

        assertFalse(two.equals(one));
        assertFalse(three.equals(one));
        assertFalse(three.equals(two));
    }
View Full Code Here

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

            };
        }

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

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

    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

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

        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

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

        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

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

        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

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

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

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

        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

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

        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
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.