Java 类org.eclipse.jdt.core.util.ClassFormatException 实例源码

项目:Eclipse-Postfix-Code-Completion    文件:LocalVariableTypeTableEntry.java   
/**
 * Constructor for LocalVariableTypeTableEntry.
 *
 * @param classFileBytes
 * @param constantPool
 * @param offset
 * @throws ClassFormatException
 */
public LocalVariableTypeTableEntry(
    byte[] classFileBytes,
    IConstantPool constantPool,
    int offset) throws ClassFormatException {
        this.startPC = u2At(classFileBytes, 0, offset);
        this.length = u2At(classFileBytes, 2, offset);
        this.nameIndex = u2At(classFileBytes, 4, offset);
        this.signatureIndex = u2At(classFileBytes, 6, offset);
        this.index = u2At(classFileBytes, 8, offset);
        IConstantPoolEntry constantPoolEntry = constantPool.decodeEntry(this.nameIndex);
        if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Utf8) {
            throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
        }
        this.name = constantPoolEntry.getUtf8Value();
        constantPoolEntry = constantPool.decodeEntry(this.signatureIndex);
        if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Utf8) {
            throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
        }
        this.signature = constantPoolEntry.getUtf8Value();
    }
项目:Eclipse-Postfix-Code-Completion    文件:ParameterAnnotation.java   
/**
 * Constructor for Annotation.
 *
 * @param classFileBytes
 * @param constantPool
 * @param offset
 * @throws ClassFormatException
 */
