@NonNullByDefault public abstract class ResolvedTypes extends java.lang.Object implements IResolvedTypes
Modifier and Type | Class and Description |
---|---|
protected class |
ResolvedTypes.Owner |
IResolvedTypes.NullResolvedTypes
NULL
Modifier | Constructor and Description |
---|---|
protected |
ResolvedTypes(DefaultReentrantTypeResolver resolver) |
Modifier and Type | Method and Description |
---|---|
void |
acceptHint(java.lang.Object handle,
LightweightBoundTypeArgument boundTypeArgument) |
void |
acceptLinkingInformation(XExpression expression,
ILinkingCandidate candidate) |
protected LightweightTypeReference |
acceptType(XExpression expression,
AbstractTypeExpectation expectation,
LightweightTypeReference type,
boolean returnType,
ConformanceHint... hints) |
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 |
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,ILinkingCandidate> |
basicGetLinkingCandidates() |
protected java.util.Set<XExpression> |
basicGetPropagatedTypes() |
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 OwnedConverter |
createConverter() |
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 |
doGetExpectedType(XExpression expression,
boolean returnType) |
protected JvmIdentifiableElement |
doGetLinkedFeature(XExpression featureOrConstructorCall) |
protected ILinkingCandidate |
doGetLinkingCandidate(XExpression featureOrConstructorCall) |
protected LightweightTypeReference |
doGetReturnType(XExpression expression) |
protected java.util.Collection<TypeData> |
doGetTypeData(XExpression expression) |
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) |
java.util.List<LightweightBoundTypeArgument> |
getAllHints(java.lang.Object handle) |
protected java.util.EnumSet<ConformanceHint> |
getConformanceHints(TypeData typeData,
boolean recompute) |
IConstructorLinkingCandidate |
getConstructor(XConstructorCall constructorCall) |
org.eclipse.emf.ecore.resource.ResourceSet |
getContextResourceSet() |
protected OwnedConverter |
getConverter() |
protected LightweightTypeReference |
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) |
IFeatureLinkingCandidate |
getFeature(XAbstractFeatureCall featureCall) |
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) |
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 abstract IssueSeverities |
getSeverities() |
protected TypeData |
getTypeData(XExpression expression,
boolean returnType) |
protected TypeData |
getTypeData(XExpression expression,
boolean returnType,
boolean nullIfEmpty) |
protected UnboundTypeReference |
getUnboundTypeReference(java.lang.Object handle) |
protected JvmTypeReference |
getUnconvertedDeclaredType(JvmIdentifiableElement identifiable) |
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.Collection<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 |
resolveDependentTypeArguments(java.lang.Object handle,
LightweightBoundTypeArgument boundTypeArgument) |
protected void |
setPropagatedType(XExpression expression) |
protected void |
setRefinedType(XExpression expression) |
void |
setType(JvmIdentifiableElement identifiable,
LightweightTypeReference reference) |
protected LightweightTypeReference |
toOwnedReference(LightweightTypeReference result) |
java.lang.String |
toString() |
protected ResolvedTypes(DefaultReentrantTypeResolver resolver)
protected void clear()
protected abstract IssueSeverities getSeverities()
protected OwnedConverter getConverter()
public ITypeReferenceOwner getReferenceOwner()
protected OwnedConverter createConverter()
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)
@Nullable public JvmIdentifiableElement getLinkedFeature(@Nullable 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.@Nullable public JvmIdentifiableElement getLinkedFeature(@Nullable 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.@Nullable public IFeatureLinkingCandidate getLinkingCandidate(@Nullable 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.@Nullable public IConstructorLinkingCandidate getLinkingCandidate(@Nullable 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.@Nullable protected ILinkingCandidate doGetLinkingCandidate(@Nullable XExpression featureOrConstructorCall)
@Nullable protected JvmIdentifiableElement doGetLinkedFeature(@Nullable XExpression featureOrConstructorCall)
@Nullable protected TypeData getTypeData(XExpression expression, boolean returnType)
@Nullable protected TypeData getTypeData(XExpression expression, boolean returnType, boolean nullIfEmpty)
@Nullable protected java.util.Collection<TypeData> doGetTypeData(XExpression expression)
@Nullable protected TypeData mergeTypeData(XExpression expression, java.util.Collection<TypeData> allValues, boolean returnType, boolean nullIfEmpty)
@Nullable protected LightweightTypeReference getMergedType(java.util.List<LightweightTypeReference> types)
@Nullable public LightweightTypeReference getActualType(XExpression expression)
IResolvedTypes
null
if none.getActualType
in interface IResolvedTypes
expression
- expression whose type is queried.@Nullable protected abstract LightweightTypeReference getExpectedTypeForAssociatedExpression(JvmMember member, XExpression expression)
@Nullable public LightweightTypeReference getReturnType(XExpression expression)
IResolvedTypes
null
if none.getReturnType
in interface IResolvedTypes
expression
- expression whose return type is queried.@Nullable protected LightweightTypeReference toOwnedReference(@Nullable LightweightTypeReference result)
@Nullable protected LightweightTypeReference doGetActualType(XExpression expression)
@Nullable protected LightweightTypeReference doGetReturnType(XExpression expression)
@Nullable 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)
@Nullable 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)
@Nullable protected LightweightTypeReference doGetExpectedType(XExpression expression, boolean returnType)
public final java.util.List<LightweightTypeReference> getActualTypeArguments(XExpression expression)
getActualTypeArguments
in interface IResolvedTypes
expression
- may either be an XAbstractFeatureCall
or XConstructorCall
. May not be null
.@Nullable protected java.util.List<LightweightTypeReference> doGetActualTypeArguments(XExpression expression)
public void setType(JvmIdentifiableElement identifiable, LightweightTypeReference reference)
public void reassignType(JvmIdentifiableElement identifiable, @Nullable LightweightTypeReference reference)
protected boolean isRefinedType(JvmIdentifiableElement element)
public void reassignTypeWithoutMerge(JvmIdentifiableElement identifiable, @Nullable LightweightTypeReference reference)
protected LightweightTypeReference acceptType(XExpression expression, AbstractTypeExpectation expectation, LightweightTypeReference type, boolean returnType, ConformanceHint... hints)
protected java.util.EnumSet<ConformanceHint> getConformanceHints(TypeData typeData, boolean recompute)
protected void acceptType(XExpression expression, TypeData typeData)
protected java.util.Map<JvmIdentifiableElement,LightweightTypeReference> basicGetTypes()
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,ILinkingCandidate> basicGetLinkingCandidates()
public java.util.Collection<ILinkingCandidate> getFollowUpErrors()
IResolvedTypes
getFollowUpErrors
in interface IResolvedTypes
@Nullable public LightweightTypeReference getActualType(JvmIdentifiableElement identifiable)
IResolvedTypes
null
if none.getActualType
in interface IResolvedTypes
identifiable
- identifiable whose type is queried.@Nullable protected LightweightTypeReference doGetActualType(JvmIdentifiableElement identifiable, boolean ignoreReassignedTypes)
@Nullable protected LightweightTypeReference getDeclaredType(JvmIdentifiableElement identifiable)
@Nullable protected JvmTypeReference getUnconvertedDeclaredType(JvmIdentifiableElement identifiable)
@Nullable public IFeatureLinkingCandidate getFeature(XAbstractFeatureCall featureCall)
@Nullable public IConstructorLinkingCandidate getConstructor(XConstructorCall constructorCall)
public void acceptLinkingInformation(XExpression expression, ILinkingCandidate 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(@Nullable java.util.Map<?,?> map, java.lang.String prefix, java.lang.StringBuilder result, java.lang.String indentation)
protected void appendContent(@Nullable java.util.Collection<?> values, java.lang.String prefix, java.lang.StringBuilder result, java.lang.String indentation)
protected void appendListMapContent(@Nullable 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 boolean isResolved(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()
@Nullable 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)