本文整理汇总了Java中org.eclipse.jdt.internal.compiler.lookup.MethodBinding.isValidBinding方法的典型用法代码示例。如果您正苦于以下问题:Java MethodBinding.isValidBinding方法的具体用法?Java MethodBinding.isValidBinding怎么用?Java MethodBinding.isValidBinding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.internal.compiler.lookup.MethodBinding
的用法示例。
在下文中一共展示了MethodBinding.isValidBinding方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findMethodForArray
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; //导入方法依赖的package包/类
public MethodBinding findMethodForArray(ArrayBinding receiverType, char[] selector, TypeBinding[] argumentTypes, InvocationSite invocationSite) {
ReferenceBinding object = getJavaLangObject();
MethodBinding methodBinding = object.getExactMethod(selector, argumentTypes, null);
if (methodBinding != null) {
// handle the method clone() specially... cannot be protected or throw exceptions
if (argumentTypes == Binding.NO_PARAMETERS && CharOperation.equals(selector, TypeConstants.CLONE))
return new MethodBinding((methodBinding.modifiers & ~ClassFileConstants.AccProtected) | ClassFileConstants.AccPublic, TypeConstants.CLONE, methodBinding.returnType, argumentTypes, null, object);
if (canBeSeenByForCodeSnippet(methodBinding, receiverType, invocationSite, this))
return methodBinding;
}
// answers closest approximation, may not check argumentTypes or visibility
methodBinding = findMethod(object, selector, argumentTypes, invocationSite, false);
if (methodBinding == null)
return new ProblemMethodBinding(selector, argumentTypes, ProblemReasons.NotFound);
if (methodBinding.isValidBinding()) {
MethodBinding compatibleMethod = computeCompatibleMethod(methodBinding, argumentTypes, invocationSite, Scope.FULL_INFERENCE);
if (compatibleMethod == null)
return new ProblemMethodBinding(methodBinding, selector, argumentTypes, ProblemReasons.NotFound);
methodBinding = compatibleMethod;
if (!canBeSeenByForCodeSnippet(methodBinding, receiverType, invocationSite, this))
return new ProblemMethodBinding(methodBinding, selector, methodBinding.parameters, ProblemReasons.NotVisible);
}
return methodBinding;
}
示例2: isCompatibleWith
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; //导入方法依赖的package包/类
public boolean isCompatibleWith(TypeBinding left, Scope scope) {
if (this.binding != null && this.binding.isValidBinding() // binding indicates if full resolution has already happened
&& this.resolvedType != null && this.resolvedType.isValidBinding()) {
return this.resolvedType.isCompatibleWith(left, scope);
}
// 15.28.2
left = left.uncapture(this.enclosingScope);
final MethodBinding sam = left.getSingleAbstractMethod(this.enclosingScope, true);
if (sam == null || !sam.isValidBinding())
return false;
boolean isCompatible;
setExpectedType(left);
IErrorHandlingPolicy oldPolicy = this.enclosingScope.problemReporter().switchErrorHandlingPolicy(silentErrorHandlingPolicy);
try {
this.binding = null;
this.trialResolution = true;
resolveType(this.enclosingScope);
} finally {
this.enclosingScope.problemReporter().switchErrorHandlingPolicy(oldPolicy);
isCompatible = this.binding != null && this.binding.isValidBinding();
this.binding = null;
setExpectedType(null);
this.trialResolution = false;
}
return isCompatible;
}
示例3: resolveType
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; //导入方法依赖的package包/类
public TypeBinding resolveType(BlockScope blockScope) {
this.constant = Constant.NotAConstant;
this.enclosingScope = blockScope;
MethodBinding sam = this.expectedType == null ? null : this.expectedType.getSingleAbstractMethod(blockScope, argumentsTypeElided());
if (sam == null) {
blockScope.problemReporter().targetTypeIsNotAFunctionalInterface(this);
return null;
}
if (!sam.isValidBinding()) {
return reportSamProblem(blockScope, sam);
}
this.descriptor = sam;
if (kosherDescriptor(blockScope, sam, true)) {
return this.resolvedType = this.expectedType;
}
return this.resolvedType = null;
}
示例4: findMethodForArray
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; //导入方法依赖的package包/类
public MethodBinding findMethodForArray(ArrayBinding receiverType, char[] selector, TypeBinding[] argumentTypes, InvocationSite invocationSite) {
ReferenceBinding object = getJavaLangObject();
MethodBinding methodBinding = object.getExactMethod(selector, argumentTypes, null);
if (methodBinding != null) {
// handle the method clone() specially... cannot be protected or throw exceptions
if (argumentTypes == Binding.NO_PARAMETERS && CharOperation.equals(selector, TypeConstants.CLONE))
return new MethodBinding((methodBinding.modifiers & ~ClassFileConstants.AccProtected) | ClassFileConstants.AccPublic, TypeConstants.CLONE, methodBinding.returnType, argumentTypes, null, object);
if (canBeSeenByForCodeSnippet(methodBinding, receiverType, invocationSite, this))
return methodBinding;
}
// answers closest approximation, may not check argumentTypes or visibility
methodBinding = findMethod(object, selector, argumentTypes, invocationSite);
if (methodBinding == null)
return new ProblemMethodBinding(selector, argumentTypes, ProblemReasons.NotFound);
if (methodBinding.isValidBinding()) {
MethodBinding compatibleMethod = computeCompatibleMethod(methodBinding, argumentTypes, invocationSite);
if (compatibleMethod == null)
return new ProblemMethodBinding(methodBinding, selector, argumentTypes, ProblemReasons.NotFound);
methodBinding = compatibleMethod;
if (!canBeSeenByForCodeSnippet(methodBinding, receiverType, invocationSite, this))
return new ProblemMethodBinding(methodBinding, selector, methodBinding.parameters, ProblemReasons.NotVisible);
}
return methodBinding;
}
示例5: resolveType
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; //导入方法依赖的package包/类
public TypeBinding resolveType(BlockScope scope) {
TypeBinding type = super.resolveType(scope);
if (type instanceof PolyTypeBinding)
return type;
MethodBinding method = getMethodBinding();
if (method != null && method.isValidBinding() && !method.isSynthetic())
throw new SelectionNodeFound(this.actualMethodBinding);
throw new SelectionNodeFound();
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:10,代码来源:SelectionOnReferenceExpressionName.java
示例6: findMethod
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; //导入方法依赖的package包/类
public MethodBinding findMethod(ReferenceBinding receiverType, char[] selector, TypeBinding[] argumentTypes, InvocationSite invocationSite, boolean inStaticContext) {
MethodBinding methodBinding = super.findMethod(receiverType, selector, argumentTypes, invocationSite, inStaticContext);
if (methodBinding != null && methodBinding.isValidBinding())
if (!canBeSeenByForCodeSnippet(methodBinding, receiverType, invocationSite, this))
return new ProblemMethodBinding(methodBinding, selector, argumentTypes, ProblemReasons.NotVisible);
return methodBinding;
}
示例7: getImplicitMethod
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; //导入方法依赖的package包/类
public MethodBinding getImplicitMethod(ReferenceBinding receiverType, char[] selector, TypeBinding[] argumentTypes, InvocationSite invocationSite) {
// retrieve an exact visible match (if possible)
MethodBinding methodBinding = findExactMethod(receiverType, selector, argumentTypes, invocationSite);
if (methodBinding == null)
methodBinding = findMethod(receiverType, selector, argumentTypes, invocationSite, false);
if (methodBinding != null) { // skip it if we did not find anything
if (methodBinding.isValidBinding())
if (!canBeSeenByForCodeSnippet(methodBinding, receiverType, invocationSite, this))
return new ProblemMethodBinding(methodBinding, selector, argumentTypes, ProblemReasons.NotVisible);
return methodBinding;
}
return new ProblemMethodBinding(selector, argumentTypes, ProblemReasons.NotFound);
}
示例8: getFunctionalInterfaceMethod
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; //导入方法依赖的package包/类
@Override
public IMethodBinding getFunctionalInterfaceMethod() {
Scope scope = this.resolver.scope();
if (this.binding == null || scope == null)
return null;
MethodBinding sam = this.binding.getSingleAbstractMethod(scope, true);
if (sam == null || !sam.isValidBinding())
return null;
return this.resolver.getMethodBinding(sam);
}
示例9: findCompileTimeMethodTargeting
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; //导入方法依赖的package包/类
/** During inference: Try to find an applicable method binding without causing undesired side-effects. */
public MethodBinding findCompileTimeMethodTargeting(TypeBinding targetType, Scope scope) {
MethodBinding targetMethod = internalResolveTentatively(targetType, scope);
if (targetMethod == null || !targetMethod.isValidBinding())
return null;
return targetMethod;
}
示例10: sIsMoreSpecific
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; //导入方法依赖的package包/类
public boolean sIsMoreSpecific(TypeBinding s, TypeBinding t, Scope scope) {
if (super.sIsMoreSpecific(s, t, scope))
return true;
if (this.exactMethodBinding == null || t.findSuperTypeOriginatingFrom(s) != null)
return false;
s = s.capture(this.enclosingScope, this.sourceEnd);
MethodBinding sSam = s.getSingleAbstractMethod(this.enclosingScope, true);
if (sSam == null || !sSam.isValidBinding())
return false;
TypeBinding r1 = sSam.returnType;
MethodBinding tSam = t.getSingleAbstractMethod(this.enclosingScope, true);
if (tSam == null || !tSam.isValidBinding())
return false;
TypeBinding r2 = tSam.returnType;
if (r2.id == TypeIds.T_void)
return true;
if (r1.id == TypeIds.T_void)
return false;
// r1 <: r2
if (r1.isCompatibleWith(r2, scope))
return true;
return r1.isBaseType() != r2.isBaseType() && r1.isBaseType() == this.exactMethodBinding.returnType.isBaseType();
}
示例11: isBlacklistedMethod
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; //导入方法依赖的package包/类
private static boolean isBlacklistedMethod(Expression expression) {
if (expression instanceof MessageSend) {
MethodBinding method = ((MessageSend) expression).binding;
if (method != null && method.isValidBinding())
// for all methods in java.nio.file.Files that return a resource (Stream) it really needs closing
return CharOperation.equals(method.declaringClass.compoundName, TypeConstants.JAVA_NIO_FILE_FILES);
}
return false;
}
示例12: findMethod
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; //导入方法依赖的package包/类
public MethodBinding findMethod(ReferenceBinding receiverType, char[] selector, TypeBinding[] argumentTypes, InvocationSite invocationSite) {
MethodBinding methodBinding = super.findMethod(receiverType, selector, argumentTypes, invocationSite);
if (methodBinding != null && methodBinding.isValidBinding())
if (!canBeSeenByForCodeSnippet(methodBinding, receiverType, invocationSite, this))
return new ProblemMethodBinding(methodBinding, selector, argumentTypes, ProblemReasons.NotVisible);
return methodBinding;
}
示例13: getImplicitMethod
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; //导入方法依赖的package包/类
public MethodBinding getImplicitMethod(ReferenceBinding receiverType, char[] selector, TypeBinding[] argumentTypes, InvocationSite invocationSite) {
// retrieve an exact visible match (if possible)
MethodBinding methodBinding = findExactMethod(receiverType, selector, argumentTypes, invocationSite);
if (methodBinding == null)
methodBinding = findMethod(receiverType, selector, argumentTypes, invocationSite);
if (methodBinding != null) { // skip it if we did not find anything
if (methodBinding.isValidBinding())
if (!canBeSeenByForCodeSnippet(methodBinding, receiverType, invocationSite, this))
return new ProblemMethodBinding(methodBinding, selector, argumentTypes, ProblemReasons.NotVisible);
return methodBinding;
}
return new ProblemMethodBinding(selector, argumentTypes, ProblemReasons.NotFound);
}
示例14: sIsMoreSpecific
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; //导入方法依赖的package包/类
public boolean sIsMoreSpecific(TypeBinding s, TypeBinding t, Scope skope) {
// 15.12.2.5
if (super.sIsMoreSpecific(s, t, skope))
return true;
if (argumentsTypeElided() || t.findSuperTypeOriginatingFrom(s) != null)
return false;
s = s.capture(this.enclosingScope, this.sourceEnd);
MethodBinding sSam = s.getSingleAbstractMethod(this.enclosingScope, true);
if (sSam == null || !sSam.isValidBinding())
return false;
TypeBinding r1 = sSam.returnType;
MethodBinding tSam = t.getSingleAbstractMethod(this.enclosingScope, true);
if (tSam == null || !tSam.isValidBinding())
return false;
TypeBinding r2 = tSam.returnType;
if (r2.id == TypeIds.T_void)
return true;
if (r1.id == TypeIds.T_void)
return false;
// r1 <: r2
if (r1.isCompatibleWith(r2, skope))
return true;
Expression [] returnExpressions = this.resultExpressions;
int returnExpressionsLength = returnExpressions == null ? 0 : returnExpressions.length;
int i;
// r1 is a primitive type, r2 is a reference type, and each result expression is a standalone expression (15.2) of a primitive type
if (r1.isBaseType() && !r2.isBaseType()) {
for (i = 0; i < returnExpressionsLength; i++) {
if (returnExpressions[i].isPolyExpression() || !returnExpressions[i].resolvedType.isBaseType())
break;
}
if (i == returnExpressionsLength)
return true;
}
if (!r1.isBaseType() && r2.isBaseType()) {
for (i = 0; i < returnExpressionsLength; i++) {
if (returnExpressions[i].resolvedType.isBaseType())
break;
}
if (i == returnExpressionsLength)
return true;
}
if (r1.isFunctionalInterface(this.enclosingScope) && r2.isFunctionalInterface(this.enclosingScope)) {
for (i = 0; i < returnExpressionsLength; i++) {
Expression resultExpression = returnExpressions[i];
if (!resultExpression.sIsMoreSpecific(r1, r2, skope))
break;
}
if (i == returnExpressionsLength)
return true;
}
return false;
}