public ParameterAnnotation(
        byte[] classFileBytes,
        IConstantPool constantPool,
        int offset) throws ClassFormatException {

    final int length = u2At(classFileBytes, 0, offset);
    this.readOffset = 2;
    this.annotationsNumber = length;
    if (length != 0) {
        this.annotations = new IAnnotation[length];
        for (int i = 0; i < length; i++) {
            Annotation annotation = new Annotation(classFileBytes, constantPool, offset + this.readOffset);
            this.annotations[i] = annotation;
            this.readOffset += annotation.sizeInBytes();
        }
    } else {
        this.annotations = NO_ENTRIES;
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:AnnotationComponent.java   
public AnnotationComponent(
        byte[] classFileBytes,
        IConstantPool constantPool,
        int offset) throws ClassFormatException {
    final int nameIndex = u2At(classFileBytes, 0, offset);
    this.componentNameIndex = nameIndex;
    if (nameIndex != 0) {
        IConstantPoolEntry constantPoolEntry = constantPool.decodeEntry(nameIndex);
        if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Utf8) {
            throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
        }
        this.componentName = constantPoolEntry.getUtf8Value();
    }
    this.readOffset = 2;
    AnnotationComponentValue value = new AnnotationComponentValue(classFileBytes, constantPool, offset + this.readOffset);
    this.componentValue = value;
    this.readOffset += value.sizeInBytes();
}
项目:Eclipse-Postfix-Code-Completion    文件:RuntimeInvisibleAnnotationsAttribute.java   
/**
 * Constructor for RuntimeInvisibleAnnotations.
 * @param classFileBytes
 * @param constantPool
 * @param offset
 * @throws ClassFormatException
 */
public RuntimeInvisibleAnnotationsAttribute(
        byte[] classFileBytes,
        IConstantPool constantPool,
        int offset)
        throws ClassFormatException {
    super(classFileBytes, constantPool, offset);
    final int length = u2At(classFileBytes, 6, offset);
    this.annotationsNumber = length;
    if (length != 0) {
        int readOffset = 8;
        this.annotations = new IAnnotation[length];
        for (int i = 0; i < length; i++) {
            Annotation annotation = new Annotation(classFileBytes, constantPool, offset + readOffset);
            this.annotations[i] = annotation;
            readOffset += annotation.sizeInBytes();
        }
    } else {
        this.annotations = NO_ENTRIES;
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:RuntimeVisibleParameterAnnotationsAttribute.java   
/**
 * Constructor for RuntimeVisibleParameterAnnotations.
 * @param classFileBytes
 * @param constantPool
 * @param offset
 * @throws ClassFormatException
 */
public RuntimeVisibleParameterAnnotationsAttribute(
    byte[] classFileBytes,
    IConstantPool constantPool,
    int offset)
    throws ClassFormatException {
    super(classFileBytes, constantPool, offset);
    final int length = u1At(classFileBytes, 6, offset);
    this.parametersNumber = length;
    if (length != 0) {
        int readOffset = 7;
        this.parameterAnnotations = new IParameterAnnotation[length];
        for (int i = 0; i < length; i++) {
            ParameterAnnotation parameterAnnotation = new ParameterAnnotation(classFileBytes, constantPool, offset + readOffset);
            this.parameterAnnotations[i] = parameterAnnotation;
            readOffset += parameterAnnotation.sizeInBytes();
        }
    } else {
        this.parameterAnnotations = NO_ENTRIES;
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:BootstrapMethodsAttribute.java   
/**
 * Constructor for BootstrapMethodsAttribute.
 * @param classFileBytes
 * @param constantPool
 * @param offset
 * @throws ClassFormatException
 */
public BootstrapMethodsAttribute(
        byte[] classFileBytes,
        IConstantPool constantPool,
        int offset) throws ClassFormatException {
    super(classFileBytes, constantPool, offset);
    this.numberOfBootstrapMethods = u2At(classFileBytes, 6, offset);
    final int length = this.numberOfBootstrapMethods;
    if (length != 0) {
        int readOffset = 8;
        this.entries = new IBootstrapMethodsEntry[length];
        BootstrapMethodsEntry entry;
        for (int i = 0; i < length; i++) {
            this.entries[i] = entry = new BootstrapMethodsEntry(classFileBytes, constantPool, offset + readOffset);
            readOffset += 4 + 2 * entry.getBootstrapArguments().length; 
        }
    } else {
        this.entries = NO_ENTRIES;
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:LocalVariableTableEntry.java   
/**
 * Constructor for LocalVariableTableEntry.
 *
 * @param classFileBytes
 * @param constantPool
 * @param offset
 * @throws ClassFormatException
 */
public LocalVariableTableEntry(
    byte[] classFileBytes,
    IConstantPool constantPool,
    int offset) throws ClassFormatException {
        this.startPC = u2At(classFileBytes, 0, offset);
        this.length = u2At(classFileBytes, 2, offset);
        this.nameIndex = u2At(classFileBytes, 4, offset);
        this.descriptorIndex = u2At(classFileBytes, 6, offset);
        this.index = u2At(classFileBytes, 8, offset);
        IConstantPoolEntry constantPoolEntry = constantPool.decodeEntry(this.nameIndex);
        if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Utf8) {
            throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
        }
        this.name = constantPoolEntry.getUtf8Value();
        constantPoolEntry = constantPool.decodeEntry(this.descriptorIndex);
        if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Utf8) {
            throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
        }
        this.descriptor = constantPoolEntry.getUtf8Value();
    }
项目:Eclipse-Postfix-Code-Completion    文件:RuntimeVisibleAnnotationsAttribute.java   
/**
 * Constructor for RuntimeVisibleAnnotations.
 * @param classFileBytes
 * @param constantPool
 * @param offset
 * @throws ClassFormatException
 */
public RuntimeVisibleAnnotationsAttribute(
    byte[] classFileBytes,
    IConstantPool constantPool,
    int offset)
    throws ClassFormatException {
    super(classFileBytes, constantPool, offset);
    final int length = u2At(classFileBytes, 6, offset);
    this.annotationsNumber = length;
    if (length != 0) {
        int readOffset = 8;
        this.annotations = new IAnnotation[length];
        for (int i = 0; i < length; i++) {
            Annotation annotation = new Annotation(classFileBytes, constantPool, offset + readOffset);
            this.annotations[i] = annotation;
            readOffset += annotation.sizeInBytes();
        }
    } else {
        this.annotations = NO_ENTRIES;
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:VerificationInfo.java   
public VerificationInfo(
        byte[] classFileBytes,
        IConstantPool constantPool,
        int offset) throws ClassFormatException {
    final int t = u1At(classFileBytes, 0, offset);
    this.tag = t;
    this.readOffset = 1;
    switch(t) {
        case IVerificationTypeInfo.ITEM_OBJECT :
            final int constantIndex = u2At(classFileBytes, 1, offset);
            this.constantPoolIndex = constantIndex;
            if (constantIndex != 0) {
                IConstantPoolEntry constantPoolEntry = constantPool.decodeEntry(constantIndex);
                if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Class) {
                    throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
                }
                this.classTypeName = constantPoolEntry.getClassInfoName();
            }
            this.readOffset += 2;
            break;
        case IVerificationTypeInfo.ITEM_UNINITIALIZED :
            this.offset = u2At(classFileBytes, 1, offset);
            this.readOffset += 2;
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:LocalVariableAttribute.java   
/**
 * Constructor for LocalVariableAttribute.
 * @param classFileBytes
 * @param constantPool
 * @param offset
 * @throws ClassFormatException
 */
public LocalVariableAttribute(
    byte[] classFileBytes,
    IConstantPool constantPool,
    int offset)
    throws ClassFormatException {
    super(classFileBytes, constantPool, offset);
    final int length = u2At(classFileBytes, 6, offset);
    this.localVariableTableLength = length;
    if (length != 0) {
        int readOffset = 8;
        this.localVariableTable = new ILocalVariableTableEntry[length];
        for (int i = 0; i < length; i++) {
            this.localVariableTable[i] = new LocalVariableTableEntry(classFileBytes, constantPool, offset + readOffset);
            readOffset += 10;
        }
    } else {
        this.localVariableTable = NO_ENTRIES;
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:RuntimeVisibleTypeAnnotationsAttribute.java   
/**
 * Constructor for RuntimeVisibleTypeAnnotations.
 * @param classFileBytes
 * @param constantPool
 * @param offset
 * @throws ClassFormatException
 */
public RuntimeVisibleTypeAnnotationsAttribute(
        byte[] classFileBytes,
        IConstantPool constantPool,
        int offset) throws ClassFormatException {
    super(classFileBytes, constantPool, offset);
    final int length = u2At(classFileBytes, 6, offset);
    this.extendedAnnotationsNumber = length;
    if (length != 0) {
        int readOffset = 8;
        this.extendedAnnotations = new IExtendedAnnotation[length];
        for (int i = 0; i < length; i++) {
            ExtendedAnnotation extendedAnnotation = new ExtendedAnnotation(classFileBytes, constantPool, offset + readOffset);
            this.extendedAnnotations[i] = extendedAnnotation;
            readOffset += extendedAnnotation.sizeInBytes();
        }
    } else {
        this.extendedAnnotations = NO_ENTRIES;
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:InnerClassesAttribute.java   
/**
 * Constructor for InnerClassesAttribute.
 * @param classFileBytes
 * @param constantPool
 * @param offset
 * @throws ClassFormatException
 */
public InnerClassesAttribute(
    byte[] classFileBytes,
    IConstantPool constantPool,
    int offset)
    throws ClassFormatException {
    super(classFileBytes, constantPool, offset);
    this.numberOfClasses = u2At(classFileBytes, 6, offset);
    final int length = this.numberOfClasses;
    if (length != 0) {
        int readOffset = 8;
        this.entries = new IInnerClassesAttributeEntry[length];
        for (int i = 0; i < length; i++) {
            this.entries[i] = new InnerClassesAttributeEntry(classFileBytes, constantPool, offset + readOffset);
            readOffset += 8;
        }
    } else {
        this.entries = NO_ENTRIES;
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:RuntimeInvisibleTypeAnnotationsAttribute.java   
/**
 * Constructor for RuntimeInvisibleTypeAnnotations.
 * @param classFileBytes
 * @param constantPool
 * @param offset
 * @throws ClassFormatException
 */
public RuntimeInvisibleTypeAnnotationsAttribute(
        byte[] classFileBytes,
        IConstantPool constantPool,
        int offset)
        throws ClassFormatException {
    super(classFileBytes, constantPool, offset);
    // read extended annotations
    final int length = u2At(classFileBytes, 6, offset);
    this.extendedAnnotationsNumber = length;
    if (length != 0) {
        int readOffset = 8;
        this.extendedAnnotations = new IExtendedAnnotation[length];
        for (int i = 0; i < length; i++) {
            ExtendedAnnotation extendedAnnotation = new ExtendedAnnotation(classFileBytes, constantPool, offset + readOffset);
            this.extendedAnnotations[i] = extendedAnnotation;
            readOffset += extendedAnnotation.sizeInBytes();
        }
    } else {
        this.extendedAnnotations = NO_ENTRIES;
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:RuntimeInvisibleParameterAnnotationsAttribute.java   
/**
 * Constructor for RuntimeVisibleParameterAnnotations.
 * @param classFileBytes
 * @param constantPool
 * @param offset
 * @throws ClassFormatException
 */
public RuntimeInvisibleParameterAnnotationsAttribute(
    byte[] classFileBytes,
    IConstantPool constantPool,
    int offset)
    throws ClassFormatException {
    super(classFileBytes, constantPool, offset);
    final int length = u1At(classFileBytes, 6, offset);
    this.parametersNumber = length;
    if (length != 0) {
        int readOffset = 7;
        this.parameterAnnotations = new IParameterAnnotation[length];
        for (int i = 0; i < length; i++) {
            ParameterAnnotation parameterAnnotation = new ParameterAnnotation(classFileBytes, constantPool, offset + readOffset);
            this.parameterAnnotations[i] = parameterAnnotation;
            readOffset += parameterAnnotation.sizeInBytes();
        }
    } else {
        this.parameterAnnotations = NO_ENTRIES;
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:LocalVariableTypeAttribute.java   
/**
 * Constructor for LocalVariableTypeAttribute.
 * @param classFileBytes
 * @param constantPool
 * @param offset
 * @throws ClassFormatException
 */
public LocalVariableTypeAttribute(
    byte[] classFileBytes,
    IConstantPool constantPool,
    int offset)
    throws ClassFormatException {
    super(classFileBytes, constantPool, offset);
    final int length = u2At(classFileBytes, 6, offset);
    this.localVariableTypeTableLength = length;
    if (length != 0) {
        int readOffset = 8;
        this.localVariableTypeTableEntries = new ILocalVariableTypeTableEntry[length];
        for (int i = 0; i < length; i++) {
            this.localVariableTypeTableEntries[i] = new LocalVariableTypeTableEntry(classFileBytes, constantPool, offset + readOffset);
            readOffset += 10;
        }
    } else {
        this.localVariableTypeTableEntries = NO_ENTRIES;
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:ExceptionAttribute.java   
ExceptionAttribute(byte[] classFileBytes, IConstantPool constantPool, int offset) throws ClassFormatException {
    super(classFileBytes, constantPool, offset);
    this.exceptionsNumber = u2At(classFileBytes, 6, offset);
    int exceptionLength = this.exceptionsNumber;
    this.exceptionNames = CharOperation.NO_CHAR_CHAR;
    this.exceptionIndexes = org.eclipse.jdt.internal.compiler.util.Util.EMPTY_INT_ARRAY;
    if (exceptionLength != 0) {
        this.exceptionNames = new char[exceptionLength][];
        this.exceptionIndexes = new int[exceptionLength];
    }
    int readOffset = 8;
    IConstantPoolEntry constantPoolEntry;
    for (int i = 0; i < exceptionLength; i++) {
        this.exceptionIndexes[i] = u2At(classFileBytes, readOffset, offset);
        constantPoolEntry = constantPool.decodeEntry(this.exceptionIndexes[i]);
        if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Class) {
            throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
        }
        this.exceptionNames[i] = constantPoolEntry.getClassInfoName();
        readOffset += 2;
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:LineNumberAttribute.java   
/**
 * Constructor for LineNumberAttribute.
 * @param classFileBytes
 * @param constantPool
 * @param offset
 * @throws ClassFormatException
 */
public LineNumberAttribute(
    byte[] classFileBytes,
    IConstantPool constantPool,
    int offset)
    throws ClassFormatException {
    super(classFileBytes, constantPool, offset);

    final int length = u2At(classFileBytes, 6, offset);
    this.lineNumberTableLength = length;
    if (length != 0) {
        this.lineNumberTable = new int[length][2];
        int readOffset = 8;
        for (int i = 0; i < length; i++) {
            this.lineNumberTable[i][0] = u2At(classFileBytes, readOffset, offset);
            this.lineNumberTable[i][1] = u2At(classFileBytes, readOffset + 2, offset);
            readOffset += 4;
        }
    } else {
        this.lineNumberTable = NO_ENTRIES;
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:LocalVariableTypeTableEntry.java   
/**
 * Constructor for LocalVariableTypeTableEntry.
 *
 * @param classFileBytes
 * @param constantPool
 * @param offset
 * @throws ClassFormatException
 */
public LocalVariableTypeTableEntry(
    byte[] classFileBytes,
    IConstantPool constantPool,
    int offset) throws ClassFormatException {
        this.startPC = u2At(classFileBytes, 0, offset);
        this.length = u2At(classFileBytes, 2, offset);
        this.nameIndex = u2At(classFileBytes, 4, offset);
        this.signatureIndex = u2At(classFileBytes, 6, offset);
        this.index = u2At(classFileBytes, 8, offset);
        IConstantPoolEntry constantPoolEntry = constantPool.decodeEntry(this.nameIndex);
        if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Utf8) {
            throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
        }
        this.name = constantPoolEntry.getUtf8Value();
        constantPoolEntry = constantPool.decodeEntry(this.signatureIndex);
        if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Utf8) {
            throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
        }
        this.signature = constantPoolEntry.getUtf8Value();
    }
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ParameterAnnotation.java   
/**
 * Constructor for Annotation.
 *
 * @param classFileBytes
 * @param constantPool
 * @param offset
 * @throws ClassFormatException
 */
public ParameterAnnotation(
        byte[] classFileBytes,
        IConstantPool constantPool,
        int offset) throws ClassFormatException {

    final int length = u2At(classFileBytes, 0, offset);
    this.readOffset = 2;
    this.annotationsNumber = length;
    if (length != 0) {
        this.annotations = new IAnnotation[length];
        for (int i = 0; i < length; i++) {
            Annotation annotation = new Annotation(classFileBytes, constantPool, offset + this.readOffset);
            this.annotations[i] = annotation;
            this.readOffset += annotation.sizeInBytes();
        }
    } else {
        this.annotations = NO_ENTRIES;
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:AnnotationComponent.java   
public AnnotationComponent(
        byte[] classFileBytes,
        IConstantPool constantPool,
        int offset) throws ClassFormatException {
    final int nameIndex = u2At(classFileBytes, 0, offset);
    this.componentNameIndex = nameIndex;
    if (nameIndex != 0) {
        IConstantPoolEntry constantPoolEntry = constantPool.decodeEntry(nameIndex);
        if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Utf8) {
            throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
        }
        this.componentName = constantPoolEntry.getUtf8Value();
    }
    this.readOffset = 2;
    AnnotationComponentValue value = new AnnotationComponentValue(classFileBytes, constantPool, offset + this.readOffset);
    this.componentValue = value;
    this.readOffset += value.sizeInBytes();
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:RuntimeInvisibleAnnotationsAttribute.java   
/**
 * Constructor for RuntimeInvisibleAnnotations.
 * @param classFileBytes
 * @param constantPool
 * @param offset
 * @throws ClassFormatException
 */
public RuntimeInvisibleAnnotationsAttribute(
        byte[] classFileBytes,
        IConstantPool constantPool,
        int offset)
        throws ClassFormatException {
    super(classFileBytes, constantPool, offset);
    final int length = u2At(classFileBytes, 6, offset);
    this.annotationsNumber = length;
    if (length != 0) {
        int readOffset = 8;
        this.annotations = new IAnnotation[length];
        for (int i = 0; i < length; i++) {
            Annotation annotation = new Annotation(classFileBytes, constantPool, offset + readOffset);
            this.annotations[i] = annotation;
            readOffset += annotation.sizeInBytes();
        }
    } else {
        this.annotations = NO_ENTRIES;
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:RuntimeVisibleParameterAnnotationsAttribute.java   
/**
 * Constructor for RuntimeVisibleParameterAnnotations.
 * @param classFileBytes
 * @param constantPool
 * @param offset
 * @throws ClassFormatException
 */
public RuntimeVisibleParameterAnnotationsAttribute(
    byte[] classFileBytes,
    IConstantPool constantPool,
    int offset)
    throws ClassFormatException {
    super(classFileBytes, constantPool, offset);
    final int length = u1At(classFileBytes, 6, offset);
    this.parametersNumber = length;
    if (length != 0) {
        int readOffset = 7;
        this.parameterAnnotations = new IParameterAnnotation[length];
        for (int i = 0; i < length; i++) {
            ParameterAnnotation parameterAnnotation = new ParameterAnnotation(classFileBytes, constantPool, offset + readOffset);
            this.parameterAnnotations[i] = parameterAnnotation;
            readOffset += parameterAnnotation.sizeInBytes();
        }
    } else {
        this.parameterAnnotations = NO_ENTRIES;
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:BootstrapMethodsAttribute.java   
/**
 * Constructor for BootstrapMethodsAttribute.
 * @param classFileBytes
 * @param constantPool
 * @param offset
 * @throws ClassFormatException
 */
public BootstrapMethodsAttribute(
        byte[] classFileBytes,
        IConstantPool constantPool,
        int offset) throws ClassFormatException {
    super(classFileBytes, constantPool, offset);
    this.numberOfBootstrapMethods = u2At(classFileBytes, 6, offset);
    final int length = this.numberOfBootstrapMethods;
    if (length != 0) {
        int readOffset = 8;
        this.entries = new IBootstrapMethodsEntry[length];
        for (int i = 0; i < length; i++) {
            this.entries[i] = new BootstrapMethodsEntry(classFileBytes, constantPool, offset + readOffset);
            readOffset += 8;
        }
    } else {
        this.entries = NO_ENTRIES;
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:LocalVariableTableEntry.java   
/**
 * Constructor for LocalVariableTableEntry.
 *
 * @param classFileBytes
 * @param constantPool
 * @param offset
 * @throws ClassFormatException
 */
public LocalVariableTableEntry(
    byte[] classFileBytes,
    IConstantPool constantPool,
    int offset) throws ClassFormatException {
        this.startPC = u2At(classFileBytes, 0, offset);
        this.length = u2At(classFileBytes, 2, offset);
        this.nameIndex = u2At(classFileBytes, 4, offset);
        this.descriptorIndex = u2At(classFileBytes, 6, offset);
        this.index = u2At(classFileBytes, 8, offset);
        IConstantPoolEntry constantPoolEntry = constantPool.decodeEntry(this.nameIndex);
        if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Utf8) {
            throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
        }
        this.name = constantPoolEntry.getUtf8Value();
        constantPoolEntry = constantPool.decodeEntry(this.descriptorIndex);
        if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Utf8) {
            throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
        }
        this.descriptor = constantPoolEntry.getUtf8Value();
    }
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:RuntimeVisibleAnnotationsAttribute.java   
/**
 * Constructor for RuntimeVisibleAnnotations.
 * @param classFileBytes
 * @param constantPool
 * @param offset
 * @throws ClassFormatException
 */
public RuntimeVisibleAnnotationsAttribute(
    byte[] classFileBytes,
    IConstantPool constantPool,
    int offset)
    throws ClassFormatException {
    super(classFileBytes, constantPool, offset);
    final int length = u2At(classFileBytes, 6, offset);
    this.annotationsNumber = length;
    if (length != 0) {
        int readOffset = 8;
        this.annotations = new IAnnotation[length];
        for (int i = 0; i < length; i++) {
            Annotation annotation = new Annotation(classFileBytes, constantPool, offset + readOffset);
            this.annotations[i] = annotation;
            readOffset += annotation.sizeInBytes();
        }
    } else {
        this.annotations = NO_ENTRIES;
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:VerificationInfo.java   
public VerificationInfo(
        byte[] classFileBytes,
        IConstantPool constantPool,
        int offset) throws ClassFormatException {
    final int t = u1At(classFileBytes, 0, offset);
    this.tag = t;
    this.readOffset = 1;
    switch(t) {
        case IVerificationTypeInfo.ITEM_OBJECT :
            final int constantIndex = u2At(classFileBytes, 1, offset);
            this.constantPoolIndex = constantIndex;
            if (constantIndex != 0) {
                IConstantPoolEntry constantPoolEntry = constantPool.decodeEntry(constantIndex);
                if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Class) {
                    throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
                }
                this.classTypeName = constantPoolEntry.getClassInfoName();
            }
            this.readOffset += 2;
            break;
        case IVerificationTypeInfo.ITEM_UNINITIALIZED :
            this.offset = u2At(classFileBytes, 1, offset);
            this.readOffset += 2;
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:LocalVariableAttribute.java   
/**
 * Constructor for LocalVariableAttribute.
 * @param classFileBytes
 * @param constantPool
 * @param offset
 * @throws ClassFormatException
 */
public LocalVariableAttribute(
    byte[] classFileBytes,
    IConstantPool constantPool,
    int offset)
    throws ClassFormatException {
    super(classFileBytes, constantPool, offset);
    final int length = u2At(classFileBytes, 6, offset);
    this.localVariableTableLength = length;
    if (length != 0) {
        int readOffset = 8;
        this.localVariableTable = new ILocalVariableTableEntry[length];
        for (int i = 0; i < length; i++) {
            this.localVariableTable[i] = new LocalVariableTableEntry(classFileBytes, constantPool, offset + readOffset);
            readOffset += 10;
        }
    } else {
        this.localVariableTable = NO_ENTRIES;
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:InnerClassesAttribute.java   
/**
 * Constructor for InnerClassesAttribute.
 * @param classFileBytes
 * @param constantPool
 * @param offset
 * @throws ClassFormatException
 */
public InnerClassesAttribute(
    byte[] classFileBytes,
    IConstantPool constantPool,
    int offset)
    throws ClassFormatException {
    super(classFileBytes, constantPool, offset);
    this.numberOfClasses = u2At(classFileBytes, 6, offset);
    final int length = this.numberOfClasses;
    if (length != 0) {
        int readOffset = 8;
        this.entries = new IInnerClassesAttributeEntry[length];
        for (int i = 0; i < length; i++) {
            this.entries[i] = new InnerClassesAttributeEntry(classFileBytes, constantPool, offset + readOffset);
            readOffset += 8;
        }
    } else {
        this.entries = NO_ENTRIES;
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:RuntimeInvisibleParameterAnnotationsAttribute.java   
/**
 * Constructor for RuntimeVisibleParameterAnnotations.
 * @param classFileBytes
 * @param constantPool
 * @param offset
 * @throws ClassFormatException
 */
public RuntimeInvisibleParameterAnnotationsAttribute(
    byte[] classFileBytes,
    IConstantPool constantPool,
    int offset)
    throws ClassFormatException {
    super(classFileBytes, constantPool, offset);
    final int length = u1At(classFileBytes, 6, offset);
    this.parametersNumber = length;
    if (length != 0) {
        int readOffset = 7;
        this.parameterAnnotations = new IParameterAnnotation[length];
        for (int i = 0; i < length; i++) {
            ParameterAnnotation parameterAnnotation = new ParameterAnnotation(classFileBytes, constantPool, offset + readOffset);
            this.parameterAnnotations[i] = parameterAnnotation;
            readOffset += parameterAnnotation.sizeInBytes();
        }
    } else {
        this.parameterAnnotations = NO_ENTRIES;
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:LocalVariableTypeAttribute.java   
/**
 * Constructor for LocalVariableTypeAttribute.
 * @param classFileBytes
 * @param constantPool
 * @param offset
 * @throws ClassFormatException
 */
public LocalVariableTypeAttribute(
    byte[] classFileBytes,
    IConstantPool constantPool,
    int offset)
    throws ClassFormatException {
    super(classFileBytes, constantPool, offset);
    final int length = u2At(classFileBytes, 6, offset);
    this.localVariableTypeTableLength = length;
    if (length != 0) {
        int readOffset = 8;
        this.localVariableTypeTableEntries = new ILocalVariableTypeTableEntry[length];
        for (int i = 0; i < length; i++) {
            this.localVariableTypeTableEntries[i] = new LocalVariableTypeTableEntry(classFileBytes, constantPool, offset + readOffset);
            readOffset += 10;
        }
    } else {
        this.localVariableTypeTableEntries = NO_ENTRIES;
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ExceptionAttribute.java   
ExceptionAttribute(byte[] classFileBytes, IConstantPool constantPool, int offset) throws ClassFormatException {
    super(classFileBytes, constantPool, offset);
    this.exceptionsNumber = u2At(classFileBytes, 6, offset);
    int exceptionLength = this.exceptionsNumber;
    this.exceptionNames = CharOperation.NO_CHAR_CHAR;
    this.exceptionIndexes = org.eclipse.jdt.internal.compiler.util.Util.EMPTY_INT_ARRAY;
    if (exceptionLength != 0) {
        this.exceptionNames = new char[exceptionLength][];
        this.exceptionIndexes = new int[exceptionLength];
    }
    int readOffset = 8;
    IConstantPoolEntry constantPoolEntry;
    for (int i = 0; i < exceptionLength; i++) {
        this.exceptionIndexes[i] = u2At(classFileBytes, readOffset, offset);
        constantPoolEntry = constantPool.decodeEntry(this.exceptionIndexes[i]);
        if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Class) {
            throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
        }
        this.exceptionNames[i] = constantPoolEntry.getClassInfoName();
        readOffset += 2;
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:LineNumberAttribute.java   
/**
 * Constructor for LineNumberAttribute.
 * @param classFileBytes
 * @param constantPool
 * @param offset
 * @throws ClassFormatException
 */
public LineNumberAttribute(
    byte[] classFileBytes,
    IConstantPool constantPool,
    int offset)
    throws ClassFormatException {
    super(classFileBytes, constantPool, offset);

    final int length = u2At(classFileBytes, 6, offset);
    this.lineNumberTableLength = length;
    if (length != 0) {
        this.lineNumberTable = new int[length][2];
        int readOffset = 8;
        for (int i = 0; i < length; i++) {
            this.lineNumberTable[i][0] = u2At(classFileBytes, readOffset, offset);
            this.lineNumberTable[i][1] = u2At(classFileBytes, readOffset + 2, offset);
            readOffset += 4;
        }
    } else {
        this.lineNumberTable = NO_ENTRIES;
    }
}
项目:eclipse.jdt.ls    文件:DisassemblerContentProvider.java   
private String getContent(byte[] bytes, IProgressMonitor monitor) throws CoreException {
    ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
    String disassembledByteCode = null;
    try {
        disassembledByteCode = disassembler.disassemble(bytes, LF, ClassFileBytesDisassembler.WORKING_COPY);
        if (disassembledByteCode != null) {
            disassembledByteCode = DISASSEMBLED_HEADER + disassembledByteCode;
        }
    } catch (ClassFormatException e) {
        throw new CoreException(new Status(Status.ERROR, "", "Error disassembling", e));
    }
    return disassembledByteCode;
}
项目:Eclipse-Postfix-Code-Completion    文件:MethodParametersAttribute.java   
MethodParametersAttribute(byte[] classFileBytes, IConstantPool constantPool, int offset) throws ClassFormatException {
    super(classFileBytes, constantPool, offset);

    final int length = u1At(classFileBytes, 6, offset);
    this.numberOfEntries = length;
    if (length != 0) {
        int readOffset = offset + 7;
        this.names = new char[length][];
        this.accessFlags = new short[length];
        for (int i = 0; i < length; i++) {
            int nameIndex = u2At(classFileBytes, 0, readOffset);
            int mask = u2At(classFileBytes, 2, readOffset);
            readOffset += 4;
            if (nameIndex != 0) {
                IConstantPoolEntry constantPoolEntry = constantPool.decodeEntry(nameIndex);
                if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Utf8) {
                    throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
                }
                this.names[i] = constantPoolEntry.getUtf8Value();
            } else {
                this.names[i] = null;
            }
            this.accessFlags[i] = (short) (mask & 0xFFFF);
        }
    } else {
        this.names = NO_NAMES;
        this.accessFlags = NO_ACCES_FLAGS;
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:StackMapTableAttribute.java   
/**
 * Constructor for LineNumberAttribute.
 * @param classFileBytes
 * @param constantPool
 * @param offset
 * @throws ClassFormatException
 */
public StackMapTableAttribute(
        byte[] classFileBytes,
        IConstantPool constantPool,
        int offset)
        throws ClassFormatException {
    super(classFileBytes, constantPool, offset);

    final int length = u2At(classFileBytes, 6, offset);
    this.numberOfEntries = length;
    if (length != 0) {
        int readOffset = 8;
        this.frames = new IStackMapFrame[length];
        for (int i = 0; i < length; i++) {
            StackMapFrame frame = new StackMapFrame(classFileBytes, constantPool, offset + readOffset);
            this.frames[i] = frame;
            readOffset += frame.sizeInBytes();
        }
    } else {
        this.frames = NO_FRAMES;
    }
    final int byteLength = (int) u4At(classFileBytes, 2, offset);

    if (length != 0) {
        System.arraycopy(classFileBytes, offset + 6, this.bytes = new byte[byteLength], 0, byteLength);
    } else {
        this.bytes = NO_ENTRIES;
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:LocalVariableReferenceInfo.java   
/**
 * Constructor for LocalVariableTableEntry.
 *
 * @param classFileBytes
 * @param constantPool
 * @param offset
 * @throws ClassFormatException
 */
public LocalVariableReferenceInfo(
        byte[] classFileBytes,
        IConstantPool constantPool,
        int offset) throws ClassFormatException {
    this.startPC = u2At(classFileBytes, 0, offset);
    this.length = u2At(classFileBytes, 2, offset);
    this.index = u2At(classFileBytes, 4, offset);
}
项目:Eclipse-Postfix-Code-Completion    文件:Annotation.java   
/**
 * Constructor for Annotation.
 *
 * @param classFileBytes
 * @param constantPool
 * @param offset
 * @throws ClassFormatException
 */
public Annotation(
        byte[] classFileBytes,
        IConstantPool constantPool,
        int offset) throws ClassFormatException {

    final int index = u2At(classFileBytes, 0, offset);
    this.typeIndex = index;
    if (index != 0) {
        IConstantPoolEntry constantPoolEntry = constantPool.decodeEntry(index);
        if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Utf8) {
            throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
        }
        this.typeName = constantPoolEntry.getUtf8Value();
    } else {
        throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
    }
    final int length = u2At(classFileBytes, 2, offset);
    this.componentsNumber = length;
    this.readOffset = 4;
    if (length != 0) {
        this.components = new IAnnotationComponent[length];
        for (int i = 0; i < length; i++) {
            AnnotationComponent component = new AnnotationComponent(classFileBytes, constantPool, offset + this.readOffset);
            this.components[i] = component;
            this.readOffset += component.sizeInBytes();
        }
    } else {
        this.components = NO_ENTRIES;
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:SignatureAttribute.java   
SignatureAttribute(byte[] classFileBytes, IConstantPool constantPool, int offset) throws ClassFormatException {
    super(classFileBytes, constantPool, offset);
    final int index = u2At(classFileBytes, 6, offset);
    this.signatureIndex = index;
    IConstantPoolEntry constantPoolEntry = constantPool.decodeEntry(index);
    if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Utf8) {
        throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
    }
    this.signature = constantPoolEntry.getUtf8Value();
}
项目:Eclipse-Postfix-Code-Completion    文件:SourceFileAttribute.java   
/**
 * Constructor for SourceFileAttribute.
 * @param classFileBytes
 * @param constantPool
 * @param offset
 * @throws ClassFormatException
 */
public SourceFileAttribute(
    byte[] classFileBytes,
    IConstantPool constantPool,
    int offset)
    throws ClassFormatException {
    super(classFileBytes, constantPool, offset);
    this.sourceFileIndex = u2At(classFileBytes, 6, offset);
    IConstantPoolEntry constantPoolEntry = constantPool.decodeEntry(this.sourceFileIndex);
    if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Utf8) {
        throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
    }
    this.sourceFileName = constantPoolEntry.getUtf8Value();
}
项目:Eclipse-Postfix-Code-Completion    文件:ExceptionTableEntry.java   
ExceptionTableEntry(byte[] classFileBytes, IConstantPool constantPool, int offset) throws ClassFormatException {
    this.startPC = u2At(classFileBytes, 0, offset);
    this.endPC = u2At(classFileBytes, 2, offset);
    this.handlerPC = u2At(classFileBytes, 4, offset);
    this.catchTypeIndex = u2At(classFileBytes, 6, offset);
    if (this.catchTypeIndex != 0) {
        IConstantPoolEntry constantPoolEntry = constantPool.decodeEntry(this.catchTypeIndex);
        if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Class) {
            throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
        }
        this.catchType = constantPoolEntry.getClassInfoName();
    }
}