Package org.apache.harmony.pack200.bytecode

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


                       for (int k = 0; k < n; k++) {
                           long result = codec.decode(in);
                           exceptions[k] = new CPClass(cpBands.getCpClass()[(int) result]);
                       }
                   }
                   methodExceptions[i][j] = new ExceptionsAttribute(exceptions);
                   methodAttributes[i][j].add(methodExceptions[i][j]);
               }
            }
        }
    }
View Full Code Here


        .getAttributeLayout(AttributeLayout.ATTRIBUTE_SOURCE_FILE,
            AttributeLayout.CONTEXT_CLASS);
    if (SOURCE_FILE.matches(classBands.getClassFlags()[classNum])) {
      String fileName = fullName.substring(i) + ".java";
      classFile.attributes = new Attribute[] { (Attribute) cp
          .add(new SourceFileAttribute(fileName)) };
    } else {
      classFile.attributes = new Attribute[] {};
    }
    // this/superclass
    ClassFileEntry cfThis = cp.add(new CPClass(fullName));
View Full Code Here

    public void testMixedByteCodes() {
        OperandManager operandManager = new MockOperandManager();
        operandManager.setSegment(segment);
        operandManager.setCurrentClass("java/lang/Foo");

        CodeAttribute attribute = new CodeAttribute(3, // maxStack
                2, // maxLocals
                mixedByteArray, // codePacked
                segment, // segment
                operandManager, // operandManager
                new ArrayList());
View Full Code Here

    public void testSingleByteCodes() {
        OperandManager operandManager = new MockOperandManager();
        operandManager.setSegment(segment);
        operandManager.setCurrentClass("java/lang/Foo");

        CodeAttribute attribute = new CodeAttribute(4, // maxStack
                3, // maxLocals
                singleByteArray, // codePacked
                segment, // segment
                operandManager, // operandManager
                new ArrayList());
View Full Code Here

    public void testMixedByteCodes() {
        OperandManager operandManager = new MockOperandManager();
        operandManager.setSegment(segment);
        operandManager.setCurrentClass("java/lang/Foo");

        CodeAttribute attribute = new CodeAttribute(3, // maxStack
                2, // maxLocals
                mixedByteArray, // codePacked
                segment, // segment
                operandManager, // operandManager
                new ArrayList());
View Full Code Here

    public void testSingleByteCodes() {
        OperandManager operandManager = new MockOperandManager();
        operandManager.setSegment(segment);
        operandManager.setCurrentClass("java/lang/Foo");

        CodeAttribute attribute = new CodeAttribute(4, // maxStack
                3, // maxLocals
                singleByteArray, // codePacked
                segment, // segment
                operandManager, // operandManager
                new ArrayList());
View Full Code Here

                                    handlerStartPCs[i][j], handlerEndPCs[i][j],
                                    handlerCatchPCs[i][j], cpHandlerClass);
                            exceptionTable.add(entry);
                        }
                    }
                    CodeAttribute codeAttr = new CodeAttribute(maxStack,
                            maxLocal, methodByteCodePacked[c][m], segment,
                            operandManager, exceptionTable);
                    ArrayList methodAttributesList = methodAttributes[c][m];
                    // Make sure we add the code attribute in the right place
                    int indexForCodeAttr = 0;
                    for (int index = 0; index < methodAttributesList.size(); index++) {
                        Attribute attribute = (Attribute) methodAttributesList.get(index);
                        if((attribute instanceof NewAttribute && ((NewAttribute)attribute).getLayoutIndex() < 15)) {
                            indexForCodeAttr ++;
                        } else {
                            break;
                        }
                    }
                    methodAttributesList.add(indexForCodeAttr, codeAttr);
                    codeAttr.renumber(codeAttr.byteCodeOffsets);
                    List currentAttributes;
                    if (allCodeHasFlags) {
                        currentAttributes = (List) orderedCodeAttributes.get(i);
                    } else {
                        if (codeHasFlags[i]) {
                            currentAttributes = (List) orderedCodeAttributes
                                    .get(codeAttributeIndex);
                            codeAttributeIndex++;
                        } else {
                            currentAttributes = Collections.EMPTY_LIST;
                        }
                    }
                    for (int index = 0; index < currentAttributes.size(); index++) {
                        Attribute currentAttribute = (Attribute) currentAttributes
                                .get(index);
                        codeAttr.addAttribute(currentAttribute);
                        // Fix up the line numbers if needed
                        if (currentAttribute.hasBCIRenumbering()) {
                            ((BCIRenumberedAttribute) currentAttribute)
                                    .renumber(codeAttr.byteCodeOffsets);
                        }
View Full Code Here

                                    handlerStartPCs[i][j], handlerEndPCs[i][j],
                                    handlerCatchPCs[i][j], cpHandlerClass);
                            exceptionTable.add(entry);
                        }
                    }
                    CodeAttribute codeAttr = new CodeAttribute(maxStack,
                            maxLocal, methodByteCodePacked[c][m], segment,
                            operandManager, exceptionTable);
                    ArrayList methodAttributesList = methodAttributes[c][m];
                    // Make sure we add the code attribute in the right place
                    int indexForCodeAttr = 0;
                    for (int index = 0; index < methodAttributesList.size(); index++) {
                        Attribute attribute = (Attribute) methodAttributesList.get(index);
                        if((attribute instanceof NewAttribute && ((NewAttribute)attribute).getLayoutIndex() < 15)) {
                            indexForCodeAttr ++;
                        } else {
                            break;
                        }
                    }
                    methodAttributesList.add(indexForCodeAttr, codeAttr);
                    codeAttr.renumber(codeAttr.byteCodeOffsets);
                    List currentAttributes;
                    if (allCodeHasFlags) {
                        currentAttributes = (List) orderedCodeAttributes.get(i);
                    } else {
                        if (codeHasFlags[i]) {
                            currentAttributes = (List) orderedCodeAttributes
                                    .get(codeAttributeIndex);
                            codeAttributeIndex++;
                        } else {
                            currentAttributes = Collections.EMPTY_LIST;
                        }
                    }
                    for (int index = 0; index < currentAttributes.size(); index++) {
                        Attribute currentAttribute = (Attribute) currentAttributes
                                .get(index);
                        codeAttr.addAttribute(currentAttribute);
                        // Fix up the line numbers if needed
                        if (currentAttribute.hasBCIRenumbering()) {
                            ((BCIRenumberedAttribute) currentAttribute)
                                    .renumber(codeAttr.byteCodeOffsets);
                        }
View Full Code Here

                                    handlerStartPCs[i][j], handlerEndPCs[i][j],
                                    handlerCatchPCs[i][j], cpHandlerClass);
                            exceptionTable.add(entry);
                        }
                    }
                    CodeAttribute codeAttr = new CodeAttribute(maxStack,
                            maxLocal, methodByteCodePacked[c][m], segment,
                            operandManager, exceptionTable);
                    ArrayList methodAttributesList = methodAttributes[c][m];
                    // Make sure we add the code attribute in the right place
                    int indexForCodeAttr = 0;
                    for (int index = 0; index < methodAttributesList.size(); index++) {
                        Attribute attribute = (Attribute) methodAttributesList.get(index);
                        if((attribute instanceof NewAttribute && ((NewAttribute)attribute).getLayoutIndex() < 15)) {
                            indexForCodeAttr ++;
                        } else {
                            break;
                        }
                    }
                    methodAttributesList.add(indexForCodeAttr, codeAttr);
                    codeAttr.renumber(codeAttr.byteCodeOffsets);
                    ArrayList currentAttributes = (ArrayList) orderedCodeAttributes
                            .get(i);
                    for (int index = 0; index < currentAttributes.size(); index++) {
                        Attribute currentAttribute = (Attribute) currentAttributes
                                .get(index);
                        codeAttr.addAttribute(currentAttribute);
                        // Fix up the line numbers if needed
                        if (currentAttribute.hasBCIRenumbering()) {
                            ((BCIRenumberedAttribute) currentAttribute)
                                    .renumber(codeAttr.byteCodeOffsets);
                        }
View Full Code Here

                                    handlerStartPCs[i][j], handlerEndPCs[i][j],
                                    handlerCatchPCs[i][j], cpHandlerClass);
                            exceptionTable.add(entry);
                        }
                    }
                    CodeAttribute codeAttr = new CodeAttribute(maxStack,
                            maxLocal, methodByteCodePacked[c][m], segment,
                            operandManager, exceptionTable);
                    ArrayList methodAttributesList = methodAttributes[c][m];
                    // Make sure we add the code attribute in the right place
                    int indexForCodeAttr = 0;
                    for (Iterator iterator = methodAttributesList.iterator(); iterator
                            .hasNext();) {
                        Attribute attribute = (Attribute) iterator.next();
                        if(attribute instanceof SignatureAttribute ||
                                attribute instanceof DeprecatedAttribute ||
                                attribute instanceof RuntimeVisibleorInvisibleAnnotationsAttribute) {
                            indexForCodeAttr ++;
                        } else {
                            break;
                        }
                    }
                    methodAttributesList.add(indexForCodeAttr, codeAttr);
                    codeAttr.renumber(codeAttr.byteCodeOffsets);
                    ArrayList currentAttributes = (ArrayList) orderedCodeAttributes
                            .get(i);
                    for (int index = 0; index < currentAttributes.size(); index++) {
                        Attribute currentAttribute = (Attribute) currentAttributes
                                .get(index);
                        codeAttr.addAttribute(currentAttribute);
                        // Fix up the line numbers if needed
                        if (currentAttribute.hasBCIRenumbering()) {
                            ((BCIRenumberedAttribute) currentAttribute)
                                    .renumber(codeAttr.byteCodeOffsets);
                        }
View Full Code Here

TOP

Related Classes of org.apache.harmony.pack200.bytecode.CodeAttribute

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.