本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}