/** 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; }
public int nullStatus(FlowInfo flowInfo, FlowContext flowContext) { if (this.binding.isValidBinding()) { // try to retrieve null status of this message send from an annotation of the called method: long tagBits = this.binding.tagBits; if ((tagBits & TagBits.AnnotationNullMASK) == 0L) // alternatively look for type annotation (will only be present in 1.8+): tagBits = this.binding.returnType.tagBits; return FlowInfo.tagBitsToNullStatus(tagBits); } return FlowInfo.UNKNOWN; } /**
public int nullStatus(FlowInfo flowInfo, FlowContext flowContext) { if (this.binding.isValidBinding()) { // try to retrieve null status of this message send from an annotation of the called method: long tagBits = this.binding.tagBits; if ((tagBits & TagBits.AnnotationNullMASK) == 0L) // alternatively look for type annotation (will only be present in 1.8+): tagBits = this.binding.returnType.tagBits; return FlowInfo.tagBitsToNullStatus(tagBits); } return FlowInfo.UNKNOWN; } /**
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; }
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; }
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; }
@Override public boolean isCompatibleWith(TypeBinding targetType, Scope scope) { ReferenceExpression copy = cachedResolvedCopy(targetType); return copy != null && copy.resolvedType != null && copy.resolvedType.isValidBinding() && copy.binding != null && copy.binding.isValidBinding(); }
@Override public boolean isFunctionalInterface(Scope scope) { MethodBinding method; return isInterface() && (method = getSingleAbstractMethod(scope, true)) != null && method.isValidBinding(); }
@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); }
@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); }
@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); }
public void resolve(BlockScope scope) { super.resolve(scope); // tolerate some error cases if (this.binding == null || !(this.binding.isValidBinding() || this.binding.problemId() == ProblemReasons.NotVisible)) throw new SelectionNodeFound(); else throw new SelectionNodeFound(this.binding); } }
public MethodBinding binding(TypeBinding targetType, boolean reportErrors, Scope scope) { if (reportErrors) { if (this.binding == null) scope.problemReporter().genericInferenceError("method is unexpectedly unresolved", this); //$NON-NLS-1$ else if (!this.binding.isValidBinding()) scope.problemReporter().invalidMethod(this, this.binding); } return this.binding; } public Expression[] arguments() {
private boolean checkAppropriate(MethodBinding compileTimeDeclaration, MethodBinding otherMethod, InvocationSite location) { if (otherMethod == null || !otherMethod.isValidBinding() || otherMethod == compileTimeDeclaration) return true; if (MethodVerifier.doesMethodOverride(otherMethod, compileTimeDeclaration, this.environment())) { problemReporter().illegalSuperCallBypassingOverride(location, compileTimeDeclaration, otherMethod.declaringClass); return false; } return true; } @Override
private boolean checkAppropriate(MethodBinding compileTimeDeclaration, MethodBinding otherMethod, InvocationSite location) { if (otherMethod == null || !otherMethod.isValidBinding() || otherMethod == compileTimeDeclaration) return true; if (MethodVerifier.doesMethodOverride(otherMethod, compileTimeDeclaration, this.environment())) { problemReporter().illegalSuperCallBypassingOverride(location, compileTimeDeclaration, otherMethod.declaringClass); return false; } return true; }
public TypeBinding resolveType(BlockScope scope) { TypeBinding type = super.resolveType(scope); if (type == null || type instanceof ProblemReferenceBinding || type instanceof PolyTypeBinding) return type; MethodBinding method = getMethodBinding(); if (method != null && method.isValidBinding() && !method.isSynthetic()) throw new SelectionNodeFound(this.actualMethodBinding); throw new SelectionNodeFound(); } }
public MethodBinding findMethod(ReferenceBinding receiverType, char[] selector, TypeBinding[] argumentTypes, InvocationSite invocationSite, boolean inStaticContext) { MethodBinding method = findMethod0(receiverType, selector, argumentTypes, invocationSite, inStaticContext); if (method != null && method.isValidBinding() && method.isVarargs()) { TypeBinding elementType = method.parameters[method.parameters.length - 1].leafComponentType(); if (elementType instanceof ReferenceBinding) { if (!((ReferenceBinding) elementType).canBeSeenBy(this)) { return new ProblemMethodBinding(method, method.selector, invocationSite.genericTypeArguments(), ProblemReasons.VarargsElementTypeNotVisible); } } } return method; }
public MethodBinding findMethod(ReferenceBinding receiverType, char[] selector, TypeBinding[] argumentTypes, InvocationSite invocationSite, boolean inStaticContext) { MethodBinding method = findMethod0(receiverType, selector, argumentTypes, invocationSite, inStaticContext); if (method != null && method.isValidBinding() && method.isVarargs()) { TypeBinding elementType = method.parameters[method.parameters.length - 1].leafComponentType(); if (elementType instanceof ReferenceBinding) { if (!((ReferenceBinding) elementType).canBeSeenBy(this)) { return new ProblemMethodBinding(method, method.selector, invocationSite.genericTypeArguments(), ProblemReasons.VarargsElementTypeNotVisible); } } } return method; }
public MethodBinding findMethod(ReferenceBinding receiverType, char[] selector, TypeBinding[] argumentTypes, InvocationSite invocationSite, boolean inStaticContext) { MethodBinding method = findMethod0(receiverType, selector, argumentTypes, invocationSite, inStaticContext); if (method != null && method.isValidBinding() && method.isVarargs()) { TypeBinding elementType = method.parameters[method.parameters.length - 1].leafComponentType(); if (elementType instanceof ReferenceBinding) { if (!((ReferenceBinding) elementType).canBeSeenBy(this)) { return new ProblemMethodBinding(method, method.selector, invocationSite.genericTypeArguments(), ProblemReasons.VarargsElementTypeNotVisible); } } } return method; }
public MethodBinding getConstructor(ReferenceBinding receiverType, TypeBinding[] argumentTypes, InvocationSite invocationSite) { MethodBinding method = getConstructor0(receiverType, argumentTypes, invocationSite); if (method != null && method.isValidBinding() && method.isVarargs()) { TypeBinding elementType = method.parameters[method.parameters.length - 1].leafComponentType(); if (elementType instanceof ReferenceBinding) { if (!((ReferenceBinding) elementType).canBeSeenBy(this)) { return new ProblemMethodBinding(method, method.selector, invocationSite.genericTypeArguments(), ProblemReasons.VarargsElementTypeNotVisible); } } } return method; }