public abstract class AbstractPendingLinkingCandidate<Expression extends XExpression> extends AbstractLinkingCandidate<Expression>
AbstractLinkingCandidate.ArgumentTypeComputationState, AbstractLinkingCandidate.ObservableTypeExpectation| Modifier and Type | Field and Description |
|---|---|
protected IIdentifiableElementDescription |
description
The backing feature descriptions.
|
arguments, typeArguments| Modifier | Constructor and Description |
|---|---|
protected |
AbstractPendingLinkingCandidate(Expression expression,
IIdentifiableElementDescription description,
ITypeExpectation expectation,
ExpressionTypeComputationState state) |
protected |
AbstractPendingLinkingCandidate(Expression expression,
IIdentifiableElementDescription description,
ITypeExpectation expectation,
ExpressionTypeComputationState state,
PendingLinkingCandidateResolver<Expression> pendingLinkingCandidateResolver) |
| Modifier and Type | Method and Description |
|---|---|
protected CandidateCompareResult |
compareByArgumentTypes(AbstractPendingLinkingCandidate<?> right) |
protected CandidateCompareResult |
compareByArgumentTypes(AbstractPendingLinkingCandidate<?> right,
boolean recompute) |
protected CandidateCompareResult |
compareByArgumentTypes(AbstractPendingLinkingCandidate<?> other,
int leftBoxing,
int rightBoxing,
int leftDemand,
int rightDemand)
Compare this linking candidate with the given
other candidate at argumentIndex
Returns CandidateCompareResult#THIS if this candidate is better, CandidateCompareResult#OTHER if the
right candidate was better, CandidateCompareResult#AMBIGUOUS if both candidates are valid
but ambiguous or CandidateCompareResult#EQUALLY_INVALID if both candidates are
ambiguous but erroneous. |
protected CandidateCompareResult |
compareByArgumentTypesFlags(AbstractPendingLinkingCandidate<?> other,
int leftIdx,
int rightIdx,
int leftConformance,
int rightConformance)
Compare this linking candidate with the given
other candidate at leftIdx and rightIdx respectively. |
protected CandidateCompareResult |
compareByArity(int leftArityMismatch,
int rightArityMismatch) |
protected CandidateCompareResult |
compareByArityWith(AbstractPendingLinkingCandidate<?> right) |
protected CandidateCompareResult |
compareByBoxing(int leftBoxing,
int rightBoxing) |
protected CandidateCompareResult |
compareByBucket(AbstractPendingLinkingCandidate<?> right) |
protected CandidateCompareResult |
compareByName(AbstractPendingLinkingCandidate<?> right) |
protected CandidateCompareResult |
compareByTypeArguments(AbstractPendingLinkingCandidate<?> right) |
protected int |
compareDeclaredTypes(LightweightTypeReference left,
LightweightTypeReference right,
boolean leftResolved,
boolean rightResolved) |
protected CandidateCompareResult |
compareExpectedArgumentTypes(AbstractPendingLinkingCandidate<?> right) |
protected CandidateCompareResult |
compareTo(AbstractPendingLinkingCandidate<?> right)
Returns
CandidateCompareResult#THIS if this candidate is better, CandidateCompareResult#OTHER if the
right candidate was better, CandidateCompareResult#AMBIGUOUS if both candidates are valid
but ambiguous or CandidateCompareResult#EQUALLY_INVALID if both candidates are
ambiguous but erroneous. |
protected CandidateCompareResult |
compareTo(AbstractPendingLinkingCandidate<?> right,
boolean invalid)
Returns
CandidateCompareResult#THIS if this candidate is better, CandidateCompareResult#OTHER if the
right candidate was better, CandidateCompareResult#AMBIGUOUS if both candidates are valid
but ambiguous or CandidateCompareResult#EQUALLY_INVALID if both candidates are
ambiguous but erroneous. |
protected abstract ILinkingCandidate |
createAmbiguousLinkingCandidate(AbstractPendingLinkingCandidate<?> second)
Produce a candidate that carries the information about ambiguous candidates.
|
protected ILinkingCandidate |
createSuspiciousLinkingCandidate(AbstractPendingLinkingCandidate<?> chosenCandidate)
Produce a candidate that carries the information about suspicious overload resolution where
a member on 'this' wins over a member on 'it'.
|
protected java.lang.String |
getArgumentTypesAsString()
Returns the resolved string representation of the argument types.
|
int |
getArityMismatch()
Returns the mismatch of actually given arguments and declared parameters.
|
protected int |
getArityMismatch(org.eclipse.xtext.common.types.JvmExecutable executable,
java.util.List<XExpression> arguments) |
protected int |
getConformanceFlags(int idx,
boolean recompute) |
protected org.eclipse.emf.ecore.EReference |
getDefaultValidationFeature() |
protected CandidateCompareResult |
getExpectedTypeCompareResultOther(AbstractPendingLinkingCandidate<?> other)
Returns the compare result for the declared parameter types if the given other candidate had won.
|
org.eclipse.xtext.common.types.JvmIdentifiableElement |
getFeature()
The currently considered feature (if any).
|
protected java.lang.String |
getFeatureParameterTypesAsString()
Returns the unresolved string representation of the parameter types of the feature.
|
protected java.lang.String |
getFeatureParameterTypesAsString(org.eclipse.xtext.common.types.JvmExecutable executable) |
protected abstract java.lang.String |
getFeatureTypeName()
Returns the name of the feature type, e.g.
|
protected java.lang.String |
getFeatureTypeParametersAsString(boolean showBounds)
Returns the unresolved string representation of the unresolved type parameters of the feature.
|
protected org.eclipse.emf.ecore.EReference |
getInvalidArgumentsValidationFeature() |
ILinkingCandidate |
getPreferredCandidate(ILinkingCandidate other)
Returns the best candidate considering the this and the given other candidate.
|
protected org.eclipse.xtext.diagnostics.Severity |
getSeverity(java.lang.String issueCode)
Returns the current severity for the given issue code.
|
protected java.lang.String |
getSimpleFeatureName() |
protected java.util.List<XExpression> |
getSyntacticArguments() |
protected int |
getTypeArgumentConformanceFailures(org.eclipse.xtext.util.IAcceptor<? super org.eclipse.xtext.diagnostics.AbstractDiagnostic> acceptor) |
protected java.lang.String |
getTypeArgumentsAsString(java.util.List<? extends LightweightTypeReference> typeArguments)
Returns the resolved string representation of the type arguments.
|
int |
getTypeArityMismatch() |
protected java.lang.String |
getTypeParameterAsString(org.eclipse.xtext.common.types.JvmTypeParameter typeParameter)
Returns the unresolved string representation of the given type parameter.
|
protected java.util.Map<org.eclipse.xtext.common.types.JvmTypeParameter,LightweightMergedBoundTypeArgument> |
getTypeParameterMapping()
Returns the mapping of type parameters to their bound arguments.
|
protected org.eclipse.xtext.diagnostics.Severity |
getUnhandledExceptionSeverity(org.eclipse.xtext.common.types.JvmExecutable executable)
Obtain the currently applicable severity for uncaught exceptions.
|
protected boolean |
isDefiniteEarlyExit(XExpression expression) |
protected boolean |
isExtension() |
protected boolean |
isLambdaExpression(int argumentIdx) |
protected boolean |
isPossibleFunctionType(int idx)
Returns false if the argument expression is a lambda and the expected type
of the argument is not a function type or
Object. |
protected boolean |
isVarArgs() |
protected boolean |
isVisible() |
protected void |
resolveLinkingProxy(org.eclipse.emf.ecore.EReference structuralFeature,
int featureId) |
java.lang.String |
toString() |
boolean |
validate(org.eclipse.xtext.util.IAcceptor<? super org.eclipse.xtext.diagnostics.AbstractDiagnostic> result)
Validates this linking candidate and adds respective diagnostics to the given queue.
|
protected boolean |
validateArity(org.eclipse.xtext.util.IAcceptor<? super org.eclipse.xtext.diagnostics.AbstractDiagnostic> result) |
protected boolean |
validateTypeArgumentConformance(org.eclipse.xtext.util.IAcceptor<? super org.eclipse.xtext.diagnostics.AbstractDiagnostic> result) |
protected boolean |
validateTypeArity(org.eclipse.xtext.util.IAcceptor<? super org.eclipse.xtext.diagnostics.AbstractDiagnostic> result) |
protected boolean |
validateUnhandledExceptions(org.eclipse.xtext.util.IAcceptor<? super org.eclipse.xtext.diagnostics.AbstractDiagnostic> result) |
protected boolean |
validateUnhandledExceptions(org.eclipse.xtext.common.types.JvmExecutable executable,
org.eclipse.xtext.util.IAcceptor<? super org.eclipse.xtext.diagnostics.AbstractDiagnostic> result) |
protected boolean |
validateVisibility(org.eclipse.xtext.util.IAcceptor<? super org.eclipse.xtext.diagnostics.AbstractDiagnostic> result) |
accept, applyToComputationState, computeArgumentType, computeArgumentTypes, computeFixedArityArgumentType, computeVarArgumentType, createArgumentTypeSubstitutor, createLinkingTypeComputationState, createVarArgTypeComputationState, deferredBindTypeArgument, discardRefinementTypeIfReassigned, getActualType, getActualType, getArguments, getDeclaratorParameterMapping, getDeclaredType, getDeclaredTypeParameters, getExpectedType, getExpression, getPlainSyntacticTypeArguments, getState, getSubstitutedExpectedType, getSyntacticTypeArguments, getTypeArguments, hasReceiver, initializeArgumentTypeComputation, initializeConstraintMapping, initializeMapping, initializeTypeParameterMapping, initializeTypeParameterMapping, isBoundTypeArgumentSkipped, isRawTypeContext, isTypeLiteral, mustDiscardRefinement, preApply, resolveAgainstActualType, resolveArgumentTypeclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitapplyToModelprotected final IIdentifiableElementDescription description
protected AbstractPendingLinkingCandidate(Expression expression, IIdentifiableElementDescription description, ITypeExpectation expectation, ExpressionTypeComputationState state)
protected AbstractPendingLinkingCandidate(Expression expression, IIdentifiableElementDescription description, ITypeExpectation expectation, ExpressionTypeComputationState state, PendingLinkingCandidateResolver<Expression> pendingLinkingCandidateResolver)
protected java.util.Map<org.eclipse.xtext.common.types.JvmTypeParameter,LightweightMergedBoundTypeArgument> getTypeParameterMapping()
getTypeParameterMapping in class AbstractLinkingCandidate<Expression extends XExpression>AbstractLinkingCandidate.initializeTypeParameterMapping()protected abstract java.lang.String getFeatureTypeName()
JvmOperation may
return method, a XVariableDeclaration may identify itself as local variable.protected java.lang.String getArgumentTypesAsString()
protected java.lang.String getFeatureParameterTypesAsString()
protected java.lang.String getFeatureParameterTypesAsString(org.eclipse.xtext.common.types.JvmExecutable executable)
protected java.lang.String getFeatureTypeParametersAsString(boolean showBounds)
protected java.lang.String getTypeParameterAsString(org.eclipse.xtext.common.types.JvmTypeParameter typeParameter)
Object.protected java.lang.String getTypeArgumentsAsString(java.util.List<? extends LightweightTypeReference> typeArguments)
public boolean validate(org.eclipse.xtext.util.IAcceptor<? super org.eclipse.xtext.diagnostics.AbstractDiagnostic> result)
true if further validation should be performed.protected boolean validateVisibility(org.eclipse.xtext.util.IAcceptor<? super org.eclipse.xtext.diagnostics.AbstractDiagnostic> result)
protected java.lang.String getSimpleFeatureName()
protected org.eclipse.emf.ecore.EReference getDefaultValidationFeature()
protected org.eclipse.emf.ecore.EReference getInvalidArgumentsValidationFeature()
protected boolean validateArity(org.eclipse.xtext.util.IAcceptor<? super org.eclipse.xtext.diagnostics.AbstractDiagnostic> result)
protected boolean validateTypeArity(org.eclipse.xtext.util.IAcceptor<? super org.eclipse.xtext.diagnostics.AbstractDiagnostic> result)
protected boolean validateTypeArgumentConformance(org.eclipse.xtext.util.IAcceptor<? super org.eclipse.xtext.diagnostics.AbstractDiagnostic> result)
protected boolean validateUnhandledExceptions(org.eclipse.xtext.util.IAcceptor<? super org.eclipse.xtext.diagnostics.AbstractDiagnostic> result)
protected boolean validateUnhandledExceptions(org.eclipse.xtext.common.types.JvmExecutable executable,
org.eclipse.xtext.util.IAcceptor<? super org.eclipse.xtext.diagnostics.AbstractDiagnostic> result)
protected org.eclipse.xtext.diagnostics.Severity getUnhandledExceptionSeverity(org.eclipse.xtext.common.types.JvmExecutable executable)
executable - the executable that declares the exception.protected org.eclipse.xtext.diagnostics.Severity getSeverity(java.lang.String issueCode)
protected boolean isDefiniteEarlyExit(XExpression expression)
protected java.util.List<XExpression> getSyntacticArguments()
public ILinkingCandidate getPreferredCandidate(ILinkingCandidate other)
protected abstract ILinkingCandidate createAmbiguousLinkingCandidate(AbstractPendingLinkingCandidate<?> second)
protected ILinkingCandidate createSuspiciousLinkingCandidate(AbstractPendingLinkingCandidate<?> chosenCandidate)
chosenCandidate - the candidate that was picked.protected final CandidateCompareResult compareTo(AbstractPendingLinkingCandidate<?> right)
CandidateCompareResult#THIS if this candidate is better, CandidateCompareResult#OTHER if the
right candidate was better, CandidateCompareResult#AMBIGUOUS if both candidates are valid
but ambiguous or CandidateCompareResult#EQUALLY_INVALID if both candidates are
ambiguous but erroneous.protected CandidateCompareResult compareTo(AbstractPendingLinkingCandidate<?> right, boolean invalid)
CandidateCompareResult#THIS if this candidate is better, CandidateCompareResult#OTHER if the
right candidate was better, CandidateCompareResult#AMBIGUOUS if both candidates are valid
but ambiguous or CandidateCompareResult#EQUALLY_INVALID if both candidates are
ambiguous but erroneous.
The invalid flag indicates if we already know that both candidates are equally invalid.protected CandidateCompareResult compareByName(AbstractPendingLinkingCandidate<?> right)
protected CandidateCompareResult compareByBucket(AbstractPendingLinkingCandidate<?> right)
protected boolean isVisible()
protected boolean isVarArgs()
protected boolean isExtension()
protected CandidateCompareResult compareByArgumentTypes(AbstractPendingLinkingCandidate<?> right)
protected CandidateCompareResult compareByTypeArguments(AbstractPendingLinkingCandidate<?> right)
protected int getTypeArgumentConformanceFailures(org.eclipse.xtext.util.IAcceptor<? super org.eclipse.xtext.diagnostics.AbstractDiagnostic> acceptor)
protected CandidateCompareResult compareByArgumentTypes(AbstractPendingLinkingCandidate<?> right, boolean recompute)
protected CandidateCompareResult compareByArgumentTypesFlags(AbstractPendingLinkingCandidate<?> other, int leftIdx, int rightIdx, int leftConformance, int rightConformance)
other candidate at leftIdx and rightIdx respectively.
Returns CandidateCompareResult#THIS if this candidate is better, CandidateCompareResult#OTHER if the
right candidate was better, CandidateCompareResult#AMBIGUOUS if both candidates are valid
but ambiguous or CandidateCompareResult#EQUALLY_INVALID if both candidates are
ambiguous but erroneous.other - the other candidateleftIdx - the semantic argument index on this candidaterightIdx - the semantic argument index on the other candidateleftConformance - the computed conformance in this linking candidaterightConformance - the computed conformance if the other candidate was chosenprotected CandidateCompareResult compareByArgumentTypes(AbstractPendingLinkingCandidate<?> other, int leftBoxing, int rightBoxing, int leftDemand, int rightDemand)
other candidate at argumentIndex
Returns CandidateCompareResult#THIS if this candidate is better, CandidateCompareResult#OTHER if the
right candidate was better, CandidateCompareResult#AMBIGUOUS if both candidates are valid
but ambiguous or CandidateCompareResult#EQUALLY_INVALID if both candidates are
ambiguous but erroneous.other - the other candidate (the rhs of the comparison)leftBoxing - the number of required boxing conversions if this candidate was chosenrightBoxing - the number of required boxing conversions if the other candidate was chosenleftDemand - the number of required demand conversions if this candidate was chosenrightDemand - the number of required demand conversions if the other candidate was chosenprotected CandidateCompareResult compareByBoxing(int leftBoxing, int rightBoxing)
protected boolean isPossibleFunctionType(int idx)
Object.
Returns true in all other cases.
This serves as a shortcut to rule out decision path's where a method is overloaded
and one of the overloads accepts a function type but the other doesn't. In those cases
it is not necessary to compute the type of the lamdba expression twice.
An example for this pattern is IterableExtensions.filter(Iterable, Class) vs
IterableExtensions.filter(Iterable, org.eclipse.xtext.xbase.lib.Functions.Function1).protected int getConformanceFlags(int idx,
boolean recompute)
protected boolean isLambdaExpression(int argumentIdx)
protected CandidateCompareResult compareExpectedArgumentTypes(AbstractPendingLinkingCandidate<?> right)
protected int compareDeclaredTypes(LightweightTypeReference left, LightweightTypeReference right, boolean leftResolved, boolean rightResolved)
protected CandidateCompareResult getExpectedTypeCompareResultOther(AbstractPendingLinkingCandidate<?> other)
other - the winner of the comparison.protected CandidateCompareResult compareByArityWith(AbstractPendingLinkingCandidate<?> right)
protected CandidateCompareResult compareByArity(int leftArityMismatch, int rightArityMismatch)
public int getArityMismatch()
public int getTypeArityMismatch()
protected void resolveLinkingProxy(org.eclipse.emf.ecore.EReference structuralFeature,
int featureId)
protected int getArityMismatch(org.eclipse.xtext.common.types.JvmExecutable executable,
java.util.List<XExpression> arguments)
public org.eclipse.xtext.common.types.JvmIdentifiableElement getFeature()
ILinkingCandidatenull.getFeature in interface ILinkingCandidategetFeature in class AbstractLinkingCandidate<Expression extends XExpression>public java.lang.String toString()
toString in class java.lang.Object