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


Java MethodBinding.collectMissingTypes方法代码示例

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


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

示例1: missingTypeInLambda

import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; //导入方法依赖的package包/类
public void missingTypeInLambda(LambdaExpression lambda, MethodBinding method) {
	int nameSourceStart = lambda.sourceStart();
	int nameSourceEnd = lambda.diagnosticsSourceEnd();
	List missingTypes = method.collectMissingTypes(null);
	if (missingTypes == null) {
		System.err.println("The lambda expression " + method + " is wrongly tagged as containing missing types"); //$NON-NLS-1$ //$NON-NLS-2$
		return;
	}
	TypeBinding missingType = (TypeBinding) missingTypes.get(0);
	this.handle(
			IProblem.MissingTypeInLambda,
			new String[] {
			        new String(missingType.readableName()),
			},
			new String[] {
			        new String(missingType.shortReadableName()),
			},
			nameSourceStart,
			nameSourceEnd);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:21,代码来源:ProblemReporter.java

示例2: missingTypeInMethod

import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; //导入方法依赖的package包/类
public void missingTypeInMethod(MessageSend messageSend, MethodBinding method) {
	List missingTypes = method.collectMissingTypes(null);
	if (missingTypes == null) {
		System.err.println("The method " + method + " is wrongly tagged as containing missing types"); //$NON-NLS-1$ //$NON-NLS-2$
		return;
	}
	TypeBinding missingType = (TypeBinding) missingTypes.get(0);
	this.handle(
			IProblem.MissingTypeInMethod,
			new String[] {
			        new String(method.declaringClass.readableName()),
			        new String(method.selector),
			        typesAsString(method, false),
			       	new String(missingType.readableName()),
			},
			new String[] {
			        new String(method.declaringClass.shortReadableName()),
			        new String(method.selector),
			        typesAsString(method, true),
			       	new String(missingType.shortReadableName()),
			},
			(int) (messageSend.nameSourcePosition >>> 32),
			(int) messageSend.nameSourcePosition);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:25,代码来源:ProblemReporter.java

示例3: missingTypeInConstructor

import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; //导入方法依赖的package包/类
public void missingTypeInConstructor(ASTNode location, MethodBinding constructor) {
	List missingTypes = constructor.collectMissingTypes(null);
	if (missingTypes == null) {
		System.err.println("The constructor " + constructor + " is wrongly tagged as containing missing types"); //$NON-NLS-1$ //$NON-NLS-2$
		return;
	}
	TypeBinding missingType = (TypeBinding) missingTypes.get(0);
	int start = location.sourceStart;
	int end = location.sourceEnd;
	if (location instanceof QualifiedAllocationExpression) {
		QualifiedAllocationExpression qualifiedAllocation = (QualifiedAllocationExpression) location;
		if (qualifiedAllocation.anonymousType != null) {
			start = qualifiedAllocation.anonymousType.sourceStart;
			end = qualifiedAllocation.anonymousType.sourceEnd;
		}
	}
	this.handle(
			IProblem.MissingTypeInConstructor,
			new String[] {
			        new String(constructor.declaringClass.readableName()),
			        typesAsString(constructor, false),
			       	new String(missingType.readableName()),
			},
			new String[] {
			        new String(constructor.declaringClass.shortReadableName()),
			        typesAsString(constructor, true),
			       	new String(missingType.shortReadableName()),
			},
			start,
			end);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:32,代码来源:ProblemReporter.java

示例4: missingTypeInMethod

import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; //导入方法依赖的package包/类
public void missingTypeInMethod(ASTNode astNode, MethodBinding method) {
	int nameSourceStart, nameSourceEnd;
	if (astNode instanceof MessageSend) {
		MessageSend messageSend = astNode instanceof MessageSend ? (MessageSend) (astNode) : null;
		nameSourceStart = (int) (messageSend.nameSourcePosition >>> 32);
		nameSourceEnd = (int) messageSend.nameSourcePosition;
	} else {
		nameSourceStart = astNode.sourceStart;
		nameSourceEnd = astNode.sourceEnd;
	}
	List missingTypes = method.collectMissingTypes(null);
	if (missingTypes == null) {
		System.err.println("The method " + method + " is wrongly tagged as containing missing types"); //$NON-NLS-1$ //$NON-NLS-2$
		return;
	}
	TypeBinding missingType = (TypeBinding) missingTypes.get(0);
	this.handle(
			IProblem.MissingTypeInMethod,
			new String[] {
			        new String(method.declaringClass.readableName()),
			        new String(method.selector),
			        typesAsString(method, false),
			       	new String(missingType.readableName()),
			},
			new String[] {
			        new String(method.declaringClass.shortReadableName()),
			        new String(method.selector),
			        typesAsString(method, true),
			       	new String(missingType.shortReadableName()),
			},
			nameSourceStart,
			nameSourceEnd);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:34,代码来源:ProblemReporter.java

示例5: 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.collectMissingTypes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。