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 org.eclipse.xtext.xbase.typesystem.internal.CandidateCompareResult |
compareByArgumentTypes(AbstractPendingLinkingCandidate<?> right) |
protected org.eclipse.xtext.xbase.typesystem.internal.CandidateCompareResult |
compareByArgumentTypes(AbstractPendingLinkingCandidate<?> right,
boolean recompute) |
protected org.eclipse.xtext.xbase.typesystem.internal.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 org.eclipse.xtext.xbase.typesystem.internal.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 org.eclipse.xtext.xbase.typesystem.internal.CandidateCompareResult |
compareByArity(int leftArityMismatch,
int rightArityMismatch) |
protected org.eclipse.xtext.xbase.typesystem.internal.CandidateCompareResult |
compareByArityWith(AbstractPendingLinkingCandidate<?> right) |
protected org.eclipse.xtext.xbase.typesystem.internal.CandidateCompareResult |
compareByBoxing(int leftBoxing,
int rightBoxing) |
protected org.eclipse.xtext.xbase.typesystem.internal.CandidateCompareResult |
compareByBucket(AbstractPendingLinkingCandidate<?> right) |
protected org.eclipse.xtext.xbase.typesystem.internal.CandidateCompareResult |
compareByName(AbstractPendingLinkingCandidate<?> right) |
protected org.eclipse.xtext.xbase.typesystem.internal.CandidateCompareResult |
compareByTypeArguments(AbstractPendingLinkingCandidate<?> right) |
protected int |
compareDeclaredTypes(LightweightTypeReference left,
LightweightTypeReference right,
boolean leftResolved,
boolean rightResolved) |
protected org.eclipse.xtext.xbase.typesystem.internal.CandidateCompareResult |
compareExpectedArgumentTypes(AbstractPendingLinkingCandidate<?> right) |
protected org.eclipse.xtext.xbase.typesystem.internal.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 org.eclipse.xtext.xbase.typesystem.internal.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(JvmExecutable executable,
java.util.List<XExpression> arguments) |
protected int |
getConformanceFlags(int idx,
boolean recompute) |
protected org.eclipse.emf.ecore.EReference |
getDefaultValidationFeature() |
protected org.eclipse.xtext.xbase.typesystem.internal.CandidateCompareResult |
getExpectedTypeCompareResultOther(AbstractPendingLinkingCandidate<?> other)
Returns the compare result for the declared parameter types if the given other candidate had won.
|
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(JvmExecutable executable) |
protected abstract java.lang.String |
getFeatureTypeName()
Returns the name of the feature type, e.g. a feature of type
JvmOperation may
return method , a XVariableDeclaration may identify itself as local variable . |
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 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(IAcceptor<? super 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(JvmTypeParameter typeParameter)
Returns the unresolved string representation of the given type parameter.
|
protected java.util.Map<JvmTypeParameter,LightweightMergedBoundTypeArgument> |
getTypeParameterMapping()
Returns the mapping of type parameters to their bound arguments.
|
protected Severity |
getUnhandledExceptionSeverity(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(IAcceptor<? super AbstractDiagnostic> result)
Validates this linking candidate and adds respective diagnostics to the given queue.
|
protected boolean |
validateArity(IAcceptor<? super AbstractDiagnostic> result) |
protected boolean |
validateTypeArgumentConformance(IAcceptor<? super AbstractDiagnostic> result) |
protected boolean |
validateTypeArity(IAcceptor<? super AbstractDiagnostic> result) |
protected boolean |
validateUnhandledExceptions(IAcceptor<? super AbstractDiagnostic> result) |
protected boolean |
validateUnhandledExceptions(JvmExecutable executable,
IAcceptor<? super AbstractDiagnostic> result) |
protected boolean |
validateVisibility(IAcceptor<? super 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, resolveArgumentType
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
applyToModel
protected 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<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(JvmExecutable executable)
protected java.lang.String getFeatureTypeParametersAsString(boolean showBounds)
protected java.lang.String getTypeParameterAsString(JvmTypeParameter typeParameter)
Object
.protected java.lang.String getTypeArgumentsAsString(java.util.List<? extends LightweightTypeReference> typeArguments)
public boolean validate(IAcceptor<? super AbstractDiagnostic> result)
true
if further validation should be performed.protected boolean validateVisibility(IAcceptor<? super AbstractDiagnostic> result)
protected java.lang.String getSimpleFeatureName()
protected org.eclipse.emf.ecore.EReference getDefaultValidationFeature()
protected org.eclipse.emf.ecore.EReference getInvalidArgumentsValidationFeature()
protected boolean validateArity(IAcceptor<? super AbstractDiagnostic> result)
protected boolean validateTypeArity(IAcceptor<? super AbstractDiagnostic> result)
protected boolean validateTypeArgumentConformance(IAcceptor<? super AbstractDiagnostic> result)
protected boolean validateUnhandledExceptions(IAcceptor<? super AbstractDiagnostic> result)
protected boolean validateUnhandledExceptions(JvmExecutable executable, IAcceptor<? super AbstractDiagnostic> result)
protected Severity getUnhandledExceptionSeverity(JvmExecutable executable)
executable
- the executable that declares the exception.protected 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 org.eclipse.xtext.xbase.typesystem.internal.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 org.eclipse.xtext.xbase.typesystem.internal.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 org.eclipse.xtext.xbase.typesystem.internal.CandidateCompareResult compareByName(AbstractPendingLinkingCandidate<?> right)
protected org.eclipse.xtext.xbase.typesystem.internal.CandidateCompareResult compareByBucket(AbstractPendingLinkingCandidate<?> right)
protected boolean isVisible()
protected boolean isVarArgs()
protected boolean isExtension()
protected org.eclipse.xtext.xbase.typesystem.internal.CandidateCompareResult compareByArgumentTypes(AbstractPendingLinkingCandidate<?> right)
protected org.eclipse.xtext.xbase.typesystem.internal.CandidateCompareResult compareByTypeArguments(AbstractPendingLinkingCandidate<?> right)
protected int getTypeArgumentConformanceFailures(IAcceptor<? super AbstractDiagnostic> acceptor)
protected org.eclipse.xtext.xbase.typesystem.internal.CandidateCompareResult compareByArgumentTypes(AbstractPendingLinkingCandidate<?> right, boolean recompute)
protected org.eclipse.xtext.xbase.typesystem.internal.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 org.eclipse.xtext.xbase.typesystem.internal.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 org.eclipse.xtext.xbase.typesystem.internal.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 org.eclipse.xtext.xbase.typesystem.internal.CandidateCompareResult compareExpectedArgumentTypes(AbstractPendingLinkingCandidate<?> right)
protected int compareDeclaredTypes(LightweightTypeReference left, LightweightTypeReference right, boolean leftResolved, boolean rightResolved)
protected org.eclipse.xtext.xbase.typesystem.internal.CandidateCompareResult getExpectedTypeCompareResultOther(AbstractPendingLinkingCandidate<?> other)
other
- the winner of the comparison.protected org.eclipse.xtext.xbase.typesystem.internal.CandidateCompareResult compareByArityWith(AbstractPendingLinkingCandidate<?> right)
protected org.eclipse.xtext.xbase.typesystem.internal.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(JvmExecutable executable, java.util.List<XExpression> arguments)
public JvmIdentifiableElement getFeature()
ILinkingCandidate
null
.getFeature
in interface ILinkingCandidate
getFeature
in class AbstractLinkingCandidate<Expression extends XExpression>
public java.lang.String toString()
toString
in class java.lang.Object