Package org.apache.harmony.pack200.bytecode

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


        // native signatures end up in DOMAINNORMALASCIIZ
        // while nonnatives end up in DOMAINSIGNATUREASCIIZ.
        // TODO: is this the right thing to do?
        for (int x = 0; x < localVariableTableTypeRS.length; x++) {
            for (int y = 0; y < localVariableTableTypeRS[x].length; y++) {
                CPUTF8 element = localVariableTableTypeRS[x][y];
                // TODO: come up with a better test for native vs nonnative
                // signatures?
//                if (element.underlyingString().length() > 2) {
//                    element.setDomain(ClassConstantPool.DOMAIN_SIGNATUREASCIIZ);
//                } else {
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,
                    ClassConstantPool.DOMAIN_NORMALASCIIZ);
            CPUTF8 descriptor = cpBands.cpSignatureValue(typeIndex,
                    ClassConstantPool.DOMAIN_SIGNATUREASCIIZ);
            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,
                    ClassConstantPool.DOMAIN_NORMALASCIIZ);
            CPUTF8 descriptor = cpBands.cpSignatureValue(typeIndex,
                    ClassConstantPool.DOMAIN_SIGNATUREASCIIZ);
            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);
        IcTuple[] ic_stored = computeIcStored(ic_local, ic_relevant);
        for (int index = 0; index < ic_stored.length; index++) {
            int innerClassIndex = ic_stored[index].thisClassIndex();
            int outerClassIndex = ic_stored[index].outerClassIndex();
            int simpleClassNameIndex = ic_stored[index].simpleClassNameIndex();
           
            String innerClassString = ic_stored[index].thisClassString();
            String outerClassString = ic_stored[index].outerClassString();
            String simpleClassName = ic_stored[index].simpleClassName();

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

            innerClass = innerClassIndex != -1 ? cpBands
                    .cpClassValue(innerClassIndex) : cpBands
                    .cpClassValue(innerClassString);
View Full Code Here

    public CPUTF8 cpUTF8Value(int index, int domain) {
        String string = cpUTF8[index];
        if (stringsToCPUTF8[domain] == null) {
            stringsToCPUTF8[domain] = new HashMap();
        }
        CPUTF8 cputf8 = (CPUTF8) stringsToCPUTF8[domain].get(string);
        if (cputf8 == null) {
            cputf8 = new CPUTF8(string, domain, index);
            stringsToCPUTF8[domain].put(string, cputf8);
        }
        return cputf8;
    }
View Full Code Here

    public CPUTF8 cpUTF8Value(String string, int domain, boolean searchForIndex) {
        if (stringsToCPUTF8[domain] == null) {
            stringsToCPUTF8[domain] = new HashMap();
        }
        CPUTF8 cputf8 = (CPUTF8) stringsToCPUTF8[domain].get(string);
        if (cputf8 == null) {
            int index = -1;
            if(searchForIndex) {
                index = search(cpUTF8, string);
            }
            if(index != -1) {
                return cpUTF8Value(index, domain);
            }
            if(searchForIndex) {
                index = search(cpSignature, string);
            }
            if(index != -1) {
                return cpSignatureValue(index);
            }
            cputf8 = new CPUTF8(string, domain, -1);
            stringsToCPUTF8[domain].put(string, cputf8);
        }
        return cputf8;
    }
View Full Code Here

                    }
                    break;
                }
            }
            int domain = ClassConstantPool.DOMAIN_NAMEANDTYPE;
            CPUTF8 name = cpUTF8Value(nameIndex,
                    ClassConstantPool.DOMAIN_NORMALASCIIZ);
            if (nativeDescriptor) {
                // Native signatures are stored in DOMAIN_NORMALASCIIZ, not
                // DOMAIN_SIGNATUREASCIIZ for some reason.
                descriptorDomain = ClassConstantPool.DOMAIN_NORMALASCIIZ;
            } else {
                descriptorDomain = ClassConstantPool.DOMAIN_SIGNATUREASCIIZ;
            }
            CPUTF8 descriptorU = cpSignatureValue(descriptorIndex, descriptorDomain);
            cpNameAndType = new CPNameAndType(name, descriptorU, domain, index + descrOffset);
            descriptorsToCPNameAndTypes.put(descriptor, cpNameAndType);
        }
        return cpNameAndType;
    }
