Package org.apache.harmony.pack200.bytecode

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


        } else if (cp == CP_DOUBLE) {
            return new CPDouble(new Double(bands.getCpDouble()[index]));
        } else if (cp == CP_STRING) {
            return new CPString(bands.getCpString()[index]);
        } else if (cp == CP_CLASS) {
            return new CPClass(bands.getCpClass()[index]);
        } else if (cp == SIGNATURE) {
          throw new Error("I don't know what to do with signatures yet");
//            return null /* new CPSignature(bands.getCpSignature()[index]) */;
        } else if (cp == CP_DESCR) {
          throw new Error("I don't know what to do with descriptors yet");
View Full Code Here


        } else if (cp == CP_DOUBLE) {
            return new CPDouble(new Double(bands.getCpDouble()[index]));
        } else if (cp == CP_STRING) {
            return new CPString(bands.getCpString()[index]);
        } else if (cp == CP_CLASS) {
            return new CPClass(bands.getCpClass()[index]);
        } else if (cp == SIGNATURE) {
          throw new Error("I don't know what to do with signatures yet");
//            return null /* new CPSignature(bands.getCpSignature()[index]) */;
        } else if (cp == CP_DESCR) {
          throw new Error("I don't know what to do with descriptors yet");
View Full Code Here

        for (int i1 = 0; i1 < count; i1++) {
            int index = indices[i1];
            if (index < 0 || index >= reference.length)
                throw new Pack200Exception(
                        "Something has gone wrong during parsing references, index = " + index + ", array size = " + reference.length);
            result[i1] = new CPClass(reference[index]);
        }
        return result;
    }
View Full Code Here

          .add(new SourceFileAttribute(fileName)) };
    } else {
      classFile.attributes = new Attribute[] {};
    }
    // this/superclass
    ClassFileEntry cfThis = cp.add(new CPClass(fullName));
    ClassFileEntry cfSuper = cp.add(new CPClass(classBands.getClassSuper()[classNum]));
    // add interfaces
    ClassFileEntry cfInterfaces[] = new ClassFileEntry[classBands.getClassInterfaces()[classNum].length];
    for (i = 0; i < cfInterfaces.length; i++) {
      cfInterfaces[i] = cp.add(new CPClass(classBands.getClassInterfaces()[classNum][i]));
    }
    // add fields
    ClassFileEntry cfFields[] = new ClassFileEntry[classBands.getClassFieldCount()[classNum]];
    // fieldDescr and fieldFlags used to create this
    for (i = 0; i < cfFields.length; i++) {
      cfFields[i] = cp.add(new CPField(classBands.getFieldDescr()[classNum][i],
                    classBands.getFieldFlags()[classNum][i], classBands.getFieldAttributes()[classNum][i]));
    }
    // add methods
    ClassFileEntry cfMethods[] = new ClassFileEntry[classBands.getClassMethodCount()[classNum]];
    // fieldDescr and fieldFlags used to create this
    for (i = 0; i < cfMethods.length; i++) {
      cfMethods[i] = cp.add(new CPMethod(classBands.getMethodDescr()[classNum][i],
                    classBands.getMethodFlags()[classNum][i], classBands.getMethodAttributes()[classNum][i]));
    }

    // add inner class attribute (if required)
    boolean addInnerClassesAttr = false;
    IcTuple[] ic_local = getClassBands().getIcLocal()[classNum];
    boolean ic_local_sent = false;
    if(ic_local != null) {
        ic_local_sent = true;
    }
    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++) {
        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;

        if(ic_stored[index].isAnonymous()) {
            innerClass = new CPClass(innerClassString);
        } else {
              innerClass = new CPClass(innerClassString);
              innerName = new CPUTF8(simpleClassName, ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ);
        }

        if(ic_stored[index].isMember()) {
            outerClass = new CPClass(outerClassString);
        }

          int flags = ic_stored[index].F;
          innerClassesAttribute.addInnerClassesEntry(innerClass, outerClass, innerName, flags);
          addInnerClassesAttr = true;
View Full Code Here

                if (methodExceptionsLayout.matches(flag)) {
                    int n = numExceptions[methodExceptionsIndex];
                    String[] exceptions = methodExceptionsRS[methodExceptionsIndex];
                    CPClass[] exceptionClasses = new CPClass[n];
                    for (int k = 0; k < n; k++) {
                        exceptionClasses[k] = new CPClass(exceptions[k]);
                    }
                    methodAttributes[i][j].add(new ExceptionsAttribute(
                            exceptionClasses));
                    methodExceptionsIndex++;
                }
View Full Code Here

                }
                classAttributes[i].add(new SourceFileAttribute(value));
                sourceFileIndex++;
            }
            if (enclosingMethodLayout.matches(flag)) {
                CPClass theClass = new CPClass(enclosingMethodRC[enclosingMethodIndex]);
                CPNameAndType theMethod = new CPNameAndType(enclosingMethodRDN[enclosingMethodIndex]);
                classAttributes[i].add(new EnclosingMethodAttribute(theClass, theMethod));
                enclosingMethodIndex++;
            }
            if (signatureLayout.matches(flag)) {
View Full Code Here

                            .getClassSuper()[c]);
                    List exceptionTable = new ArrayList();
                    if(handlerCount != null) {
                        for (int j = 0; j < handlerCount[i]; j++) {
                            String handlerClass = handlerClassTypes[i][j];
                            CPClass cpHandlerClass = new CPClass(handlerClass);
                            ExceptionTableEntry entry = new ExceptionTableEntry(
                                    handlerStartPCs[i][j], handlerEndPCs[i][j],
                                    handlerCatchPCs[i][j], cpHandlerClass);
                            exceptionTable.add(entry);
                        }
View Full Code Here

        while(changed) {
            changed = false;
            for(int allTupleIndex=0; allTupleIndex < allTuplesSize; allTupleIndex++) {
                Iterator it = classPoolClasses.iterator();
                while(it.hasNext()) {
                    CPClass classInPool = (CPClass)it.next();
                    String poolClassName = classInPool.name;
                    if(poolClassName.equals(allTuples[allTupleIndex].thisClassString())) {
                        // If the tuple isn't already in there, then add it
                        if(relevantTuples.indexOf(allTuples[allTupleIndex]) == -1) {
                            relevantTuples.add(allTuples[allTupleIndex]);
View Full Code Here

    // == str
    String fileName = fullName.substring(i) + ".java";
    classFile.attributes = new Attribute[] { (Attribute) cp
        .add(new SourceFileAttribute(fileName)) };
    // this/superclass
    ClassFileEntry cfThis = cp.add(new CPClass(fullName));
    ClassFileEntry cfSuper = cp.add(new CPClass(classSuper[classNum]));
    // add interfaces
    ClassFileEntry cfInterfaces[] = new ClassFileEntry[classInterfaces[classNum].length];
    for (i = 0; i < cfInterfaces.length; i++) {
      cfInterfaces[i] = cp.add(new CPClass(classInterfaces[classNum][i]));
    }
    // add fields
    ClassFileEntry cfFields[] = new ClassFileEntry[classFieldCount[classNum]];
    // fieldDescr and fieldFlags used to create this
    for (i = 0; i < cfFields.length; i++) {
View Full Code Here

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

TOP

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

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.