Class CompoundReentrantTypeResolver
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<IResolvedTypes>
-
- org.eclipse.xtext.xbase.typesystem.internal.CompoundReentrantTypeResolver
-
- All Implemented Interfaces:
java.lang.Iterable<IResolvedTypes>,java.util.Collection<IResolvedTypes>,java.util.List<IResolvedTypes>,java.util.RandomAccess,IReentrantTypeResolver,IResolvedTypes
public class CompoundReentrantTypeResolver extends java.util.AbstractList<IResolvedTypes> implements IReentrantTypeResolver, IResolvedTypes, java.util.RandomAccess
- Noextend:
- This class is not intended to be subclassed by clients.
- Noinstantiate:
- This class is not intended to be instantiated by clients. TODO JavaDoc, toString
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.xtext.xbase.typesystem.IResolvedTypes
IResolvedTypes.NullResolvedTypes
-
-
Field Summary
-
Fields inherited from interface org.eclipse.xtext.xbase.typesystem.internal.IReentrantTypeResolver
NULL
-
Fields inherited from interface org.eclipse.xtext.xbase.typesystem.IResolvedTypes
NULL
-
-
Constructor Summary
Constructors Constructor Description CompoundReentrantTypeResolver(java.util.Set<org.eclipse.emf.ecore.EObject> allRootedExpressions)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddResolver(AbstractRootedReentrantTypeResolver resolver)IResolvedTypesget(int index)LightweightTypeReferencegetActualType(org.eclipse.xtext.common.types.JvmIdentifiableElement identifiable)Returns the actually inferred or declared type for the given identifiable ornullif none.LightweightTypeReferencegetActualType(XExpression expression)Returns the actually inferred type for the given expression ornullif none.java.util.List<LightweightTypeReference>getActualTypeArguments(XExpression expression)Returns the resolved type arguments.java.util.Collection<IAmbiguousLinkingCandidate>getAmbiguousLinkingCandidates()Returns all ambiguous linking candidates that have been encountered.protected IResolvedTypesgetDelegate(int idx)protected IResolvedTypesgetDelegate(org.eclipse.emf.ecore.EObject object)protected IResolvedTypesgetDelegate(XExpression expression)LightweightTypeReferencegetExpectedReturnType(XExpression expression)Returns the expected return type for the given expression ornullif none.LightweightTypeReferencegetExpectedType(XExpression expression)Returns the actually expected type for the given expression ornullif none.IExpressionScopegetExpressionScope(org.eclipse.emf.ecore.EObject context, IExpressionScope.Anchor anchor)Returns the scope the given expression is contained in.java.util.Collection<ILinkingCandidate>getFollowUpErrors()Returns the linking candidates that could not be resolved but are not exposed to the users because they are follow up errors.org.eclipse.xtext.common.types.JvmIdentifiableElementgetLinkedFeature(XAbstractFeatureCall featureCall)Returns the intermediate linking result for the given feature call, if any.org.eclipse.xtext.common.types.JvmIdentifiableElementgetLinkedFeature(XConstructorCall constructorCall)Returns the intermediate linking result for the given constructor call, if any.IFeatureLinkingCandidategetLinkingCandidate(XAbstractFeatureCall featureCall)Returns the intermediate linking candidate for the given feature call, if any.IConstructorLinkingCandidategetLinkingCandidate(XConstructorCall constructorCall)Returns the intermediate linking candidate for the given constructor call, if any.protected org.eclipse.xtext.util.CancelIndicatorgetMonitor()java.util.Collection<org.eclipse.xtext.diagnostics.AbstractDiagnostic>getQueuedDiagnostics()Provides access to all diagnostics that have been added during the type computation so far.LightweightTypeReferencegetReturnType(XExpression expression)Returns the actually inferred return type for the given expression ornullif none.LightweightTypeReferencegetReturnType(XExpression expression, boolean onlyExplicitReturn)Returns the actually inferred return type for the given expression ornullif none.java.util.List<LightweightTypeReference>getThrownExceptions(XExpression obj)booleanhasExpressionScope(org.eclipse.emf.ecore.EObject context, IExpressionScope.Anchor anchor)voidinitializeFrom(org.eclipse.emf.ecore.EObject root)booleanisRefinedType(XExpression expression)Returnstrueif the expression's type is based on a type refinement, e.g.booleanisVoidTypeAllowed(XExpression expression)Returnstrueif the given expression may have the typevoid.IResolvedTypesreentrantResolve(org.eclipse.xtext.util.CancelIndicator monitor)intsize()-
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
-
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
-
-
-
-
Method Detail
-
addResolver
protected void addResolver(AbstractRootedReentrantTypeResolver resolver)
-
initializeFrom
public void initializeFrom(org.eclipse.emf.ecore.EObject root)
- Specified by:
initializeFromin interfaceIReentrantTypeResolver
-
reentrantResolve
public IResolvedTypes reentrantResolve(org.eclipse.xtext.util.CancelIndicator monitor)
- Specified by:
reentrantResolvein interfaceIReentrantTypeResolver
-
getMonitor
protected org.eclipse.xtext.util.CancelIndicator getMonitor()
-
getDelegate
protected IResolvedTypes getDelegate(int idx)
-
getQueuedDiagnostics
public java.util.Collection<org.eclipse.xtext.diagnostics.AbstractDiagnostic> getQueuedDiagnostics()
Description copied from interface:IResolvedTypesProvides access to all diagnostics that have been added during the type computation so far.- Specified by:
getQueuedDiagnosticsin interfaceIResolvedTypes
-
isRefinedType
public boolean isRefinedType(XExpression expression)
Description copied from interface:IResolvedTypesReturnstrueif the expression's type is based on a type refinement, e.g. an instanceof guard my specialize the type of the checked reference. Any feature call to that reference is considered to be based on a refined type.- Specified by:
isRefinedTypein interfaceIResolvedTypes- Parameters:
expression- the expression that may have been typed based on a refinement.- Returns:
trueif the type was refined,falseotherwise.
-
getFollowUpErrors
public java.util.Collection<ILinkingCandidate> getFollowUpErrors()
Description copied from interface:IResolvedTypesReturns the linking candidates that could not be resolved but are not exposed to the users because they are follow up errors.- Specified by:
getFollowUpErrorsin interfaceIResolvedTypes
-
getAmbiguousLinkingCandidates
public java.util.Collection<IAmbiguousLinkingCandidate> getAmbiguousLinkingCandidates()
Description copied from interface:IResolvedTypesReturns all ambiguous linking candidates that have been encountered.- Specified by:
getAmbiguousLinkingCandidatesin interfaceIResolvedTypes
-
getActualType
public LightweightTypeReference getActualType(XExpression expression)
Description copied from interface:IResolvedTypesReturns the actually inferred type for the given expression ornullif none.- Specified by:
getActualTypein interfaceIResolvedTypes- Parameters:
expression- expression whose type is queried.
-
getDelegate
protected IResolvedTypes getDelegate(XExpression expression)
-
getDelegate
protected IResolvedTypes getDelegate(org.eclipse.emf.ecore.EObject object)
-
getExpressionScope
public IExpressionScope getExpressionScope(org.eclipse.emf.ecore.EObject context, IExpressionScope.Anchor anchor)
Description copied from interface:IResolvedTypesReturns the scope the given expression is contained in. This considers all decision paths that were taken while computing the type of the expression. The returned scope carries some meta data such as whether there was an attempt to resolve the given expression as a type.- Specified by:
getExpressionScopein interfaceIResolvedTypes
-
hasExpressionScope
public boolean hasExpressionScope(org.eclipse.emf.ecore.EObject context, IExpressionScope.Anchor anchor)- Specified by:
hasExpressionScopein interfaceIResolvedTypes
-
getReturnType
public LightweightTypeReference getReturnType(XExpression expression)
Description copied from interface:IResolvedTypesReturns the actually inferred return type for the given expression ornullif none. Returns the actual expression type, if no explicit return type exists. Shorthand forgetReturnType(expression, false)- Specified by:
getReturnTypein interfaceIResolvedTypes- Parameters:
expression- expression whose return type is queried.
-
getReturnType
public LightweightTypeReference getReturnType(XExpression expression, boolean onlyExplicitReturn)
Description copied from interface:IResolvedTypesReturns the actually inferred return type for the given expression ornullif none.- Specified by:
getReturnTypein interfaceIResolvedTypes- Parameters:
expression- expression whose return type is queried.
-
getActualType
public LightweightTypeReference getActualType(org.eclipse.xtext.common.types.JvmIdentifiableElement identifiable)
Description copied from interface:IResolvedTypesReturns the actually inferred or declared type for the given identifiable ornullif none.- Specified by:
getActualTypein interfaceIResolvedTypes- Parameters:
identifiable- identifiable whose type is queried.
-
getExpectedType
public LightweightTypeReference getExpectedType(XExpression expression)
Description copied from interface:IResolvedTypesReturns the actually expected type for the given expression ornullif none.- Specified by:
getExpectedTypein interfaceIResolvedTypes- Parameters:
expression- expression whose expected type is queried.
-
getThrownExceptions
public java.util.List<LightweightTypeReference> getThrownExceptions(XExpression obj)
- Specified by:
getThrownExceptionsin interfaceIResolvedTypes
-
isVoidTypeAllowed
public boolean isVoidTypeAllowed(XExpression expression)
Description copied from interface:IResolvedTypesReturnstrueif the given expression may have the typevoid.- Specified by:
isVoidTypeAllowedin interfaceIResolvedTypes- Parameters:
expression- expression whose expected type is queried.
-
getExpectedReturnType
public LightweightTypeReference getExpectedReturnType(XExpression expression)
Description copied from interface:IResolvedTypesReturns the expected return type for the given expression ornullif none.- Specified by:
getExpectedReturnTypein interfaceIResolvedTypes- Parameters:
expression- expression whose expected return type is queried.
-
getActualTypeArguments
public java.util.List<LightweightTypeReference> getActualTypeArguments(XExpression expression)
Description copied from interface:IResolvedTypesReturns the resolved type arguments. If the expression refers to a constructor and the constructor itself defines type parameters, their resolved representation is prepended to the list of type arguments. Consider the following type:class C<T, V> { public <PLgt; C(P p) {} }An invocation of the constructorCwill return three type arguments, the bound values of forP,TandV.- Specified by:
getActualTypeArgumentsin interfaceIResolvedTypes- Parameters:
expression- may either be anXAbstractFeatureCallorXConstructorCall. May not benull.
-
getLinkedFeature
public org.eclipse.xtext.common.types.JvmIdentifiableElement getLinkedFeature(XAbstractFeatureCall featureCall)
Description copied from interface:IResolvedTypesReturns the intermediate linking result for the given feature call, if any. If the feature call isnull, the result isnull.- Specified by:
getLinkedFeaturein interfaceIResolvedTypes- Parameters:
featureCall- the feature call that is queried for the current linking state.- Returns:
- the potentially intermediate linking state or
nullif none.
-
getLinkedFeature
public org.eclipse.xtext.common.types.JvmIdentifiableElement getLinkedFeature(XConstructorCall constructorCall)
Description copied from interface:IResolvedTypesReturns the intermediate linking result for the given constructor call, if any. If the constructor call isnull, the result isnull. If the constructor call is broken, it may return aJvmTypeinstead of aJvmConstructor.- Specified by:
getLinkedFeaturein interfaceIResolvedTypes- Parameters:
constructorCall- the constructor call that is queried for the current linking state.- Returns:
- the potentially intermediate linking state or
nullif none.
-
getLinkingCandidate
public IFeatureLinkingCandidate getLinkingCandidate(XAbstractFeatureCall featureCall)
Description copied from interface:IResolvedTypesReturns the intermediate linking candidate for the given feature call, if any. If the feature call isnull, the result isnull.- Specified by:
getLinkingCandidatein interfaceIResolvedTypes- Parameters:
featureCall- the feature call that is queried for the current linking state.- Returns:
- the potentially intermediate linking state or
nullif none.
-
getLinkingCandidate
public IConstructorLinkingCandidate getLinkingCandidate(XConstructorCall constructorCall)
Description copied from interface:IResolvedTypesReturns the intermediate linking candidate for the given constructor call, if any. If the constructor call isnull, the result isnull. If the constructor call is broken, it may return aJvmTypeinstead of aJvmConstructor.- Specified by:
getLinkingCandidatein interfaceIResolvedTypes- Parameters:
constructorCall- the constructor call that is queried for the current linking state.- Returns:
- the potentially intermediate linking state or
nullif none.
-
get
public IResolvedTypes get(int index)
- Specified by:
getin interfacejava.util.List<IResolvedTypes>- Specified by:
getin classjava.util.AbstractList<IResolvedTypes>
-
size
public int size()
- Specified by:
sizein interfacejava.util.Collection<IResolvedTypes>- Specified by:
sizein interfacejava.util.List<IResolvedTypes>- Specified by:
sizein classjava.util.AbstractCollection<IResolvedTypes>
-
-