View Full Code Here

        }
        if (stringsToCPUTF8[domain] == null) {
            stringsToCPUTF8[domain] = new HashMap();
        }
        String string = cpSignature[index];
        CPUTF8 cpUTF8 = (CPUTF8) stringsToCPUTF8[domain].get(string);
        if(cpUTF8 == null) {
            cpUTF8 = new CPUTF8(string, domain, globalIndex);
            stringsToCPUTF8[domain].put(string, cpUTF8);
        }
        return cpUTF8;
    }
View Full Code Here

                    }
                    break;
                }
            }
            int domain = ClassConstantPool.DOMAIN_NAMEANDTYPE;
            CPUTF8 name = cpUTF8Value(nameString,
                    ClassConstantPool.DOMAIN_NORMALASCIIZ, true);
            if (nativeDescriptor) {
                // Native signatures are stored in DOMAIN_NORMALASCIIZ, not
                // DOMAIN_SIGNATUREASCIIZ for some reason.
                descriptorDomain = ClassConstantPool.DOMAIN_NORMALASCIIZ;
            } else {
                descriptorDomain = ClassConstantPool.DOMAIN_SIGNATUREASCIIZ;
            }
            CPUTF8 descriptorU = cpUTF8Value(descriptorString, descriptorDomain, true);
            cpNameAndType = new CPNameAndType(name, descriptorU, domain, index + descrOffset);
            descriptorsToCPNameAndTypes.put(descriptor, cpNameAndType);
        }
        return cpNameAndType;
    }
View Full Code Here

                int nextT = ((Integer) T_iterator.next()).intValue();
                nestedArray[i] = new ElementValue(nextT, getNextValue(nextT));
            }
            return nestedArray;
        case '@':
            CPUTF8 type = (CPUTF8) nesttype_RS_Iterator.next();
            int numPairs = ((Integer) nestpair_N_Iterator.next()).intValue();

            return getAnnotation(type, numPairs, nestname_RU_Iterator);
        }
        return null;
View Full Code Here

                    // we've got a signature attribute
                    long result = fieldSignatureRS[signatureIndex];
                    String desc = fieldDescr[i][j];
                    int colon = desc.indexOf(':');
                    String type = desc.substring(colon + 1);
                    CPUTF8 value = (CPUTF8) signatureLayout.getValue(result,
                            type, cpBands.getConstantPool());
                    fieldAttributes[i][j].add(new SignatureAttribute(value));
                    signatureIndex++;
                }
                // Non-predefined attributes
View Full Code Here

        // native signatures end up in DOMAINNORMALASCIIZ
        // while nonnatives end up in DOMAINSIGNATUREASCIIZ.
        // TODO: is this the right thing to do?
        for (int x = 0; x < localVariableTableTypeRS.length; x++) {
            for (int y = 0; y < localVariableTableTypeRS[x].length; y++) {
                CPUTF8 element = localVariableTableTypeRS[x][y];
                // TODO: come up with a better test for native vs nonnative
                // signatures?
                if (element.underlyingString().length() > 2) {
                    element.setDomain(ClassConstantPool.DOMAIN_SIGNATUREASCIIZ);
                } else {
                    element.setDomain(ClassConstantPool.DOMAIN_NORMALASCIIZ);
                }
            }
        }

        int lengthLocalVariableTypeTableNBand = SegmentUtils.countMatches(
View Full Code Here

TOP

Related Classes of org.apache.harmony.pack200.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.