public boolean doesParameterLengthMatch(int suggestedParameterLength) { int len = this.parameters.length; return len <= suggestedParameterLength || (isVarargs() && len == suggestedParameterLength + 1); } public void updateTypeVariableBinding(TypeVariableBinding previousBinding, TypeVariableBinding updatedBinding) {
/** * @see org.eclipse.jdt.core.dom.IMethodBinding#isVarargs() * @since 3.1 */ @Override public boolean isVarargs() { return this.binding.isVarargs(); }
/** * @see org.eclipse.jdt.core.dom.IMethodBinding#isVarargs() * @since 3.1 */ public boolean isVarargs() { return this.binding.isVarargs(); }
public boolean doesParameterLengthMatch(int suggestedParameterLength) { int len = this.parameters.length; return len <= suggestedParameterLength || (isVarargs() && len == suggestedParameterLength + 1); } public void updateTypeVariableBinding(TypeVariableBinding previousBinding, TypeVariableBinding updatedBinding) {
public void methodMustOverride(AbstractMethodDeclaration method, long complianceLevel) { MethodBinding binding = method.binding; this.handle( complianceLevel == ClassFileConstants.JDK1_5 ? IProblem.MethodMustOverride : IProblem.MethodMustOverrideOrImplement, new String[] {new String(binding.selector), typesAsString(binding.isVarargs(), binding.parameters, false), new String(binding.declaringClass.readableName()), }, new String[] {new String(binding.selector), typesAsString(binding.isVarargs(), binding.parameters, true), new String(binding.declaringClass.shortReadableName()),}, method.sourceStart, method.sourceEnd); }
public void cannotDireclyInvokeAbstractMethod(MessageSend messageSend, MethodBinding method) { this.handle( IProblem.DirectInvocationOfAbstractMethod, new String[] {new String(method.declaringClass.readableName()), new String(method.selector), typesAsString(method.isVarargs(), method.parameters, false)}, new String[] {new String(method.declaringClass.shortReadableName()), new String(method.selector), typesAsString(method.isVarargs(), method.parameters, true)}, messageSend.sourceStart, messageSend.sourceEnd); } public void cannotExtendEnum(SourceTypeBinding type, TypeReference superclass, TypeBinding superTypeBinding) {
public void methodMustOverride(AbstractMethodDeclaration method) { MethodBinding binding = method.binding; this.handle( this.options.sourceLevel == ClassFileConstants.JDK1_5 ? IProblem.MethodMustOverride : IProblem.MethodMustOverrideOrImplement, new String[] {new String(binding.selector), typesAsString(binding.isVarargs(), binding.parameters, false), new String(binding.declaringClass.readableName()), }, new String[] {new String(binding.selector), typesAsString(binding.isVarargs(), binding.parameters, true), new String(binding.declaringClass.shortReadableName()),}, method.sourceStart, method.sourceEnd); }
private boolean shouldTryVarargs(MethodBinding method, TypeBinding resolvedType, TypeBinding targetType) { if (!method.isVarargs()) return false; if (targetType == null) return true; // off range if (targetType.isArrayType() && resolvedType != null && !resolvedType.isCompatibleWith(targetType, this)) return true; // not a direct match but hope to improve return false; }
public void indirectAccessToStaticMethod(ASTNode location, MethodBinding method) { int severity = computeSeverity(IProblem.IndirectAccessToStaticMethod); if (severity == ProblemSeverities.Ignore) return; this.handle( IProblem.IndirectAccessToStaticMethod, new String[] {new String(method.declaringClass.readableName()), new String(method.selector), typesAsString(method.isVarargs(), method.parameters, false)}, new String[] {new String(method.declaringClass.shortReadableName()), new String(method.selector), typesAsString(method.isVarargs(), method.parameters, true)}, severity, location.sourceStart, location.sourceEnd); } public void inheritedMethodReducesVisibility(SourceTypeBinding type, MethodBinding concreteMethod, MethodBinding[] abstractMethods) {
private boolean shouldGenerateImplicitLambda(BlockScope currentScope) { // these cases are either too complicated, impossible to handle or result in significant code duplication return (this.binding.isVarargs() || (isConstructorReference() && this.receiverType.syntheticOuterLocalVariables() != null && this.shouldCaptureInstance) || this.requiresBridges()); // bridges. // To fix: We should opt for direct code generation wherever possible. }
private boolean shouldGenerateImplicitLambda(BlockScope currentScope) { // these cases are either too complicated, impossible to handle or result in significant code duplication return (this.binding.isVarargs() || (isConstructorReference() && this.receiverType.syntheticOuterLocalVariables() != null && this.shouldCaptureInstance) || this.requiresBridges()); // bridges. // To fix: We should opt for direct code generation wherever possible. }
private boolean shouldGenerateImplicitLambda(BlockScope currentScope) { // these cases are either too complicated, impossible to handle or result in significant code duplication return (this.binding.isVarargs() || (isConstructorReference() && this.receiverType.syntheticOuterLocalVariables() != null && this.shouldCaptureInstance) || this.requiresBridges() || // bridges. !isDirectCodeGenPossible()); // To fix: We should opt for direct code generation wherever possible. } private boolean isDirectCodeGenPossible() {
private boolean shouldGenerateImplicitLambda(BlockScope currentScope) { // these cases are either too complicated, impossible to handle or result in significant code duplication return (this.binding.isVarargs() || (isConstructorReference() && this.receiverType.syntheticOuterLocalVariables() != null && this.shouldCaptureInstance) || this.requiresBridges() || // bridges. !isDirectCodeGenPossible()); // To fix: We should opt for direct code generation wherever possible. } private boolean isDirectCodeGenPossible() {
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; }
private boolean shouldGenerateImplicitLambda(BlockScope currentScope) { // these cases are either too complicated, impossible to handle or result in significant code duplication return (this.binding.isVarargs() || (isConstructorReference() && this.receiverType.syntheticOuterLocalVariables() != null && currentScope.methodScope().isStatic) || this.expectedType instanceof IntersectionCastTypeBinding || // marker interfaces require alternate meta factory. this.expectedType.findSuperTypeOriginatingFrom(currentScope.getJavaIoSerializable()) != null || // serialization support. this.requiresBridges()); // bridges. // To fix: We should opt for direct code generation wherever possible. }
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; }
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; }