public MethodBinding getMethodBinding() { if (this.actualMethodBinding == null) { if (this.binding != null) { this.actualMethodBinding = new MethodBinding(this.binding.modifiers, this.binding.selector, this.binding.returnType, this.binding instanceof SyntheticMethodBinding ? this.descriptor.parameters : this.binding.parameters, // retain any faults in parameter list. this.binding.thrownExceptions, this.binding.declaringClass); this.actualMethodBinding.tagBits = this.binding.tagBits; } else { this.actualMethodBinding = new ProblemMethodBinding(CharOperation.NO_CHAR, null, ProblemReasons.NoSuchSingleAbstractMethod); } } return this.actualMethodBinding; }
public TypeBinding getSAMType(Scope scope) { TypeBinding samType = null; for (int i = 0, max = this.intersectingTypes.length; i < max; i++) { TypeBinding typeBinding = this.intersectingTypes[i]; MethodBinding methodBinding = typeBinding.getSingleAbstractMethod(scope, true); // Why doesn't getSingleAbstractMethod do as the javadoc says, and return null // when it is not a SAM type if (methodBinding instanceof ProblemMethodBinding && ((ProblemMethodBinding) methodBinding).problemId()==ProblemReasons.NoSuchSingleAbstractMethod) { continue; } if (samType != null) { return null; // There is more than one (!), so we don't know which } samType = typeBinding; } return samType; }
public MethodBinding getMethodBinding() { if (this.actualMethodBinding == null) { if (this.binding != null) { this.actualMethodBinding = new MethodBinding(this.binding.modifiers, this.binding.selector, this.binding.returnType, this.binding instanceof SyntheticMethodBinding ? this.descriptor.parameters : this.binding.parameters, // retain any faults in parameter list. this.binding.thrownExceptions, this.binding.declaringClass); this.actualMethodBinding.tagBits = this.binding.tagBits; } else { this.actualMethodBinding = new ProblemMethodBinding(CharOperation.NO_CHAR, null, ProblemReasons.NoSuchSingleAbstractMethod); } } return this.actualMethodBinding; }
public TypeBinding getSAMType(Scope scope) { TypeBinding samType = null; for (int i = 0, max = this.intersectingTypes.length; i < max; i++) { TypeBinding typeBinding = this.intersectingTypes[i]; MethodBinding methodBinding = typeBinding.getSingleAbstractMethod(scope, true); // Why doesn't getSingleAbstractMethod do as the javadoc says, and return null // when it is not a SAM type if (methodBinding instanceof ProblemMethodBinding && ((ProblemMethodBinding) methodBinding).problemId()==ProblemReasons.NoSuchSingleAbstractMethod) { continue; } if (samType != null) { return null; // There is more than one (!), so we don't know which } samType = typeBinding; } return samType; }
public MethodBinding getMethodBinding() { if (this.actualMethodBinding == null) { if (this.binding != null) { this.actualMethodBinding = new MethodBinding(this.binding.modifiers, this.binding.selector, this.binding.returnType, this.binding instanceof SyntheticMethodBinding ? this.descriptor.parameters : this.binding.parameters, // retain any faults in parameter list. this.binding.thrownExceptions, this.binding.declaringClass); this.actualMethodBinding.tagBits = this.binding.tagBits; } else { this.actualMethodBinding = new ProblemMethodBinding(CharOperation.NO_CHAR, null, ProblemReasons.NoSuchSingleAbstractMethod); } } return this.actualMethodBinding; }
public TypeBinding getSAMType(Scope scope) { TypeBinding samType = null; for (int i = 0, max = this.intersectingTypes.length; i < max; i++) { TypeBinding typeBinding = this.intersectingTypes[i]; MethodBinding methodBinding = typeBinding.getSingleAbstractMethod(scope, true); // Why doesn't getSingleAbstractMethod do as the javadoc says, and return null // when it is not a SAM type if (methodBinding instanceof ProblemMethodBinding && ((ProblemMethodBinding) methodBinding).problemId()==ProblemReasons.NoSuchSingleAbstractMethod) { continue; } if (samType != null) { return null; // There is more than one (!), so we don't know which } samType = typeBinding; } return samType; }
public MethodBinding getMethodBinding() { if (this.actualMethodBinding == null) { if (this.binding != null) { // Get rid of the synthetic arguments added via addSyntheticArgument() TypeBinding[] newParams = null; if (this.binding instanceof SyntheticMethodBinding && this.outerLocalVariables.length > 0) { newParams = new TypeBinding[this.binding.parameters.length - this.outerLocalVariables.length]; System.arraycopy(this.binding.parameters, this.outerLocalVariables.length, newParams, 0, newParams.length); } else { newParams = this.binding.parameters; } this.actualMethodBinding = new MethodBinding(this.binding.modifiers, this.binding.selector, this.binding.returnType, newParams, this.binding.thrownExceptions, this.binding.declaringClass); this.actualMethodBinding.tagBits = this.binding.tagBits; } else { this.actualMethodBinding = new ProblemMethodBinding(CharOperation.NO_CHAR, null, ProblemReasons.NoSuchSingleAbstractMethod); } } return this.actualMethodBinding; }
public TypeBinding[] getMarkerInterfaces() { if (this.expectedType instanceof IntersectionCastTypeBinding) { Set markerBindings = new LinkedHashSet(); TypeBinding[] intersectionTypes = ((IntersectionCastTypeBinding)this.expectedType).intersectingTypes; for (int i = 0,max = intersectionTypes.length; i < max; i++) { TypeBinding typeBinding = intersectionTypes[i]; MethodBinding methodBinding = typeBinding.getSingleAbstractMethod(this.scope, true); // Why doesn't getSingleAbstractMethod do as the javadoc says, and return null // when it is not a SAM type if (!(methodBinding instanceof ProblemMethodBinding && ((ProblemMethodBinding)methodBinding).problemId()==ProblemReasons.NoSuchSingleAbstractMethod)) { continue; } if (typeBinding.id == TypeIds.T_JavaIoSerializable) { // Serializable is captured as a bitflag continue; } markerBindings.add(typeBinding); } if (markerBindings.size() > 0) { return (TypeBinding[])markerBindings.toArray(new TypeBinding[markerBindings.size()]); } } return null; }
public MethodBinding getMethodBinding() { if (this.actualMethodBinding == null) { if (this.binding != null) { // Get rid of the synthetic arguments added via addSyntheticArgument() TypeBinding[] newParams = null; if (this.binding instanceof SyntheticMethodBinding && this.outerLocalVariables.length > 0) { newParams = new TypeBinding[this.binding.parameters.length - this.outerLocalVariables.length]; System.arraycopy(this.binding.parameters, this.outerLocalVariables.length, newParams, 0, newParams.length); } else { newParams = this.binding.parameters; } this.actualMethodBinding = new MethodBinding(this.binding.modifiers, this.binding.selector, this.binding.returnType, newParams, this.binding.thrownExceptions, this.binding.declaringClass); this.actualMethodBinding.tagBits = this.binding.tagBits; } else { this.actualMethodBinding = new ProblemMethodBinding(CharOperation.NO_CHAR, null, ProblemReasons.NoSuchSingleAbstractMethod); } } return this.actualMethodBinding; }
@Override public MethodBinding getMethodBinding() { if (this.actualMethodBinding == null) { if (this.binding != null) { // Get rid of the synthetic arguments added via addSyntheticArgument() TypeBinding[] newParams = null; if (this.binding instanceof SyntheticMethodBinding && this.outerLocalVariables.length > 0) { newParams = new TypeBinding[this.binding.parameters.length - this.outerLocalVariables.length]; System.arraycopy(this.binding.parameters, this.outerLocalVariables.length, newParams, 0, newParams.length); } else { newParams = this.binding.parameters; } this.actualMethodBinding = new MethodBinding(this.binding.modifiers, this.binding.selector, this.binding.returnType, newParams, this.binding.thrownExceptions, this.binding.declaringClass); this.actualMethodBinding.tagBits = this.binding.tagBits; } else { this.actualMethodBinding = new ProblemMethodBinding(CharOperation.NO_CHAR, null, ProblemReasons.NoSuchSingleAbstractMethod); } } return this.actualMethodBinding; }
public MethodBinding getMethodBinding() { if (this.actualMethodBinding == null) { if (this.binding != null) { // Get rid of the synthetic arguments added via addSyntheticArgument() TypeBinding[] newParams = null; if (this.binding instanceof SyntheticMethodBinding && this.outerLocalVariables.length > 0) { newParams = new TypeBinding[this.binding.parameters.length - this.outerLocalVariables.length]; System.arraycopy(this.binding.parameters, this.outerLocalVariables.length, newParams, 0, newParams.length); } else { newParams = this.binding.parameters; } this.actualMethodBinding = new MethodBinding(this.binding.modifiers, this.binding.selector, this.binding.returnType, newParams, this.binding.thrownExceptions, this.binding.declaringClass); this.actualMethodBinding.tagBits = this.binding.tagBits; } else { this.actualMethodBinding = new ProblemMethodBinding(CharOperation.NO_CHAR, null, ProblemReasons.NoSuchSingleAbstractMethod); } } return this.actualMethodBinding; }
public MethodBinding getMethodBinding() { if (this.actualMethodBinding == null) { if (this.binding != null) { // Get rid of the synthetic arguments added via addSyntheticArgument() TypeBinding[] newParams = null; if (this.binding instanceof SyntheticMethodBinding && this.outerLocalVariables.length > 0) { newParams = new TypeBinding[this.binding.parameters.length - this.outerLocalVariables.length]; System.arraycopy(this.binding.parameters, this.outerLocalVariables.length, newParams, 0, newParams.length); } else { newParams = this.binding.parameters; } this.actualMethodBinding = new MethodBinding(this.binding.modifiers, this.binding.selector, this.binding.returnType, newParams, this.binding.thrownExceptions, this.binding.declaringClass); this.actualMethodBinding.tagBits = this.binding.tagBits; } else { this.actualMethodBinding = new ProblemMethodBinding(CharOperation.NO_CHAR, null, ProblemReasons.NoSuchSingleAbstractMethod); } } return this.actualMethodBinding; }
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); } }
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); } }
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); } }
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); } }
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); } }
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); } }
/** * Create a problem method signaling failure of invocation type inference, * unless the given candidate is tolerable to be compatible with buggy javac. */ public MethodBinding getReturnProblemMethodIfNeeded(TypeBinding expectedType, MethodBinding method) { if (InferenceContext18.SIMULATE_BUG_JDK_8026527 && expectedType != null && method.returnType instanceof ReferenceBinding) { if (method.returnType.erasure().isCompatibleWith(expectedType)) return method; // don't count as problem. } if (expectedType == null) return method; // assume inference failure concerned another expression ProblemMethodBinding problemMethod = new ProblemMethodBinding(method, method.selector, method.parameters, ProblemReasons.ParameterizedMethodExpectedTypeProblem); problemMethod.returnType = expectedType; problemMethod.inferenceContext = this; return problemMethod; }
/** * Create a problem method signaling failure of invocation type inference, * unless the given candidate is tolerable to be compatible with buggy javac. */ public MethodBinding getReturnProblemMethodIfNeeded(TypeBinding expectedType, MethodBinding method) { if (InferenceContext18.SIMULATE_BUG_JDK_8026527 && expectedType != null && method.returnType instanceof ReferenceBinding) { if (method.returnType.erasure().isCompatibleWith(expectedType)) return method; // don't count as problem. } /* We used to check if expected type is null and if so return method, but that is wrong - it injects an incompatible method into overload resolution. if we get here with expected type set to null at all, the target context does not define a target type (vanilla context), so inference has done its best and nothing more to do than to signal error. */ ProblemMethodBinding problemMethod = new ProblemMethodBinding(method, method.selector, method.parameters, ProblemReasons.InvocationTypeInferenceFailure); problemMethod.returnType = expectedType != null ? expectedType : method.returnType; problemMethod.inferenceContext = this; return problemMethod; }