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


Java MethodBinding.isVarargs方法代码示例

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


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

示例1: generateMethodInfoAttributes

import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; //导入方法依赖的package包/类
/**
 * INTERNAL USE-ONLY
 * That method generates the attributes of a code attribute.
 * They could be:
 * - an exception attribute for each try/catch found inside the method
 * - a deprecated attribute
 * - a synthetic attribute for synthetic access methods
 *
 * It returns the number of attributes created for the code attribute.
 *
 * @param methodBinding org.eclipse.jdt.internal.compiler.lookup.MethodBinding
 * @return <CODE>int</CODE>
 */
public int generateMethodInfoAttributes(MethodBinding methodBinding) {
	// leave two bytes for the attribute_number
	this.contentsOffset += 2;
	if (this.contentsOffset + 2 >= this.contents.length) {
		resizeContents(2);
	}
	// now we can handle all the attribute for that method info:
	// it could be:
	// - a CodeAttribute
	// - a ExceptionAttribute
	// - a DeprecatedAttribute
	// - a SyntheticAttribute

	// Exception attribute
	ReferenceBinding[] thrownsExceptions;
	int attributesNumber = 0;
	if ((thrownsExceptions = methodBinding.thrownExceptions) != Binding.NO_EXCEPTIONS) {
		// The method has a throw clause. So we need to add an exception attribute
		// check that there is enough space to write all the bytes for the exception attribute
		attributesNumber += generateExceptionsAttribute(thrownsExceptions);
	}
	if (methodBinding.isDeprecated()) {
		// Deprecated attribute
		attributesNumber += generateDeprecatedAttribute();
	}
	if (this.targetJDK < ClassFileConstants.JDK1_5) {
		if (methodBinding.isSynthetic()) {
			attributesNumber += generateSyntheticAttribute();
		}
		if (methodBinding.isVarargs()) {
			attributesNumber += generateVarargsAttribute();
		}
	}
	// add signature attribute
	char[] genericSignature = methodBinding.genericSignature();
	if (genericSignature != null) {
		attributesNumber += generateSignatureAttribute(genericSignature);
	}
	if (this.targetJDK >= ClassFileConstants.JDK1_4) {
		AbstractMethodDeclaration methodDeclaration = methodBinding.sourceMethod();
		if (methodDeclaration != null) {
			Annotation[] annotations = methodDeclaration.annotations;
			if (annotations != null) {
				attributesNumber += generateRuntimeAnnotations(annotations);
			}
			if ((methodBinding.tagBits & TagBits.HasParameterAnnotations) != 0) {
				Argument[] arguments = methodDeclaration.arguments;
				if (arguments != null) {
					attributesNumber += generateRuntimeAnnotationsForParameters(arguments);
				}
			}
		}
	}
	if ((methodBinding.tagBits & TagBits.HasMissingType) != 0) {
		this.missingTypes = methodBinding.collectMissingTypes(this.missingTypes);
	}
	return attributesNumber;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:72,代码来源:ClassFile.java


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