本文整理汇总了Java中org.eclipse.jdt.core.util.IClassFileAttribute类的典型用法代码示例。如果您正苦于以下问题:Java IClassFileAttribute类的具体用法?Java IClassFileAttribute怎么用?Java IClassFileAttribute使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IClassFileAttribute类属于org.eclipse.jdt.core.util包,在下文中一共展示了IClassFileAttribute类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAttribute
import org.eclipse.jdt.core.util.IClassFileAttribute; //导入依赖的package包/类
public static IClassFileAttribute getAttribute(
IClassFileReader classFileReader, char[] attributeName) {
IClassFileAttribute[] attributes = classFileReader.getAttributes();
for (int i = 0, max = attributes.length; i < max; i++) {
if (CharOperation.equals(attributes[i].getAttributeName(), attributeName)) {
return attributes[i];
}
}
return null;
}
示例2: getAttribute
import org.eclipse.jdt.core.util.IClassFileAttribute; //导入依赖的package包/类
public static IClassFileAttribute getAttribute(IClassFileReader classFileReader, char[] attributeName) {
IClassFileAttribute[] attributes = classFileReader.getAttributes();
for (int i = 0, max = attributes.length; i < max; i++) {
if (CharOperation.equals(attributes[i].getAttributeName(), attributeName)) {
return attributes[i];
}
}
return null;
}
示例3: CodeAttribute
import org.eclipse.jdt.core.util.IClassFileAttribute; //导入依赖的package包/类
CodeAttribute(byte[] classFileBytes, IConstantPool constantPool, int offset) throws ClassFormatException {
super(classFileBytes, constantPool, offset);
this.classFileBytes = classFileBytes;
this.constantPool = constantPool;
this.maxStack = u2At(classFileBytes, 6, offset);
this.maxLocals = u2At(classFileBytes, 8, offset);
this.codeLength = u4At(classFileBytes, 10, offset);
this.codeOffset = offset + 14;
int readOffset = (int) (14 + this.codeLength);
this.exceptionTableLength = u2At(classFileBytes, readOffset, offset);
readOffset += 2;
this.exceptionTableEntries = NO_EXCEPTION_TABLE;
if (this.exceptionTableLength != 0) {
this.exceptionTableEntries = new ExceptionTableEntry[this.exceptionTableLength];
for (int i = 0; i < this.exceptionTableLength; i++) {
this.exceptionTableEntries [i] = new ExceptionTableEntry(classFileBytes, constantPool, offset + readOffset);
readOffset += 8;
}
}
this.attributesCount = u2At(classFileBytes, readOffset, offset);
this.attributes = ClassFileAttribute.NO_ATTRIBUTES;
if (this.attributesCount != 0) {
this.attributes = new IClassFileAttribute[this.attributesCount];
}
int attributesIndex = 0;
readOffset += 2;
for (int i = 0; i < this.attributesCount; i++) {
IConstantPoolEntry constantPoolEntry = constantPool.decodeEntry(u2At(classFileBytes, readOffset, offset));
if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Utf8) {
throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
}
char[] attributeName = constantPoolEntry.getUtf8Value();
if (equals(attributeName, IAttributeNamesConstants.LINE_NUMBER)) {
this.lineNumberAttribute = new LineNumberAttribute(classFileBytes, constantPool, offset + readOffset);
this.attributes[attributesIndex++] = this.lineNumberAttribute;
} else if (equals(attributeName, IAttributeNamesConstants.LOCAL_VARIABLE)) {
this.localVariableAttribute = new LocalVariableAttribute(classFileBytes, constantPool, offset + readOffset);
this.attributes[attributesIndex++] = this.localVariableAttribute;
} else if (equals(attributeName, IAttributeNamesConstants.LOCAL_VARIABLE_TYPE_TABLE)) {
this.attributes[attributesIndex++] = new LocalVariableTypeAttribute(classFileBytes, constantPool, offset + readOffset);
} else if (equals(attributeName, IAttributeNamesConstants.STACK_MAP_TABLE)) {
this.attributes[attributesIndex++] = new StackMapTableAttribute(classFileBytes, constantPool, offset + readOffset);
} else if (equals(attributeName, IAttributeNamesConstants.STACK_MAP)) {
this.attributes[attributesIndex++] = new StackMapAttribute(classFileBytes, constantPool, offset + readOffset);
} else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_VISIBLE_TYPE_ANNOTATIONS)) {
this.attributes[attributesIndex++] = new RuntimeVisibleTypeAnnotationsAttribute(classFileBytes, constantPool, offset + readOffset);
} else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_INVISIBLE_TYPE_ANNOTATIONS)) {
this.attributes[attributesIndex++] = new RuntimeInvisibleTypeAnnotationsAttribute(classFileBytes, constantPool, offset + readOffset);
} else {
this.attributes[attributesIndex++] = new ClassFileAttribute(classFileBytes, constantPool, offset + readOffset);
}
readOffset += (6 + u4At(classFileBytes, readOffset + 2, offset));
}
}
示例4: getAttributes
import org.eclipse.jdt.core.util.IClassFileAttribute; //导入依赖的package包/类
/**
* @see ICodeAttribute#getAttributes()
*/
public IClassFileAttribute[] getAttributes() {
return this.attributes;
}
示例5: getAttributes
import org.eclipse.jdt.core.util.IClassFileAttribute; //导入依赖的package包/类
/**
* @see IMethodInfo#getAttributes()
*/
public IClassFileAttribute[] getAttributes() {
return this.attributes;
}
示例6: getAttributes
import org.eclipse.jdt.core.util.IClassFileAttribute; //导入依赖的package包/类
/**
* @see IClassFileReader#getAttributes()
*/
public IClassFileAttribute[] getAttributes() {
return this.attributes;
}
示例7: FieldInfo
import org.eclipse.jdt.core.util.IClassFileAttribute; //导入依赖的package包/类
/**
* @param classFileBytes byte[]
* @param constantPool IConstantPool
* @param offset int
*/
public FieldInfo(byte classFileBytes[], IConstantPool constantPool, int offset)
throws ClassFormatException {
final int flags = u2At(classFileBytes, 0, offset);
this.accessFlags = flags;
if ((flags & IModifierConstants.ACC_SYNTHETIC) != 0) {
this.isSynthetic = true;
}
this.nameIndex = u2At(classFileBytes, 2, 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();
this.descriptorIndex = u2At(classFileBytes, 4, offset);
constantPoolEntry = constantPool.decodeEntry(this.descriptorIndex);
if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Utf8) {
throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
}
this.descriptor = constantPoolEntry.getUtf8Value();
this.attributesCount = u2At(classFileBytes, 6, offset);
this.attributes = ClassFileAttribute.NO_ATTRIBUTES;
int readOffset = 8;
if (this.attributesCount != 0) {
this.attributes = new IClassFileAttribute[this.attributesCount];
}
int attributesIndex = 0;
for (int i = 0; i < this.attributesCount; i++) {
constantPoolEntry = constantPool.decodeEntry(u2At(classFileBytes, readOffset, offset));
if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Utf8) {
throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
}
char[] attributeName = constantPoolEntry.getUtf8Value();
if (equals(attributeName, IAttributeNamesConstants.DEPRECATED)) {
this.isDeprecated = true;
this.attributes[attributesIndex++] = new ClassFileAttribute(classFileBytes, constantPool, offset + readOffset);
} else if (equals(attributeName, IAttributeNamesConstants.SYNTHETIC)) {
this.isSynthetic = true;
this.attributes[attributesIndex++] = new ClassFileAttribute(classFileBytes, constantPool, offset + readOffset);
} else if (equals(attributeName, IAttributeNamesConstants.CONSTANT_VALUE)) {
this.constantValueAttribute = new ConstantValueAttribute(classFileBytes, constantPool, offset + readOffset);
this.attributes[attributesIndex++] = this.constantValueAttribute;
} else if (equals(attributeName, IAttributeNamesConstants.SIGNATURE)) {
this.attributes[attributesIndex++] = new SignatureAttribute(classFileBytes, constantPool, offset + readOffset);
} else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_VISIBLE_ANNOTATIONS)) {
this.attributes[attributesIndex++] = new RuntimeVisibleAnnotationsAttribute(classFileBytes, constantPool, offset + readOffset);
} else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_INVISIBLE_ANNOTATIONS)) {
this.attributes[attributesIndex++] = new RuntimeInvisibleAnnotationsAttribute(classFileBytes, constantPool, offset + readOffset);
} else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_VISIBLE_TYPE_ANNOTATIONS)) {
this.attributes[attributesIndex++] = new RuntimeVisibleTypeAnnotationsAttribute(classFileBytes, constantPool, offset + readOffset);
} else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_INVISIBLE_TYPE_ANNOTATIONS)) {
this.attributes[attributesIndex++] = new RuntimeInvisibleTypeAnnotationsAttribute(classFileBytes, constantPool, offset + readOffset);
} else {
this.attributes[attributesIndex++] = new ClassFileAttribute(classFileBytes, constantPool, offset + readOffset);
}
readOffset += (6 + u4At(classFileBytes, readOffset + 2, offset));
}
this.attributeBytes = readOffset;
}
示例8: getAttributes
import org.eclipse.jdt.core.util.IClassFileAttribute; //导入依赖的package包/类
/**
* @see IFieldInfo#getAttributes()
*/
public IClassFileAttribute[] getAttributes() {
return this.attributes;
}
示例9: CodeAttribute
import org.eclipse.jdt.core.util.IClassFileAttribute; //导入依赖的package包/类
CodeAttribute(byte[] classFileBytes, IConstantPool constantPool, int offset) throws ClassFormatException {
super(classFileBytes, constantPool, offset);
this.classFileBytes = classFileBytes;
this.constantPool = constantPool;
this.maxStack = u2At(classFileBytes, 6, offset);
this.maxLocals = u2At(classFileBytes, 8, offset);
this.codeLength = u4At(classFileBytes, 10, offset);
this.codeOffset = offset + 14;
int readOffset = (int) (14 + this.codeLength);
this.exceptionTableLength = u2At(classFileBytes, readOffset, offset);
readOffset += 2;
this.exceptionTableEntries = NO_EXCEPTION_TABLE;
if (this.exceptionTableLength != 0) {
this.exceptionTableEntries = new ExceptionTableEntry[this.exceptionTableLength];
for (int i = 0; i < this.exceptionTableLength; i++) {
this.exceptionTableEntries [i] = new ExceptionTableEntry(classFileBytes, constantPool, offset + readOffset);
readOffset += 8;
}
}
this.attributesCount = u2At(classFileBytes, readOffset, offset);
this.attributes = ClassFileAttribute.NO_ATTRIBUTES;
if (this.attributesCount != 0) {
this.attributes = new IClassFileAttribute[this.attributesCount];
}
int attributesIndex = 0;
readOffset += 2;
for (int i = 0; i < this.attributesCount; i++) {
IConstantPoolEntry constantPoolEntry = constantPool.decodeEntry(u2At(classFileBytes, readOffset, offset));
if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Utf8) {
throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
}
char[] attributeName = constantPoolEntry.getUtf8Value();
if (equals(attributeName, IAttributeNamesConstants.LINE_NUMBER)) {
this.lineNumberAttribute = new LineNumberAttribute(classFileBytes, constantPool, offset + readOffset);
this.attributes[attributesIndex++] = this.lineNumberAttribute;
} else if (equals(attributeName, IAttributeNamesConstants.LOCAL_VARIABLE)) {
this.localVariableAttribute = new LocalVariableAttribute(classFileBytes, constantPool, offset + readOffset);
this.attributes[attributesIndex++] = this.localVariableAttribute;
} else if (equals(attributeName, IAttributeNamesConstants.LOCAL_VARIABLE_TYPE_TABLE)) {
this.attributes[attributesIndex++] = new LocalVariableTypeAttribute(classFileBytes, constantPool, offset + readOffset);
} else if (equals(attributeName, IAttributeNamesConstants.STACK_MAP_TABLE)) {
this.attributes[attributesIndex++] = new StackMapTableAttribute(classFileBytes, constantPool, offset + readOffset);
} else if (equals(attributeName, IAttributeNamesConstants.STACK_MAP)) {
this.attributes[attributesIndex++] = new StackMapAttribute(classFileBytes, constantPool, offset + readOffset);
} else {
this.attributes[attributesIndex++] = new ClassFileAttribute(classFileBytes, constantPool, offset + readOffset);
}
readOffset += (6 + u4At(classFileBytes, readOffset + 2, offset));
}
}
示例10: FieldInfo
import org.eclipse.jdt.core.util.IClassFileAttribute; //导入依赖的package包/类
/**
* @param classFileBytes byte[]
* @param constantPool IConstantPool
* @param offset int
*/
public FieldInfo(byte classFileBytes[], IConstantPool constantPool, int offset)
throws ClassFormatException {
final int flags = u2At(classFileBytes, 0, offset);
this.accessFlags = flags;
if ((flags & IModifierConstants.ACC_SYNTHETIC) != 0) {
this.isSynthetic = true;
}
this.nameIndex = u2At(classFileBytes, 2, 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();
this.descriptorIndex = u2At(classFileBytes, 4, offset);
constantPoolEntry = constantPool.decodeEntry(this.descriptorIndex);
if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Utf8) {
throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
}
this.descriptor = constantPoolEntry.getUtf8Value();
this.attributesCount = u2At(classFileBytes, 6, offset);
this.attributes = ClassFileAttribute.NO_ATTRIBUTES;
int readOffset = 8;
if (this.attributesCount != 0) {
this.attributes = new IClassFileAttribute[this.attributesCount];
}
int attributesIndex = 0;
for (int i = 0; i < this.attributesCount; i++) {
constantPoolEntry = constantPool.decodeEntry(u2At(classFileBytes, readOffset, offset));
if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Utf8) {
throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
}
char[] attributeName = constantPoolEntry.getUtf8Value();
if (equals(attributeName, IAttributeNamesConstants.DEPRECATED)) {
this.isDeprecated = true;
this.attributes[attributesIndex++] = new ClassFileAttribute(classFileBytes, constantPool, offset + readOffset);
} else if (equals(attributeName, IAttributeNamesConstants.SYNTHETIC)) {
this.isSynthetic = true;
this.attributes[attributesIndex++] = new ClassFileAttribute(classFileBytes, constantPool, offset + readOffset);
} else if (equals(attributeName, IAttributeNamesConstants.CONSTANT_VALUE)) {
this.constantValueAttribute = new ConstantValueAttribute(classFileBytes, constantPool, offset + readOffset);
this.attributes[attributesIndex++] = this.constantValueAttribute;
} else if (equals(attributeName, IAttributeNamesConstants.SIGNATURE)) {
this.attributes[attributesIndex++] = new SignatureAttribute(classFileBytes, constantPool, offset + readOffset);
} else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_VISIBLE_ANNOTATIONS)) {
this.attributes[attributesIndex++] = new RuntimeVisibleAnnotationsAttribute(classFileBytes, constantPool, offset + readOffset);
} else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_INVISIBLE_ANNOTATIONS)) {
this.attributes[attributesIndex++] = new RuntimeInvisibleAnnotationsAttribute(classFileBytes, constantPool, offset + readOffset);
} else {
this.attributes[attributesIndex++] = new ClassFileAttribute(classFileBytes, constantPool, offset + readOffset);
}
readOffset += (6 + u4At(classFileBytes, readOffset + 2, offset));
}
this.attributeBytes = readOffset;
}