当前位置: 首页>>代码示例>>Java>>正文


Java ClassFileConstants.ATTR_TYPE_ANNOTATION属性代码示例

本文整理汇总了Java中org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants.ATTR_TYPE_ANNOTATION属性的典型用法代码示例。如果您正苦于以下问题:Java ClassFileConstants.ATTR_TYPE_ANNOTATION属性的具体用法?Java ClassFileConstants.ATTR_TYPE_ANNOTATION怎么用?Java ClassFileConstants.ATTR_TYPE_ANNOTATION使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants的用法示例。


在下文中一共展示了ClassFileConstants.ATTR_TYPE_ANNOTATION属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ClassFile

public ClassFile(SourceTypeBinding typeBinding) {
	// default constructor for subclasses
	this.constantPool = new ConstantPool(this);
	final CompilerOptions options = typeBinding.scope.compilerOptions();
	this.targetJDK = options.targetJDK;
	this.produceAttributes = options.produceDebugAttributes;
	this.referenceBinding = typeBinding;
	this.isNestedType = typeBinding.isNestedType();
	if (this.targetJDK >= ClassFileConstants.JDK1_6) {
		this.produceAttributes |= ClassFileConstants.ATTR_STACK_MAP_TABLE;
		if (this.targetJDK >= ClassFileConstants.JDK1_8) {
			this.produceAttributes |= ClassFileConstants.ATTR_TYPE_ANNOTATION;
			this.codeStream = new TypeAnnotationCodeStream(this);
			if (options.produceMethodParameters) {
				this.produceAttributes |= ClassFileConstants.ATTR_METHOD_PARAMETERS;
			}
		} else {
			this.codeStream = new StackMapFrameCodeStream(this);
		}
	} else if (this.targetJDK == ClassFileConstants.CLDC_1_1) {
		this.targetJDK = ClassFileConstants.JDK1_1; // put back 45.3
		this.produceAttributes |= ClassFileConstants.ATTR_STACK_MAP;
		this.codeStream = new StackMapFrameCodeStream(this);
	} else {
		this.codeStream = new CodeStream(this);
	}
	initByteArrays();
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:28,代码来源:ClassFile.java

示例2: reset

public void reset(SourceTypeBinding typeBinding) {
	// the code stream is reinitialized for each method
	final CompilerOptions options = typeBinding.scope.compilerOptions();
	this.referenceBinding = typeBinding;
	this.isNestedType = typeBinding.isNestedType();
	this.targetJDK = options.targetJDK;
	this.produceAttributes = options.produceDebugAttributes;
	if (this.targetJDK >= ClassFileConstants.JDK1_6) {
		this.produceAttributes |= ClassFileConstants.ATTR_STACK_MAP_TABLE;
		if (this.targetJDK >= ClassFileConstants.JDK1_8) {
			this.produceAttributes |= ClassFileConstants.ATTR_TYPE_ANNOTATION;
			if (options.produceMethodParameters) {
				this.produceAttributes |= ClassFileConstants.ATTR_METHOD_PARAMETERS;
			}
		}
	} else if (this.targetJDK == ClassFileConstants.CLDC_1_1) {
		this.targetJDK = ClassFileConstants.JDK1_1; // put back 45.3
		this.produceAttributes |= ClassFileConstants.ATTR_STACK_MAP;
	}
	this.bytes = null;
	this.constantPool.reset();
	this.codeStream.reset(this);
	this.constantPoolOffset = 0;
	this.contentsOffset = 0;
	this.creatingProblemType = false;
	this.enclosingClassFile = null;
	this.headerOffset = 0;
	this.methodCount = 0;
	this.methodCountOffset = 0;
	if (this.innerClassesBindings != null) {
		this.innerClassesBindings.clear();
	}
	if (this.bootstrapMethods != null) {
		this.bootstrapMethods.clear();
	}
	this.missingTypes = null;
	this.visitedTypes = null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:38,代码来源:ClassFile.java

示例3: addFieldAttributes

private int addFieldAttributes(FieldBinding fieldBinding, int fieldAttributeOffset) {
	int attributesNumber = 0;
	// 4.7.2 only static constant fields get a ConstantAttribute
	// Generate the constantValueAttribute
	Constant fieldConstant = fieldBinding.constant();
	if (fieldConstant != Constant.NotAConstant){
		attributesNumber += generateConstantValueAttribute(fieldConstant, fieldBinding, fieldAttributeOffset);
	}
	if (this.targetJDK < ClassFileConstants.JDK1_5 && fieldBinding.isSynthetic()) {
		attributesNumber += generateSyntheticAttribute();
	}
	if (fieldBinding.isDeprecated()) {
		attributesNumber += generateDeprecatedAttribute();
	}
	// add signature attribute
	char[] genericSignature = fieldBinding.genericSignature();
	if (genericSignature != null) {
		attributesNumber += generateSignatureAttribute(genericSignature);
	}
	if (this.targetJDK >= ClassFileConstants.JDK1_4) {
		FieldDeclaration fieldDeclaration = fieldBinding.sourceField();
		if (fieldDeclaration != null) {
			Annotation[] annotations = fieldDeclaration.annotations;
			if (annotations != null) {
				attributesNumber += generateRuntimeAnnotations(annotations, TagBits.AnnotationForField);
			}

			if ((this.produceAttributes & ClassFileConstants.ATTR_TYPE_ANNOTATION) != 0) {
				List allTypeAnnotationContexts = new ArrayList();
				if (annotations != null && (fieldDeclaration.bits & ASTNode.HasTypeAnnotations) != 0) {
					fieldDeclaration.getAllAnnotationContexts(AnnotationTargetTypeConstants.FIELD, allTypeAnnotationContexts);
				}
				int invisibleTypeAnnotationsCounter = 0;
				int visibleTypeAnnotationsCounter = 0;
				TypeReference fieldType = fieldDeclaration.type;
				if (fieldType != null && ((fieldType.bits & ASTNode.HasTypeAnnotations) != 0)) {
					fieldType.getAllAnnotationContexts(AnnotationTargetTypeConstants.FIELD, allTypeAnnotationContexts);
				}
				int size = allTypeAnnotationContexts.size();
				if (size != 0) {
					AnnotationContext[] allTypeAnnotationContextsArray = new AnnotationContext[size];
					allTypeAnnotationContexts.toArray(allTypeAnnotationContextsArray);
					for (int i = 0, max = allTypeAnnotationContextsArray.length; i < max; i++) {
						AnnotationContext annotationContext = allTypeAnnotationContextsArray[i];
						if ((annotationContext.visibility & AnnotationContext.INVISIBLE) != 0) {
							invisibleTypeAnnotationsCounter++;
							allTypeAnnotationContexts.add(annotationContext);
						} else {
							visibleTypeAnnotationsCounter++;
							allTypeAnnotationContexts.add(annotationContext);
						}
					}
					attributesNumber += generateRuntimeTypeAnnotations(
							allTypeAnnotationContextsArray,
							visibleTypeAnnotationsCounter,
							invisibleTypeAnnotationsCounter);
				}
			}
		}
	}
	if ((fieldBinding.tagBits & TagBits.HasMissingType) != 0) {
		this.missingTypes = fieldBinding.type.collectMissingTypes(this.missingTypes);
	}
	return attributesNumber;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:65,代码来源:ClassFile.java

示例4: TypeAnnotationCodeStream

public TypeAnnotationCodeStream(ClassFile givenClassFile) {
	super(givenClassFile);
	this.generateAttributes |= ClassFileConstants.ATTR_TYPE_ANNOTATION;
	this.allTypeAnnotationContexts = new ArrayList();
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:5,代码来源:TypeAnnotationCodeStream.java


注:本文中的org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants.ATTR_TYPE_ANNOTATION属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。