public class FeatureLinkingCandidate extends AbstractPendingLinkingCandidate<XAbstractFeatureCall> implements IFeatureLinkingCandidate, IFeatureNames
AbstractLinkingCandidate.ArgumentTypeComputationState, AbstractLinkingCandidate.ObservableTypeExpectation
description
arguments, typeArguments
IT, 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 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<?> 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 org.eclipse.xtext.xbase.typesystem.internal.CandidateCompareResult |
compareByArgumentTypes(FeatureLinkingCandidate right,
int leftBoxing,
int rightBoxing) |
protected org.eclipse.xtext.xbase.typesystem.internal.CandidateCompareResult |
compareByArgumentTypesAndStaticFlag(FeatureLinkingCandidate right,
int leftBoxing,
int rightBoxing) |
protected org.eclipse.xtext.xbase.typesystem.internal.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 org.eclipse.xtext.xbase.typesystem.internal.CandidateCompareResult |
compareByArityWith(AbstractPendingLinkingCandidate<?> right) |
protected org.eclipse.xtext.xbase.typesystem.internal.CandidateCompareResult |
compareByAssignmentName(AbstractPendingLinkingCandidate<?> right) |
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 |
compareByNameAndStaticFlag(AbstractPendingLinkingCandidate<?> right) |
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 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<JvmTypeParameter,LightweightMergedBoundTypeArgument> |
getDeclaratorParameterMapping() |
protected LightweightTypeReference |
getDeclaredType(JvmIdentifiableElement feature) |
protected org.eclipse.xtext.xbase.typesystem.internal.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. a feature of type
JvmOperation may
return method , a XVariableDeclaration may identify itself as local variable . |
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<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 Severity |
getUnhandledExceptionSeverity(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(JvmTypeParameter typeParameter,
java.util.Map<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(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(IAcceptor<? super AbstractDiagnostic> result)
Validates this linking candidate and adds respective diagnostics to the given queue.
|
protected boolean |
validateArity(IAcceptor<? super AbstractDiagnostic> result) |
compareByArity, compareByBoxing, compareByTypeArguments, compareDeclaredTypes, compareExpectedArgumentTypes, compareTo, getArgumentTypesAsString, getArityMismatch, getArityMismatch, getDefaultValidationFeature, getFeature, getFeatureParameterTypesAsString, getFeatureTypeParametersAsString, getInvalidArgumentsValidationFeature, getPreferredCandidate, getTypeArgumentConformanceFailures, getTypeArgumentsAsString, getTypeArityMismatch, getTypeParameterAsString, getTypeParameterMapping, isDefiniteEarlyExit, isPossibleFunctionType, isVarArgs, isVisible, resolveLinkingProxy, toString, validateTypeArgumentConformance, validateTypeArity, validateUnhandledExceptions, validateUnhandledExceptions, validateVisibility
accept, applyToComputationState, computeArgumentType, computeArgumentTypes, computeFixedArityArgumentType, createArgumentTypeSubstitutor, createLinkingTypeComputationState, createVarArgTypeComputationState, deferredBindTypeArgument, discardRefinementTypeIfReassigned, getActualType, getActualType, getDeclaredTypeParameters, getExpectedType, getExpression, getState, getSyntacticTypeArguments, getTypeArguments, initializeArgumentTypeComputation, initializeConstraintMapping, initializeTypeParameterMapping, initializeTypeParameterMapping, isBoundTypeArgumentSkipped, mustDiscardRefinement
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
applyToComputationState, getExpression, getFeature, getPreferredCandidate, getTypeArguments
public FeatureLinkingCandidate(XAbstractFeatureCall featureCall, IIdentifiableElementDescription description, ITypeExpectation expectation, ExpressionTypeComputationState state)
protected ILinkingCandidate createAmbiguousLinkingCandidate(AbstractPendingLinkingCandidate<?> second)
AbstractPendingLinkingCandidate
createAmbiguousLinkingCandidate
in class AbstractPendingLinkingCandidate<XAbstractFeatureCall>
protected ILinkingCandidate createSuspiciousLinkingCandidate(AbstractPendingLinkingCandidate<?> chosenCandidate)
AbstractPendingLinkingCandidate
createSuspiciousLinkingCandidate
in class AbstractPendingLinkingCandidate<XAbstractFeatureCall>
chosenCandidate
- the candidate that was picked.protected boolean isRawTypeContext()
isRawTypeContext
in class AbstractLinkingCandidate<XAbstractFeatureCall>
protected void initializeMapping(JvmTypeParameter typeParameter, java.util.Map<JvmTypeParameter,LightweightMergedBoundTypeArgument> result)
initializeMapping
in class AbstractLinkingCandidate<XAbstractFeatureCall>
protected java.util.List<XExpression> getArguments()
getArguments
in class AbstractLinkingCandidate<XAbstractFeatureCall>
public boolean validate(IAcceptor<? super AbstractDiagnostic> result)
AbstractPendingLinkingCandidate.validate(IAcceptor)
,
the candidate is validated according these criteria:
syntax for static feature calls
,static context for static members
,this
in a static context,errorprone invocation of getClass()
.validate
in interface IApplicableCandidate
validate
in class AbstractPendingLinkingCandidate<XAbstractFeatureCall>
true
if further validation should be performed.protected boolean validateArity(IAcceptor<? super 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()
AbstractPendingLinkingCandidate
JvmOperation
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()
IFeatureLinkingCandidate
true
if the the linked feature is contributed
by an extension.isExtension
in interface IFeatureLinkingCandidate
isExtension
in class AbstractPendingLinkingCandidate<XAbstractFeatureCall>
protected boolean hasReceiver()
AbstractLinkingCandidate
true
if the argument at index 0 will be considered as the receiver.hasReceiver
in class AbstractLinkingCandidate<XAbstractFeatureCall>
public boolean isStatic()
IFeatureLinkingCandidate
true
if the the linked feature is static.isStatic
in interface IFeatureLinkingCandidate
protected 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()
IFeatureLinkingCandidate
true
if the the feature call is linked as a type literal.isTypeLiteral
in interface IFeatureLinkingCandidate
isTypeLiteral
in class AbstractLinkingCandidate<XAbstractFeatureCall>
protected org.eclipse.xtext.xbase.typesystem.internal.CandidateCompareResult getExpectedTypeCompareResultOther(AbstractPendingLinkingCandidate<?> right)
AbstractPendingLinkingCandidate
getExpectedTypeCompareResultOther
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)
AbstractLinkingCandidate
argumentIndex
.
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 org.eclipse.xtext.xbase.typesystem.internal.CandidateCompareResult compareByName(AbstractPendingLinkingCandidate<?> right)
compareByName
in class AbstractPendingLinkingCandidate<XAbstractFeatureCall>
protected org.eclipse.xtext.xbase.typesystem.internal.CandidateCompareResult compareByArgumentTypes(AbstractPendingLinkingCandidate<?> right)
compareByArgumentTypes
in class AbstractPendingLinkingCandidate<XAbstractFeatureCall>
protected org.eclipse.xtext.xbase.typesystem.internal.CandidateCompareResult compareByArgumentTypes(AbstractPendingLinkingCandidate<?> right, boolean recompute)
compareByArgumentTypes
in class AbstractPendingLinkingCandidate<XAbstractFeatureCall>
protected org.eclipse.xtext.xbase.typesystem.internal.CandidateCompareResult compareByNameAndStaticFlag(AbstractPendingLinkingCandidate<?> right)
protected boolean isCompoundOperator()
protected org.eclipse.xtext.xbase.typesystem.internal.CandidateCompareResult compareByBucket(AbstractPendingLinkingCandidate<?> right)
compareByBucket
in class AbstractPendingLinkingCandidate<XAbstractFeatureCall>
protected boolean isAmbiguousExtensionProvider(AbstractPendingLinkingCandidate<?> right)
protected org.eclipse.xtext.xbase.typesystem.internal.CandidateCompareResult compareTo(AbstractPendingLinkingCandidate<?> right, boolean invalid)
AbstractPendingLinkingCandidate
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.compareTo
in class AbstractPendingLinkingCandidate<XAbstractFeatureCall>
protected org.eclipse.xtext.xbase.typesystem.internal.CandidateCompareResult compareByAssignmentName(AbstractPendingLinkingCandidate<?> right)
protected boolean isValidAssignmentName(IIdentifiableElementDescription description)
protected org.eclipse.xtext.xbase.typesystem.internal.CandidateCompareResult compareByArityWith(AbstractPendingLinkingCandidate<?> right)
compareByArityWith
in class AbstractPendingLinkingCandidate<XAbstractFeatureCall>
protected org.eclipse.xtext.xbase.typesystem.internal.CandidateCompareResult compareByArgumentTypesFlags(AbstractPendingLinkingCandidate<?> right, int leftIdx, int rightIdx, int leftConformance, int rightConformance)
AbstractPendingLinkingCandidate
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.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 org.eclipse.xtext.xbase.typesystem.internal.CandidateCompareResult compareByArgumentTypes(AbstractPendingLinkingCandidate<?> right, int leftBoxing, int rightBoxing, int leftDemand, int rightDemand)
AbstractPendingLinkingCandidate
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.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 org.eclipse.xtext.xbase.typesystem.internal.CandidateCompareResult compareByArgumentTypes(FeatureLinkingCandidate right, int leftBoxing, int rightBoxing)
protected org.eclipse.xtext.xbase.typesystem.internal.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()
IFeatureLinkingCandidate
getFeatureCall
in interface IFeatureLinkingCandidate
protected java.util.List<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<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(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(JvmIdentifiableElement feature)
public void applyToModel(IResolvedTypes resolvedTypes)
ILinkingCandidate
resolve
of EMF. This implies that the linked feature call may still point to a proxy afterwards.applyToModel
in interface IApplicableCandidate
applyToModel
in interface ILinkingCandidate
protected Severity getUnhandledExceptionSeverity(JvmExecutable executable)
AbstractPendingLinkingCandidate
getUnhandledExceptionSeverity
in class AbstractPendingLinkingCandidate<XAbstractFeatureCall>
executable
- the executable that declares the exception.