Package org.apache.harmony.unpack200

Examples of org.apache.harmony.unpack200.NewAttributeBands$Union


        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"), 3), 3);
        CPString cp2 = new CPString(new CPUTF8(new String("3"), 3), 3);
        CPString cp3 = new CPString(new CPUTF8(new String("5"), 5), 5);
        checkEquality(cp1, cp2, "3", cp3); //$NON-NLS-1$
    }
View Full Code Here


        public MockCpBands(Segment segment) {
            super(segment);
        }

        public CPString cpStringValue(int index) {
            return new CPString(cpUTF8, index);
        }
View Full Code Here

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

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

        // fieldDescr and fieldFlags used to create this
        for (i = 0; i < cfFields.length; i++) {
            int descriptorIndex = classBands.getFieldDescrInts()[classNum][i];
            int nameIndex = cpBands.getCpDescriptorNameInts()[descriptorIndex];
            int typeIndex = cpBands.getCpDescriptorTypeInts()[descriptorIndex];
            CPUTF8 name = cpBands.cpUTF8Value(nameIndex);
            CPUTF8 descriptor = cpBands.cpSignatureValue(typeIndex);
            cfFields[i] = cp.add(new CPField(name, descriptor, classBands
                    .getFieldFlags()[classNum][i], classBands
                    .getFieldAttributes()[classNum][i]));
        }
        // add methods
        ClassFileEntry cfMethods[] = new ClassFileEntry[classBands
                .getClassMethodCount()[classNum]];
        // methodDescr and methodFlags used to create this
        for (i = 0; i < cfMethods.length; i++) {
            int descriptorIndex = classBands.getMethodDescrInts()[classNum][i];
//            int colon = descriptorStr.indexOf(':');
            int nameIndex = cpBands.getCpDescriptorNameInts()[descriptorIndex];
            int typeIndex = cpBands.getCpDescriptorTypeInts()[descriptorIndex];
            CPUTF8 name = cpBands.cpUTF8Value(nameIndex);
            CPUTF8 descriptor = cpBands.cpSignatureValue(typeIndex);
            cfMethods[i] = cp.add(new CPMethod(name, descriptor, classBands
                    .getMethodFlags()[classNum][i], classBands
                    .getMethodAttributes()[classNum][i]));
        }
        cp.addNestedEntries();

        // add inner class attribute (if required)
        boolean addInnerClassesAttr = false;
        IcTuple[] ic_local = getClassBands().getIcLocal()[classNum];
        boolean ic_local_sent = ic_local != null;
        InnerClassesAttribute innerClassesAttribute = new InnerClassesAttribute(
                "InnerClasses");
        IcTuple[] ic_relevant = getIcBands().getRelevantIcTuples(fullName, cp);
        List ic_stored = computeIcStored(ic_local, ic_relevant);
        for (int index = 0; index < ic_stored.size(); index++) {
          IcTuple icStored = (IcTuple)ic_stored.get(index);
            int innerClassIndex = icStored.thisClassIndex();
            int outerClassIndex = icStored.outerClassIndex();
            int simpleClassNameIndex = icStored.simpleClassNameIndex();

            String innerClassString = icStored.thisClassString();
            String outerClassString = icStored.outerClassString();
            String simpleClassName = icStored.simpleClassName();

            CPClass innerClass = null;
            CPUTF8 innerName = null;
            CPClass outerClass = null;

            innerClass = innerClassIndex != -1 ? cpBands
                    .cpClassValue(innerClassIndex) : cpBands
                    .cpClassValue(innerClassString);
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

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

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

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

    public void testIndex() {
        pool.add(new CPUTF8("OtherThing", 1));
        CPUTF8 u1 = new CPUTF8("thing", 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", 1), 10));
        pool.add(new CPClass(new CPUTF8("RandomClass2", 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"), 1); //$NON-NLS-1$
        CPUTF8 u2 = new CPUTF8(new String("thing"), 1); //$NON-NLS-1$
        CPUTF8 u3 = new CPUTF8(new String("otherthing"), 2); //$NON-NLS-1$
        checkEquality(u1, u2, "thing", u3);
    }
View Full Code Here

        assertFalse(unequal.equals(equal1));
        assertFalse(unequal.equals(equal2));
    }

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

TOP

Related Classes of org.apache.harmony.unpack200.NewAttributeBands$Union

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.