public class FeatureLinkingCandidate extends AbstractPendingLinkingCandidate<XAbstractFeatureCall> implements IFeatureLinkingCandidate, IFeatureNames
AbstractLinkingCandidate.ArgumentTypeComputationState, AbstractLinkingCandidate.ObservableTypeExpectationdescriptionarguments, typeArgumentsIT, SELF, SUPER, THIS| Constructor and Description |
|---|
FeatureLinkingCandidate(XAbstractFeatureCall featureCall,
IIdentifiableElementDescription description,
ITypeExpectation expectation,
ExpressionTypeComputationState state) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
applyImplicitReceiver() |
void |
applyToModel(IResolvedTypes resolvedTypes)
Injects the resolved feature into the model with the same semantics as the implicit
resolve
of EMF. |
protected CandidateCompareResult |
compareByArgumentTypes(AbstractPendingLinkingCandidate<?> right) |
protected CandidateCompareResult |
compareByArgumentTypes(AbstractPendingLinkingCandidate<?> right,
boolean recompute) |
protected CandidateCompareResult |
compareByArgumentTypes(AbstractPendingLinkingCandidate<?> right,
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 |
compareByArgumentTypes(FeatureLinkingCandidate right,
int leftBoxing,
int rightBoxing) |
protected CandidateCompareResult |
compareByArgumentTypesAndStaticFlag(FeatureLinkingCandidate right,
int leftBoxing,
int rightBoxing) |
protected CandidateCompareResult |
compareByArgumentTypesFlags(AbstractPendingLinkingCandidate<?> right,
int leftIdx,
int rightIdx,
int leftConformance,
int rightConformance)
Compare this linking candidate with the given
other candidate at leftIdx and rightIdx respectively. |
protected CandidateCompareResult |
compareByArityWith(AbstractPendingLinkingCandidate<?> right) |
protected CandidateCompareResult |
compareByAssignmentName(AbstractPendingLinkingCandidate<?> right) |
protected CandidateCompareResult |
compareByBucket(AbstractPendingLinkingCandidate<?> right) |
protected CandidateCompareResult |
compareByName(AbstractPendingLinkingCandidate<?> right) |
protected CandidateCompareResult |
compareByNameAndStaticFlag(AbstractPendingLinkingCandidate<?> right) |
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 void |
computeVarArgumentType(IFeatureCallArgumentSlot slot,
TypeParameterSubstitutor<?> substitutor) |
protected ILinkingCandidate |
createAmbiguousLinkingCandidate(AbstractPendingLinkingCandidate<?> second)
Produce a candidate that carries the information about ambiguous candidates.
|
protected java.util.List<XExpression> |
createArgumentList(XExpression head,
java.util.List<XExpression> tail) |
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.util.List<XExpression> |
getArguments()
Returns the actual arguments of the expression.
|
protected int |
getConformanceFlags(int idx,
boolean recompute) |
protected java.util.Map<org.eclipse.xtext.common.types.JvmTypeParameter,LightweightMergedBoundTypeArgument> |
getDeclaratorParameterMapping() |
protected LightweightTypeReference |
getDeclaredType(org.eclipse.xtext.common.types.JvmIdentifiableElement feature) |
protected CandidateCompareResult |
getExpectedTypeCompareResultOther(AbstractPendingLinkingCandidate<?> right)
Returns the compare result for the declared parameter types if the given other candidate had won.
|
XAbstractFeatureCall |
getFeatureCall()
Returns the feature call that is linked.
|
protected java.lang.String |
getFeatureTypeName()
Returns the name of the feature type, e.g.
|
protected XExpression |
getFirstArgument()
Returns the first argument if this is an extension.
|
protected LightweightTypeReference |
getFirstArgumentType() |
protected XExpression |
getImplicitFirstArgument() |
protected LightweightTypeReference |
getImplicitFirstArgumentType() |
protected XExpression |
getImplicitReceiver() |
protected LightweightTypeReference |
getImplicitReceiverType() |
protected java.util.List<org.eclipse.xtext.common.types.JvmTypeReference> |
getPlainSyntacticTypeArguments() |
protected XExpression |
getReceiver() |
protected int |
getReceiverConformanceFlags() |
protected LightweightTypeReference |
getReceiverType() |
protected LightweightTypeReference |
getSubstitutedExpectedType(int idx)
Returns the substituted expected type for the argument at
argumentIndex. |
protected java.util.List<XExpression> |
getSyntacticArguments() |
protected XExpression |
getSyntacticReceiver() |
protected XExpression |
getSyntacticReceiverIfPossibleArgument()
Returns the syntactic receiver if it is an expression.
|
protected LightweightTypeReference |
getSyntacticReceiverType() |
protected org.eclipse.xtext.diagnostics.Severity |
getUnhandledExceptionSeverity(org.eclipse.xtext.common.types.JvmExecutable executable)
Obtain the currently applicable severity for uncaught exceptions.
|
protected boolean |
hasReceiver()
Returns
true if the argument at index 0 will be considered as the receiver. |
protected void |
initializeMapping(org.eclipse.xtext.common.types.JvmTypeParameter typeParameter,
java.util.Map<org.eclipse.xtext.common.types.JvmTypeParameter,LightweightMergedBoundTypeArgument> result) |
protected boolean |
isAmbiguousExtensionProvider(AbstractPendingLinkingCandidate<?> right) |
protected boolean |
isAssignmentOrMemberFeatureCall() |
protected boolean |
isCompoundOperator() |
protected boolean |
isExplicitOperationCall() |
boolean |
isExtension()
Returns
true if the the linked feature is contributed
by an extension. |
protected boolean |
isFirstArgument(int argumentIndex) |
protected boolean |
isGetClass(org.eclipse.xtext.common.types.JvmIdentifiableElement feature) |
protected boolean |
isGetClassOnTypeLiteral()
Returns
true if the method Object.getClass() is bound and
the receiver is a type literal. |
protected boolean |
isImplicitlyStatic(XAssignment assignment) |
protected boolean |
isInvalidStaticSyntax()
Returns
true if a static member is accessed with an instance receiver,
e.g. |
protected boolean |
isLambdaExpression(int argumentIdx) |
protected boolean |
isOperationCallSyntax() |
protected boolean |
isRawTypeContext() |
protected boolean |
isReassignFirstArgument(XAbstractFeatureCall featureCall) |
protected boolean |
isSimpleAssignment(XAssignment assignment) |
boolean |
isStatic()
Returns
true if the the linked feature is static. |
protected boolean |
isStaticAccessSyntax() |
protected boolean |
isStaticWithDeclaringType() |
protected boolean |
isStaticWithDeclaringType(XAssignment assignment) |
protected boolean |
isSyntacticReceiverPossibleArgument()
Returns
true if the linked receiver could be
a possible argument of this feature. |
boolean |
isTypeLiteral()
Returns
true if the the feature call is linked as a type literal. |
protected boolean |
isTypeLiteral(XExpression expression) |
protected boolean |
isValidAssignmentName(IIdentifiableElementDescription description) |
protected void |
preApply() |
protected void |
resolveAgainstActualType(LightweightTypeReference declaredType,
LightweightTypeReference actualType,
AbstractTypeComputationState state) |
protected void |
resolveArgumentType(XExpression argument,
LightweightTypeReference declaredType,
ITypeComputationState argumentState) |
protected void |
resolveKnownArgumentType(XExpression argument,
LightweightTypeReference knownType,
LightweightTypeReference declaredType,
ITypeComputationState argumentState) |
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) |
compareByArity, compareByBoxing, compareByTypeArguments, compareDeclaredTypes, compareExpectedArgumentTypes, compareTo, getArgumentTypesAsString, getArityMismatch, getArityMismatch, getDefaultValidationFeature, getFeature, getFeatureParameterTypesAsString, getFeatureParameterTypesAsString, getFeatureTypeParametersAsString, getInvalidArgumentsValidationFeature, getPreferredCandidate, getSeverity, getSimpleFeatureName, getTypeArgumentConformanceFailures, getTypeArgumentsAsString, getTypeArityMismatch, getTypeParameterAsString, getTypeParameterMapping, isDefiniteEarlyExit, isPossibleFunctionType, isVarArgs, isVisible, resolveLinkingProxy, toString, validateTypeArgumentConformance, validateTypeArity, validateUnhandledExceptions, validateUnhandledExceptions, validateVisibilityaccept, applyToComputationState, computeArgumentType, computeArgumentTypes, computeFixedArityArgumentType, createArgumentTypeSubstitutor, createLinkingTypeComputationState, createVarArgTypeComputationState, deferredBindTypeArgument, discardRefinementTypeIfReassigned, getActualType, getActualType, getDeclaredTypeParameters, getExpectedType, getExpression, getState, getSyntacticTypeArguments, getTypeArguments, initializeArgumentTypeComputation, initializeConstraintMapping, initializeTypeParameterMapping, initializeTypeParameterMapping, isBoundTypeArgumentSkipped, mustDiscardRefinementclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitapplyToComputationState, getExpression, getFeature, getPreferredCandidate, getTypeArgumentspublic FeatureLinkingCandidate(XAbstractFeatureCall featureCall, IIdentifiableElementDescription description, ITypeExpectation expectation, ExpressionTypeComputationState state)
protected ILinkingCandidate createAmbiguousLinkingCandidate(AbstractPendingLinkingCandidate<?> second)
AbstractPendingLinkingCandidatecreateAmbiguousLinkingCandidate in class AbstractPendingLinkingCandidate<XAbstractFeatureCall>protected ILinkingCandidate createSuspiciousLinkingCandidate(AbstractPendingLinkingCandidate<?> chosenCandidate)
AbstractPendingLinkingCandidatecreateSuspiciousLinkingCandidate in class AbstractPendingLinkingCandidate<XAbstractFeatureCall>chosenCandidate - the candidate that was picked.protected boolean isRawTypeContext()
isRawTypeContext in class AbstractLinkingCandidate<XAbstractFeatureCall>protected void initializeMapping(org.eclipse.xtext.common.types.JvmTypeParameter typeParameter,
java.util.Map<org.eclipse.xtext.common.types.JvmTypeParameter,LightweightMergedBoundTypeArgument> result)
initializeMapping in class AbstractLinkingCandidate<XAbstractFeatureCall>protected java.util.List<XExpression> getArguments()
getArguments in class AbstractLinkingCandidate<XAbstractFeatureCall>public boolean validate(org.eclipse.xtext.util.IAcceptor<? super org.eclipse.xtext.diagnostics.AbstractDiagnostic> result)
AbstractPendingLinkingCandidate.validate(IAcceptor),
the candidate is validated according these criteria:
syntax for static feature calls,static context for static members,this or super in an invalid context,errorprone invocation of getClass().validate in interface IApplicableCandidatevalidate in class AbstractPendingLinkingCandidate<XAbstractFeatureCall>true if further validation should be performed.protected boolean validateArity(org.eclipse.xtext.util.IAcceptor<? super org.eclipse.xtext.diagnostics.AbstractDiagnostic> result)
validateArity in class AbstractPendingLinkingCandidate<XAbstractFeatureCall>protected boolean isReassignFirstArgument(XAbstractFeatureCall featureCall)
protected boolean isInvalidStaticSyntax()
true if a static member is accessed with an instance receiver,
e.g. myLocalVariable.STATIC_METHOD(..) or myLocalVariable.STATIC_FIELD = null.protected boolean isStaticWithDeclaringType()
protected boolean isStaticWithDeclaringType(XAssignment assignment)
protected boolean isImplicitlyStatic(XAssignment assignment)
protected boolean isTypeLiteral(XExpression expression)
protected boolean isOperationCallSyntax()
protected java.lang.String getFeatureTypeName()
AbstractPendingLinkingCandidateJvmOperation may
return method, a XVariableDeclaration may identify itself as local variable.getFeatureTypeName in class AbstractPendingLinkingCandidate<XAbstractFeatureCall>protected boolean isStaticAccessSyntax()
protected boolean isAssignmentOrMemberFeatureCall()
protected boolean isSimpleAssignment(XAssignment assignment)
protected java.util.List<XExpression> createArgumentList(XExpression head, java.util.List<XExpression> tail)
protected java.util.List<XExpression> getSyntacticArguments()
getSyntacticArguments in class AbstractPendingLinkingCandidate<XAbstractFeatureCall>public boolean isExtension()
IFeatureLinkingCandidatetrue if the the linked feature is contributed
by an extension.isExtension in interface IFeatureLinkingCandidateisExtension in class AbstractPendingLinkingCandidate<XAbstractFeatureCall>protected boolean hasReceiver()
AbstractLinkingCandidatetrue if the argument at index 0 will be considered as the receiver.hasReceiver in class AbstractLinkingCandidate<XAbstractFeatureCall>public boolean isStatic()
IFeatureLinkingCandidatetrue if the the linked feature is static.isStatic in interface IFeatureLinkingCandidateprotected boolean isSyntacticReceiverPossibleArgument()
true if the linked receiver could be
a possible argument of this feature. Basically it's false if
this feature is an error feature, a local variable or a if the
receiver is a type literal that's treated as a static qualifier
rather than a literal expression.public boolean isTypeLiteral()
IFeatureLinkingCandidatetrue if the the feature call is linked as a type literal.isTypeLiteral in interface IFeatureLinkingCandidateisTypeLiteral in class AbstractLinkingCandidate<XAbstractFeatureCall>protected CandidateCompareResult getExpectedTypeCompareResultOther(AbstractPendingLinkingCandidate<?> right)
AbstractPendingLinkingCandidategetExpectedTypeCompareResultOther in class AbstractPendingLinkingCandidate<XAbstractFeatureCall>right - the winner of the comparison.protected int getConformanceFlags(int idx,
boolean recompute)
getConformanceFlags in class AbstractPendingLinkingCandidate<XAbstractFeatureCall>protected boolean isLambdaExpression(int argumentIdx)
isLambdaExpression in class AbstractPendingLinkingCandidate<XAbstractFeatureCall>protected LightweightTypeReference getSubstitutedExpectedType(int idx)
AbstractLinkingCandidateargumentIndex.
If the expected type is an unbound type parameter, a reference to the type parameter
itself is returned.getSubstitutedExpectedType in class AbstractLinkingCandidate<XAbstractFeatureCall>protected boolean isExplicitOperationCall()
protected CandidateCompareResult compareByName(AbstractPendingLinkingCandidate<?> right)
compareByName in class AbstractPendingLinkingCandidate<XAbstractFeatureCall>protected CandidateCompareResult compareByArgumentTypes(AbstractPendingLinkingCandidate<?> right)
compareByArgumentTypes in class AbstractPendingLinkingCandidate<XAbstractFeatureCall>protected CandidateCompareResult compareByArgumentTypes(AbstractPendingLinkingCandidate<?> right, boolean recompute)
compareByArgumentTypes in class AbstractPendingLinkingCandidate<XAbstractFeatureCall>protected CandidateCompareResult compareByNameAndStaticFlag(AbstractPendingLinkingCandidate<?> right)
protected boolean isCompoundOperator()
protected CandidateCompareResult compareByBucket(AbstractPendingLinkingCandidate<?> right)
compareByBucket in class AbstractPendingLinkingCandidate<XAbstractFeatureCall>protected boolean isAmbiguousExtensionProvider(AbstractPendingLinkingCandidate<?> right)
protected CandidateCompareResult compareTo(AbstractPendingLinkingCandidate<?> right, boolean invalid)
AbstractPendingLinkingCandidateCandidateCompareResult#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.compareTo in class AbstractPendingLinkingCandidate<XAbstractFeatureCall>protected CandidateCompareResult compareByAssignmentName(AbstractPendingLinkingCandidate<?> right)
protected boolean isValidAssignmentName(IIdentifiableElementDescription description)
protected CandidateCompareResult compareByArityWith(AbstractPendingLinkingCandidate<?> right)
compareByArityWith in class AbstractPendingLinkingCandidate<XAbstractFeatureCall>protected CandidateCompareResult compareByArgumentTypesFlags(AbstractPendingLinkingCandidate<?> right, int leftIdx, int rightIdx, int leftConformance, int rightConformance)
AbstractPendingLinkingCandidateother 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.compareByArgumentTypesFlags in class AbstractPendingLinkingCandidate<XAbstractFeatureCall>right - 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 boolean isFirstArgument(int argumentIndex)
protected CandidateCompareResult compareByArgumentTypes(AbstractPendingLinkingCandidate<?> right, int leftBoxing, int rightBoxing, int leftDemand, int rightDemand)
AbstractPendingLinkingCandidateother 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.compareByArgumentTypes in class AbstractPendingLinkingCandidate<XAbstractFeatureCall>right - 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 compareByArgumentTypes(FeatureLinkingCandidate right, int leftBoxing, int rightBoxing)
protected CandidateCompareResult compareByArgumentTypesAndStaticFlag(FeatureLinkingCandidate right, int leftBoxing, int rightBoxing)
protected void preApply()
preApply in class AbstractLinkingCandidate<XAbstractFeatureCall>protected void applyImplicitReceiver()
protected void resolveAgainstActualType(LightweightTypeReference declaredType, LightweightTypeReference actualType, AbstractTypeComputationState state)
resolveAgainstActualType in class AbstractLinkingCandidate<XAbstractFeatureCall>public XAbstractFeatureCall getFeatureCall()
IFeatureLinkingCandidategetFeatureCall in interface IFeatureLinkingCandidateprotected java.util.List<org.eclipse.xtext.common.types.JvmTypeReference> getPlainSyntacticTypeArguments()
getPlainSyntacticTypeArguments in class AbstractLinkingCandidate<XAbstractFeatureCall>protected void resolveArgumentType(XExpression argument, LightweightTypeReference declaredType, ITypeComputationState argumentState)
resolveArgumentType in class AbstractLinkingCandidate<XAbstractFeatureCall>argument - the expression that should be processed.declaredType - the declared (expected) type for the given expression.argumentState - the to-be-used state to compute the actual type of the argument. It is already configured with the expectation.protected void resolveKnownArgumentType(XExpression argument, LightweightTypeReference knownType, LightweightTypeReference declaredType, ITypeComputationState argumentState)
protected void computeVarArgumentType(IFeatureCallArgumentSlot slot, TypeParameterSubstitutor<?> substitutor)
computeVarArgumentType in class AbstractLinkingCandidate<XAbstractFeatureCall>protected java.util.Map<org.eclipse.xtext.common.types.JvmTypeParameter,LightweightMergedBoundTypeArgument> getDeclaratorParameterMapping()
getDeclaratorParameterMapping in class AbstractLinkingCandidate<XAbstractFeatureCall>protected XExpression getReceiver()
protected LightweightTypeReference getReceiverType()
protected int getReceiverConformanceFlags()
protected XExpression getFirstArgument()
protected LightweightTypeReference getFirstArgumentType()
protected XExpression getImplicitReceiver()
protected LightweightTypeReference getImplicitReceiverType()
protected XExpression getSyntacticReceiver()
protected XExpression getSyntacticReceiverIfPossibleArgument()
null
is returned as the syntactic receiver of the expression valueOf(..)
in java.lang.String.valueOf(..).protected LightweightTypeReference getSyntacticReceiverType()
protected XExpression getImplicitFirstArgument()
protected LightweightTypeReference getImplicitFirstArgumentType()
protected LightweightTypeReference getDeclaredType(org.eclipse.xtext.common.types.JvmIdentifiableElement feature)
getDeclaredType in class AbstractLinkingCandidate<XAbstractFeatureCall>protected boolean isGetClassOnTypeLiteral()
true if the method Object.getClass() is bound and
the receiver is a type literal. This may indicate a bug.protected boolean isGetClass(org.eclipse.xtext.common.types.JvmIdentifiableElement feature)
public void applyToModel(IResolvedTypes resolvedTypes)
ILinkingCandidateresolve
of EMF. This implies that the linked feature call may still point to a proxy afterwards.applyToModel in interface IApplicableCandidateapplyToModel in interface ILinkingCandidateprotected org.eclipse.xtext.diagnostics.Severity getUnhandledExceptionSeverity(org.eclipse.xtext.common.types.JvmExecutable executable)
AbstractPendingLinkingCandidategetUnhandledExceptionSeverity in class AbstractPendingLinkingCandidate<XAbstractFeatureCall>executable - the executable that declares the exception.