public abstract class ResolvedTypes extends java.lang.Object implements IResolvedTypes
Modifier and Type | Class and Description |
---|---|
protected class |
ResolvedTypes.Owner |
static class |
ResolvedTypes.Shared
Shared state accross all resolved types for a single run of the resolver.
|
protected static class |
ResolvedTypes.SharedKeysAwareMap<K,V> |
protected static class |
ResolvedTypes.SharedKeysAwareSet<E> |
IResolvedTypes.NullResolvedTypes
NULL
Modifier | Constructor and Description |
---|---|
protected |
ResolvedTypes(ResolvedTypes.Shared shared) |
Modifier and Type | Method and Description |
---|---|
protected void |
acceptCandidate(XExpression expression,
IApplicableCandidate candidate) |
void |
acceptHint(java.lang.Object handle,
LightweightBoundTypeArgument boundTypeArgument) |
protected LightweightTypeReference |
acceptType(XExpression expression,
AbstractTypeExpectation expectation,
LightweightTypeReference type,
boolean returnType,
int flags) |
protected void |
acceptType(XExpression expression,
TypeData typeData) |
protected void |
acceptUnboundTypeReference(java.lang.Object handle,
UnboundTypeReference reference) |
void |
addDeclaredTypeParameters(java.util.List<JvmTypeParameter> typeParameters) |
void |
addDiagnostic(AbstractDiagnostic diagnostic) |
protected void |
addExpressionScope(org.eclipse.emf.ecore.EObject context,
IFeatureScopeSession session,
IExpressionScope.Anchor anchor) |
protected void |
addNonRecursiveHints(LightweightBoundTypeArgument original,
java.util.List<LightweightBoundTypeArgument> hints,
java.util.Set<java.lang.Object> seenHandles,
java.util.List<LightweightBoundTypeArgument> result) |
protected void |
addNonRecursiveHints(LightweightBoundTypeArgument original,
UnboundTypeReference reference,
java.util.Set<java.lang.Object> seenHandles,
java.util.List<LightweightBoundTypeArgument> result) |
protected void |
addNonRecursiveHints(java.util.List<LightweightBoundTypeArgument> hints,
java.util.Set<java.lang.Object> seenHandles,
java.util.List<LightweightBoundTypeArgument> result) |
protected void |
appendContent(java.util.Collection<?> values,
java.lang.String prefix,
java.lang.StringBuilder result,
java.lang.String indentation) |
protected void |
appendContent(java.util.Map<?,?> map,
java.lang.String prefix,
java.lang.StringBuilder result,
java.lang.String indentation) |
protected void |
appendContent(java.lang.StringBuilder result,
java.lang.String indentation) |
protected void |
appendListMapContent(java.util.Map<?,? extends java.util.Collection<?>> map,
java.lang.String prefix,
java.lang.StringBuilder result,
java.lang.String indentation) |
protected java.util.List<JvmTypeParameter> |
basicGetDeclardTypeParameters() |
protected java.util.Map<XExpression,java.util.List<TypeData>> |
basicGetExpressionTypes() |
protected java.util.Map<XExpression,IApplicableCandidate> |
basicGetLinkingMap() |
protected java.util.Set<XExpression> |
basicGetPropagatedTypes() |
protected java.util.Map<JvmIdentifiableElement,LightweightTypeReference> |
basicGetReassignedTypes() |
protected java.util.Set<XExpression> |
basicGetRefinedTypes() |
protected java.util.Map<java.lang.Object,java.util.List<LightweightBoundTypeArgument>> |
basicGetTypeParameterHints() |
protected java.util.Map<java.lang.Object,UnboundTypeReference> |
basicGetTypeParameters() |
protected java.util.Map<JvmIdentifiableElement,LightweightTypeReference> |
basicGetTypes() |
protected void |
clear() |
protected void |
closeBracket(java.lang.StringBuilder result,
java.lang.String indentation) |
protected LightweightBoundTypeArgument |
copyBoundTypeArgument(LightweightTypeReference typeReference,
LightweightBoundTypeArgument boundTypeArgument) |
protected UnboundTypeReference |
createUnboundTypeReference(XExpression expression,
JvmTypeParameter type) |
protected ResolvedTypes |
discardExpectedExceptions() |
protected LightweightTypeReference |
doGetActualType(JvmIdentifiableElement identifiable,
boolean ignoreReassignedTypes) |
protected LightweightTypeReference |
doGetActualType(XExpression expression) |
protected java.util.List<LightweightTypeReference> |
doGetActualTypeArguments(XExpression expression) |
protected LightweightTypeReference |
doGetActualTypeNoDeclaration(JvmIdentifiableElement identifiable,
boolean ignoreReassignedTypes) |
protected IApplicableCandidate |
doGetCandidate(XExpression featureOrConstructorCall) |
protected IConstructorLinkingCandidate |
doGetConstructor(XConstructorCall constructorCall) |
protected LightweightTypeReference |
doGetDeclaredType(JvmIdentifiableElement identifiable) |
protected LightweightTypeReference |
doGetExpectedType(XExpression expression,
boolean returnType) |
protected IFeatureLinkingCandidate |
doGetFeature(XAbstractFeatureCall featureCall) |
protected JvmIdentifiableElement |
doGetLinkedFeature(XExpression featureOrConstructorCall) |
protected LightweightTypeReference |
doGetReturnType(XExpression expression) |
protected java.util.List<TypeData> |
doGetTypeData(XExpression expression) |
protected boolean |
doIsResolved(java.lang.Object handle) |
LightweightTypeReference |
getActualType(JvmIdentifiableElement identifiable)
Returns the actually inferred or declared type for the given identifiable or
null if none. |
LightweightTypeReference |
getActualType(XExpression expression)
Returns the actually inferred type for the given expression or
null if none. |
java.util.List<LightweightTypeReference> |
getActualTypeArguments(XExpression expression)
Returns the resolved type arguments.
|
java.util.List<LightweightBoundTypeArgument> |
getAllHints(java.lang.Object handle) |
java.util.Collection<IAmbiguousLinkingCandidate> |
getAmbiguousLinkingCandidates()
Returns all ambiguous linking candidates that have been encountered.
|
protected int |
getConformanceFlags(TypeData typeData,
boolean recompute) |
IConstructorLinkingCandidate |
getConstructor(XConstructorCall constructorCall) |
org.eclipse.emf.ecore.resource.ResourceSet |
getContextResourceSet() |
protected JvmTypeReference |
getDeclaredType(JvmIdentifiableElement identifiable) |
java.util.List<JvmTypeParameter> |
getDeclaredTypeParameters() |
protected java.util.List<LightweightTypeReference> |
getExpectedExceptions() |
LightweightTypeReference |
getExpectedReturnType(XExpression expression)
Returns the expected return type for the given expression or
null if none. |
LightweightTypeReference |
getExpectedType(XExpression expression)
Returns the actually expected type for the given expression or
null if none. |
protected abstract LightweightTypeReference |
getExpectedTypeForAssociatedExpression(JvmMember member,
XExpression expression) |
IExpressionScope |
getExpressionScope(org.eclipse.emf.ecore.EObject context,
IExpressionScope.Anchor anchor)
Returns the scope the given expression is contained in.
|
IFeatureLinkingCandidate |
getFeature(XAbstractFeatureCall featureCall) |
protected IFeatureScopeTracker |
getFeatureScopeTracker() |
protected java.util.Map<JvmIdentifiableElement,LightweightTypeReference> |
getFlattenedReassignedTypes() |
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.
|
protected java.util.List<LightweightBoundTypeArgument> |
getHints(java.lang.Object handle) |
JvmIdentifiableElement |
getLinkedFeature(XAbstractFeatureCall featureCall)
Returns the intermediate linking result for the given feature call, if any.
|
JvmIdentifiableElement |
getLinkedFeature(XConstructorCall constructorCall)
Returns the intermediate linking result for the given constructor call, if any.
|
IFeatureLinkingCandidate |
getLinkingCandidate(XAbstractFeatureCall featureCall)
Returns the intermediate linking candidate for the given feature call, if any.
|
IConstructorLinkingCandidate |
getLinkingCandidate(XConstructorCall constructorCall)
Returns the intermediate linking candidate for the given constructor call, if any.
|
protected LightweightTypeReference |
getMergedType(java.util.List<LightweightTypeReference> types) |
protected CancelIndicator |
getMonitor() |
java.util.Collection<AbstractDiagnostic> |
getQueuedDiagnostics() |
ITypeReferenceOwner |
getReferenceOwner() |
protected DefaultReentrantTypeResolver |
getResolver() |
LightweightTypeReference |
getReturnType(XExpression expression)
Returns the actually inferred return type for the given expression or
null if none. |
CommonTypeComputationServices |
getServices() |
protected IssueSeverities |
getSeverities() |
java.util.List<LightweightTypeReference> |
getThrownExceptions(XExpression obj) |
protected TypeData |
getTypeData(XExpression expression,
boolean returnType) |
protected TypeData |
getTypeData(XExpression expression,
boolean returnType,
boolean nullIfEmpty) |
protected UnboundTypeReference |
getUnboundTypeReference(java.lang.Object handle) |
boolean |
hasExpressionScope(org.eclipse.emf.ecore.EObject context,
IExpressionScope.Anchor anchor) |
protected boolean |
isPropagatedType(XExpression expression) |
protected boolean |
isRefinedType(JvmIdentifiableElement element) |
boolean |
isRefinedType(XExpression expression)
Returns
true if the expression's type is based on a type
refinement, e.g. an instanceof guard my specialize the type of the checked
reference. |
boolean |
isResolved(java.lang.Object handle) |
boolean |
isVoidReturnTypeAllowed(XExpression expression) |
boolean |
isVoidTypeAllowed(XExpression expression)
Returns
true if the given expression may have the type void . |
protected abstract void |
markToBeInferred(XExpression expression) |
protected TypeData |
mergeTypeData(XExpression expression,
java.util.List<TypeData> allValues,
boolean returnType,
boolean nullIfEmpty) |
protected ResolvedTypes |
pushExpectedExceptions(JvmExecutable exceptionDeclarator) |
protected ResolvedTypes |
pushExpectedExceptions(java.util.List<LightweightTypeReference> exceptions) |
protected StackedResolvedTypes |
pushReassigningTypes() |
protected StackedResolvedTypes |
pushTypes() |
protected ExpressionAwareStackedResolvedTypes |
pushTypes(XExpression context) |
void |
reassignType(JvmIdentifiableElement identifiable,
LightweightTypeReference reference) |
void |
reassignTypeWithoutMerge(JvmIdentifiableElement identifiable,
LightweightTypeReference reference) |
protected void |
refineExpectedType(XExpression receiver,
ITypeExpectation refinedExpectation) |
protected LightweightBoundTypeArgument |
removeRecursiveTypeArguments(java.lang.Object handle,
LightweightBoundTypeArgument boundTypeArgument) |
protected void |
replacePreviousExpressionScope(org.eclipse.emf.ecore.EObject context,
IFeatureScopeSession session,
IExpressionScope.Anchor anchor) |
protected void |
resolveDependentTypeArguments(java.lang.Object handle,
LightweightBoundTypeArgument boundTypeArgument) |
protected void |
setPropagatedType(XExpression expression) |
protected void |
setRefinedType(XExpression expression) |
void |
setType(JvmIdentifiableElement identifiable,
LightweightTypeReference reference) |
protected CompoundTypeReference |
toMultiType(LightweightTypeReference first,
LightweightTypeReference second) |
protected LightweightTypeReference |
toOwnedReference(LightweightTypeReference result) |
java.lang.String |
toString() |
protected IResolvedTypes |
withFlattenedReassignedTypes() |
protected ResolvedTypes(ResolvedTypes.Shared shared)
protected CancelIndicator getMonitor()
protected void clear()
protected IssueSeverities getSeverities()
protected IFeatureScopeTracker getFeatureScopeTracker()
public ITypeReferenceOwner getReferenceOwner()
public org.eclipse.emf.ecore.resource.ResourceSet getContextResourceSet()
public CommonTypeComputationServices getServices()
public java.util.Collection<AbstractDiagnostic> getQueuedDiagnostics()
getQueuedDiagnostics
in interface IResolvedTypes
public void addDiagnostic(AbstractDiagnostic diagnostic)
public java.util.List<LightweightTypeReference> getThrownExceptions(XExpression obj)
getThrownExceptions
in interface IResolvedTypes
public JvmIdentifiableElement getLinkedFeature(XAbstractFeatureCall featureCall)
IResolvedTypes
null
, the result is null
.getLinkedFeature
in interface IResolvedTypes
featureCall
- the feature call that is queried for the current linking state.null
if none.public JvmIdentifiableElement getLinkedFeature(XConstructorCall constructorCall)
IResolvedTypes
null
, the result is null
.
If the constructor call is broken, it may return a JvmType
instead of
a JvmConstructor
.getLinkedFeature
in interface IResolvedTypes
constructorCall
- the constructor call that is queried for the current linking state.null
if none.public IFeatureLinkingCandidate getLinkingCandidate(XAbstractFeatureCall featureCall)
IResolvedTypes
null
, the result is null
.getLinkingCandidate
in interface IResolvedTypes
featureCall
- the feature call that is queried for the current linking state.null
if none.public IConstructorLinkingCandidate getLinkingCandidate(XConstructorCall constructorCall)
IResolvedTypes
null
, the result is null
.
If the constructor call is broken, it may return a JvmType
instead of
a JvmConstructor
.getLinkingCandidate
in interface IResolvedTypes
constructorCall
- the constructor call that is queried for the current linking state.null
if none.protected IApplicableCandidate doGetCandidate(XExpression featureOrConstructorCall)
protected JvmIdentifiableElement doGetLinkedFeature(XExpression featureOrConstructorCall)
protected TypeData getTypeData(XExpression expression, boolean returnType)
protected TypeData getTypeData(XExpression expression, boolean returnType, boolean nullIfEmpty)
protected java.util.List<TypeData> doGetTypeData(XExpression expression)
protected TypeData mergeTypeData(XExpression expression, java.util.List<TypeData> allValues, boolean returnType, boolean nullIfEmpty)
protected LightweightTypeReference getMergedType(java.util.List<LightweightTypeReference> types)
public LightweightTypeReference getActualType(XExpression expression)
IResolvedTypes
null
if none.getActualType
in interface IResolvedTypes
expression
- expression whose type is queried.protected abstract LightweightTypeReference getExpectedTypeForAssociatedExpression(JvmMember member, XExpression expression)
public LightweightTypeReference getReturnType(XExpression expression)
IResolvedTypes
null
if none.getReturnType
in interface IResolvedTypes
expression
- expression whose return type is queried.protected LightweightTypeReference toOwnedReference(LightweightTypeReference result)
protected LightweightTypeReference doGetActualType(XExpression expression)
protected LightweightTypeReference doGetReturnType(XExpression expression)
public LightweightTypeReference getExpectedType(XExpression expression)
IResolvedTypes
null
if none.getExpectedType
in interface IResolvedTypes
expression
- expression whose expected type is queried.protected ResolvedTypes pushExpectedExceptions(java.util.List<LightweightTypeReference> exceptions)
protected ResolvedTypes discardExpectedExceptions()
protected ResolvedTypes pushExpectedExceptions(JvmExecutable exceptionDeclarator)
public LightweightTypeReference getExpectedReturnType(XExpression expression)
IResolvedTypes
null
if none.getExpectedReturnType
in interface IResolvedTypes
expression
- expression whose expected return type is queried.public boolean isVoidTypeAllowed(XExpression expression)
IResolvedTypes
true
if the given expression may have the type void
.isVoidTypeAllowed
in interface IResolvedTypes
expression
- expression whose expected type is queried.public boolean isVoidReturnTypeAllowed(XExpression expression)
protected LightweightTypeReference doGetExpectedType(XExpression expression, boolean returnType)
public final java.util.List<LightweightTypeReference> getActualTypeArguments(XExpression expression)
IResolvedTypes
class C<T, V> { public <PLgt; C(P p) {} }An invocation of the constructor
C
will return three type arguments, the bound
values of for P
, T
and V
.getActualTypeArguments
in interface IResolvedTypes
expression
- may either be an XAbstractFeatureCall
or XConstructorCall
. May not be null
.protected java.util.List<LightweightTypeReference> doGetActualTypeArguments(XExpression expression)
public void setType(JvmIdentifiableElement identifiable, LightweightTypeReference reference)
public void reassignType(JvmIdentifiableElement identifiable, LightweightTypeReference reference)
protected CompoundTypeReference toMultiType(LightweightTypeReference first, LightweightTypeReference second)
protected boolean isRefinedType(JvmIdentifiableElement element)
public void reassignTypeWithoutMerge(JvmIdentifiableElement identifiable, LightweightTypeReference reference)
protected LightweightTypeReference acceptType(XExpression expression, AbstractTypeExpectation expectation, LightweightTypeReference type, boolean returnType, int flags)
protected int getConformanceFlags(TypeData typeData, boolean recompute)
protected void acceptType(XExpression expression, TypeData typeData)
protected java.util.Map<JvmIdentifiableElement,LightweightTypeReference> basicGetTypes()
protected java.util.Map<JvmIdentifiableElement,LightweightTypeReference> basicGetReassignedTypes()
protected java.util.Map<XExpression,java.util.List<TypeData>> basicGetExpressionTypes()
protected void refineExpectedType(XExpression receiver, ITypeExpectation refinedExpectation)
protected java.util.Map<java.lang.Object,java.util.List<LightweightBoundTypeArgument>> basicGetTypeParameterHints()
protected java.util.Map<XExpression,IApplicableCandidate> basicGetLinkingMap()
public java.util.Collection<ILinkingCandidate> getFollowUpErrors()
IResolvedTypes
getFollowUpErrors
in interface IResolvedTypes
public java.util.Collection<IAmbiguousLinkingCandidate> getAmbiguousLinkingCandidates()
IResolvedTypes
getAmbiguousLinkingCandidates
in interface IResolvedTypes
public LightweightTypeReference getActualType(JvmIdentifiableElement identifiable)
IResolvedTypes
null
if none.getActualType
in interface IResolvedTypes
identifiable
- identifiable whose type is queried.protected final LightweightTypeReference doGetActualType(JvmIdentifiableElement identifiable, boolean ignoreReassignedTypes)
protected LightweightTypeReference doGetActualTypeNoDeclaration(JvmIdentifiableElement identifiable, boolean ignoreReassignedTypes)
protected LightweightTypeReference doGetDeclaredType(JvmIdentifiableElement identifiable)
protected JvmTypeReference getDeclaredType(JvmIdentifiableElement identifiable)
public final IFeatureLinkingCandidate getFeature(XAbstractFeatureCall featureCall)
protected IFeatureLinkingCandidate doGetFeature(XAbstractFeatureCall featureCall)
public final IConstructorLinkingCandidate getConstructor(XConstructorCall constructorCall)
protected IConstructorLinkingCandidate doGetConstructor(XConstructorCall constructorCall)
protected void acceptCandidate(XExpression expression, IApplicableCandidate candidate)
protected DefaultReentrantTypeResolver getResolver()
protected UnboundTypeReference getUnboundTypeReference(java.lang.Object handle)
protected UnboundTypeReference createUnboundTypeReference(XExpression expression, JvmTypeParameter type)
protected void acceptUnboundTypeReference(java.lang.Object handle, UnboundTypeReference reference)
protected java.util.Map<java.lang.Object,UnboundTypeReference> basicGetTypeParameters()
public java.lang.String toString()
toString
in class java.lang.Object
protected void closeBracket(java.lang.StringBuilder result, java.lang.String indentation)
protected void appendContent(java.lang.StringBuilder result, java.lang.String indentation)
protected void appendContent(java.util.Map<?,?> map, java.lang.String prefix, java.lang.StringBuilder result, java.lang.String indentation)
protected void appendContent(java.util.Collection<?> values, java.lang.String prefix, java.lang.StringBuilder result, java.lang.String indentation)
protected void appendListMapContent(java.util.Map<?,? extends java.util.Collection<?>> map, java.lang.String prefix, java.lang.StringBuilder result, java.lang.String indentation)
public void acceptHint(java.lang.Object handle, LightweightBoundTypeArgument boundTypeArgument)
protected LightweightBoundTypeArgument copyBoundTypeArgument(LightweightTypeReference typeReference, LightweightBoundTypeArgument boundTypeArgument)
protected LightweightBoundTypeArgument removeRecursiveTypeArguments(java.lang.Object handle, LightweightBoundTypeArgument boundTypeArgument)
protected void resolveDependentTypeArguments(java.lang.Object handle, LightweightBoundTypeArgument boundTypeArgument)
public final boolean isResolved(java.lang.Object handle)
protected boolean doIsResolved(java.lang.Object handle)
protected boolean isPropagatedType(XExpression expression)
public boolean isRefinedType(XExpression expression)
IResolvedTypes
true
if 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.isRefinedType
in interface IResolvedTypes
expression
- the expression that may have been typed based on a refinement.true
if the type was refined, false
otherwise.protected void setPropagatedType(XExpression expression)
protected void setRefinedType(XExpression expression)
protected java.util.Set<XExpression> basicGetPropagatedTypes()
protected java.util.Set<XExpression> basicGetRefinedTypes()
protected java.util.List<JvmTypeParameter> basicGetDeclardTypeParameters()
public java.util.List<JvmTypeParameter> getDeclaredTypeParameters()
public void addDeclaredTypeParameters(java.util.List<JvmTypeParameter> typeParameters)
protected java.util.List<LightweightTypeReference> getExpectedExceptions()
public java.util.List<LightweightBoundTypeArgument> getAllHints(java.lang.Object handle)
protected java.util.List<LightweightBoundTypeArgument> getHints(java.lang.Object handle)
protected void addNonRecursiveHints(java.util.List<LightweightBoundTypeArgument> hints, java.util.Set<java.lang.Object> seenHandles, java.util.List<LightweightBoundTypeArgument> result)
protected void addNonRecursiveHints(LightweightBoundTypeArgument original, java.util.List<LightweightBoundTypeArgument> hints, java.util.Set<java.lang.Object> seenHandles, java.util.List<LightweightBoundTypeArgument> result)
protected void addNonRecursiveHints(LightweightBoundTypeArgument original, UnboundTypeReference reference, java.util.Set<java.lang.Object> seenHandles, java.util.List<LightweightBoundTypeArgument> result)
protected StackedResolvedTypes pushTypes()
protected ExpressionAwareStackedResolvedTypes pushTypes(XExpression context)
protected StackedResolvedTypes pushReassigningTypes()
protected abstract void markToBeInferred(XExpression expression)
protected void addExpressionScope(org.eclipse.emf.ecore.EObject context, IFeatureScopeSession session, IExpressionScope.Anchor anchor)
protected void replacePreviousExpressionScope(org.eclipse.emf.ecore.EObject context, IFeatureScopeSession session, IExpressionScope.Anchor anchor)
public IExpressionScope getExpressionScope(org.eclipse.emf.ecore.EObject context, IExpressionScope.Anchor anchor)
IResolvedTypes
getExpressionScope
in interface IResolvedTypes
public boolean hasExpressionScope(org.eclipse.emf.ecore.EObject context, IExpressionScope.Anchor anchor)
hasExpressionScope
in interface IResolvedTypes
protected IResolvedTypes withFlattenedReassignedTypes()
protected java.util.Map<JvmIdentifiableElement,LightweightTypeReference> getFlattenedReassignedTypes()