Class TypeConformanceComputer
- java.lang.Object
-
- org.eclipse.xtext.xbase.typesystem.conformance.RawTypeConformanceComputer
-
- org.eclipse.xtext.xbase.typesystem.conformance.TypeConformanceComputer
-
public class TypeConformanceComputer extends RawTypeConformanceComputer
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classTypeConformanceComputer.CommonSuperTypeFinderExtracted helper class to compute the common super type of an arbitrary list of given types.protected static classTypeConformanceComputer.ListSizeMementoprotected static classTypeConformanceComputer.MaxDistanceRawTypeAcceptorPopulates aMultisetwith the maximum number of necessary steps from a given type to its super types.
-
Field Summary
-
Fields inherited from class org.eclipse.xtext.xbase.typesystem.conformance.RawTypeConformanceComputer
ALLOW_BOXING, ALLOW_BOXING_UNBOXING, ALLOW_FUNCTION_CONVERSION, ALLOW_PRIMITIVE_WIDENING, ALLOW_RAW_TYPE_CONVERSION, ALLOW_SYNONYMS, ALLOW_UNBOXING, AS_NESTED_TYPE_ARGUMENT, AS_TYPE_ARGUMENT, BOXING, DEMAND_CONVERSION, INCOMPATIBLE, PRIMITIVE_WIDENING, RAW_TYPE, RAW_TYPE_CONVERSION, SUBTYPE, SUCCESS, SYNONYM, UNBOUND_COMPUTATION_ADDS_HINTS, UNBOXING, UNKNOWN_TYPE_PARTICIPATED
-
-
Constructor Summary
Constructors Constructor Description TypeConformanceComputer()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidaddComponentType(LightweightTypeReference reference, java.util.List<LightweightTypeReference> result)protected LightweightTypeReferenceconformsToAll(LightweightTypeReference type, java.util.List<LightweightTypeReference> types)protected booleancontainsPrimitiveOrAnyReferences(java.util.List<LightweightTypeReference> types)protected voidcumulateDistance(java.util.List<LightweightTypeReference> references, com.google.common.collect.Multimap<org.eclipse.xtext.common.types.JvmType,LightweightTypeReference> all, com.google.common.collect.Multiset<org.eclipse.xtext.common.types.JvmType> cumulatedDistance)Keeps the cumulated distance for all the common raw super types of the given references.protected intdoIsConformant(FunctionTypeReference left, FunctionTypeReference right, int flags)protected intdoIsConformantOuterType(LightweightTypeReference left, LightweightTypeReference right, int flags)protected intdoIsConformantTypeArguments(LightweightTypeReference left, LightweightTypeReference right, int flags)This is a hook for theTypeConformanceComputerto implement the type argument check.protected booleanenhanceSuperType(java.util.List<LightweightTypeReference> superTypes, java.util.List<LightweightTypeReference> initiallyRequested, ParameterizedTypeReference result)LightweightTypeReferencegetCommonParameterSuperType(java.util.List<LightweightTypeReference> types, java.util.List<LightweightTypeReference> initiallyRequested, ITypeReferenceOwner owner)LightweightTypeReferencegetCommonSuperType(java.util.List<LightweightTypeReference> types, ITypeReferenceOwner owner)Compute the common super type for the given types.protected LightweightTypeReferencegetFirstForRawType(com.google.common.collect.Multimap<org.eclipse.xtext.common.types.JvmType,LightweightTypeReference> all, org.eclipse.xtext.common.types.JvmType rawType)LightweightTypeReferencegetMostSpecialType(java.util.List<LightweightTypeReference> candidates)protected LightweightTypeReferencegetSuperType(ParameterizedTypeReference current, org.eclipse.xtext.common.types.JvmType type)This is a hook for theTypeConformanceComputerto provide the resolved super type.protected LightweightTypeReferencegetTypeParametersForSupertype(com.google.common.collect.Multimap<org.eclipse.xtext.common.types.JvmType,LightweightTypeReference> all, org.eclipse.xtext.common.types.JvmType rawType, ITypeReferenceOwner owner, java.util.List<LightweightTypeReference> initiallyRequested)protected voidinitializeDistance(LightweightTypeReference firstType, com.google.common.collect.Multimap<org.eclipse.xtext.common.types.JvmType,LightweightTypeReference> all, com.google.common.collect.Multiset<org.eclipse.xtext.common.types.JvmType> cumulatedDistance)protected voidinplaceSortByDistanceAndName(java.util.List<com.google.common.collect.Multiset.Entry<org.eclipse.xtext.common.types.JvmType>> candidates)protected booleanisClass(org.eclipse.xtext.common.types.JvmType type)booleanisConformant(LightweightTypeReference left, LightweightTypeReference right)intisConformant(LightweightTypeReference left, LightweightTypeReference right, int flags)intisConformant(LightweightTypeReference left, LightweightTypeReference right, TypeConformanceComputationArgument argument)protected booleanisRecursiveRequest(java.util.List<LightweightTypeReference> types, java.util.Set<java.lang.String> allNames, java.util.List<LightweightTypeReference> initiallyRequested)protected TypeConformanceComputer.CommonSuperTypeFindernewCommonSuperTypeFinder(ITypeReferenceOwner owner)protected java.util.List<LightweightTypeReference>replacePrimitivesAndRemoveAnyReferences(java.util.List<LightweightTypeReference> types)protected inttoFlags(TypeConformanceComputationArgument argument)-
Methods inherited from class org.eclipse.xtext.xbase.typesystem.conformance.RawTypeConformanceComputer
addHintAndAnnounceSuccess, doIsConformant, doIsConformant, doIsConformant, doIsConformant, doIsConformant, doIsConformant, doIsConformant, doIsConformant, doIsConformant, doIsConformant, doIsConformant, doIsConformant, doIsConformant, doIsConformant, doIsConformant, doIsConformant, doIsConformantOuter, doIsConformantToAnyType, internalGetPrimitiveKindFromWrapper, isAssignableAsFunctionType, isConformantMergeResult, isConformantToConstraints, isSynonymConformant, setSynonymTypesProvider, tryResolveAndCheckConformance, tryResolveAndCheckConformance
-
-
-
-
Method Detail
-
isConformant
public boolean isConformant(LightweightTypeReference left, LightweightTypeReference right)
-
isConformant
public int isConformant(LightweightTypeReference left, LightweightTypeReference right, TypeConformanceComputationArgument argument)
-
toFlags
protected int toFlags(TypeConformanceComputationArgument argument)
-
isConformant
public int isConformant(LightweightTypeReference left, LightweightTypeReference right, int flags)
- Overrides:
isConformantin classRawTypeConformanceComputer
-
getSuperType
protected LightweightTypeReference getSuperType(ParameterizedTypeReference current, org.eclipse.xtext.common.types.JvmType type)
Description copied from class:RawTypeConformanceComputerThis is a hook for theTypeConformanceComputerto provide the resolved super type.- Overrides:
getSuperTypein classRawTypeConformanceComputer
-
doIsConformantTypeArguments
protected int doIsConformantTypeArguments(LightweightTypeReference left, LightweightTypeReference right, int flags)
Description copied from class:RawTypeConformanceComputerThis is a hook for theTypeConformanceComputerto implement the type argument check.- Overrides:
doIsConformantTypeArgumentsin classRawTypeConformanceComputer
-
doIsConformantOuterType
protected int doIsConformantOuterType(LightweightTypeReference left, LightweightTypeReference right, int flags)
-
doIsConformant
protected int doIsConformant(FunctionTypeReference left, FunctionTypeReference right, int flags)
- Overrides:
doIsConformantin classRawTypeConformanceComputer
-
getCommonSuperType
public LightweightTypeReference getCommonSuperType(java.util.List<LightweightTypeReference> types, ITypeReferenceOwner owner)
Compute the common super type for the given types. May returnnullin case one of the types is primitive void but not all of them are.
-
newCommonSuperTypeFinder
protected TypeConformanceComputer.CommonSuperTypeFinder newCommonSuperTypeFinder(ITypeReferenceOwner owner)
-
isClass
protected boolean isClass(org.eclipse.xtext.common.types.JvmType type)
-
initializeDistance
protected void initializeDistance(LightweightTypeReference firstType, com.google.common.collect.Multimap<org.eclipse.xtext.common.types.JvmType,LightweightTypeReference> all, com.google.common.collect.Multiset<org.eclipse.xtext.common.types.JvmType> cumulatedDistance)
-
cumulateDistance
protected void cumulateDistance(java.util.List<LightweightTypeReference> references, com.google.common.collect.Multimap<org.eclipse.xtext.common.types.JvmType,LightweightTypeReference> all, com.google.common.collect.Multiset<org.eclipse.xtext.common.types.JvmType> cumulatedDistance)
Keeps the cumulated distance for all the common raw super types of the given references. Interfaces that are more directly implemented will get a lower total count than more general interfaces.
-
inplaceSortByDistanceAndName
protected void inplaceSortByDistanceAndName(java.util.List<com.google.common.collect.Multiset.Entry<org.eclipse.xtext.common.types.JvmType>> candidates)
-
replacePrimitivesAndRemoveAnyReferences
protected java.util.List<LightweightTypeReference> replacePrimitivesAndRemoveAnyReferences(java.util.List<LightweightTypeReference> types)
-
containsPrimitiveOrAnyReferences
protected boolean containsPrimitiveOrAnyReferences(java.util.List<LightweightTypeReference> types)
-
getFirstForRawType
protected LightweightTypeReference getFirstForRawType(com.google.common.collect.Multimap<org.eclipse.xtext.common.types.JvmType,LightweightTypeReference> all, org.eclipse.xtext.common.types.JvmType rawType)
-
getTypeParametersForSupertype
@Deprecated protected final LightweightTypeReference getTypeParametersForSupertype(com.google.common.collect.Multimap<org.eclipse.xtext.common.types.JvmType,LightweightTypeReference> all, org.eclipse.xtext.common.types.JvmType rawType, ITypeReferenceOwner owner, java.util.List<LightweightTypeReference> initiallyRequested)
Deprecated.Logic was moved to inner class CommonSuperTypeFinder in the context of bug 495314. This method is scheduled for deletion in Xtext 2.15
-
enhanceSuperType
@Deprecated protected final boolean enhanceSuperType(java.util.List<LightweightTypeReference> superTypes, java.util.List<LightweightTypeReference> initiallyRequested, ParameterizedTypeReference result)
Deprecated.Logic was moved to inner class CommonSuperTypeFinder in the context of bug 495314. This method is scheduled for deletion in Xtext 2.15
-
getCommonParameterSuperType
@Deprecated public final LightweightTypeReference getCommonParameterSuperType(java.util.List<LightweightTypeReference> types, java.util.List<LightweightTypeReference> initiallyRequested, ITypeReferenceOwner owner)
Logic was moved to inner class CommonSuperTypeFinder in the context of bug 495314. This method is scheduled for deletion in Xtext 2.15
-
isRecursiveRequest
@Deprecated protected final boolean isRecursiveRequest(java.util.List<LightweightTypeReference> types, java.util.Set<java.lang.String> allNames, java.util.List<LightweightTypeReference> initiallyRequested)
Logic was moved to inner class CommonSuperTypeFinder in the context of bug 495314. This method is scheduled for deletion in Xtext 2.15
-
getMostSpecialType
public LightweightTypeReference getMostSpecialType(java.util.List<LightweightTypeReference> candidates)
-
addComponentType
protected void addComponentType(LightweightTypeReference reference, java.util.List<LightweightTypeReference> result)
-
conformsToAll
protected LightweightTypeReference conformsToAll(LightweightTypeReference type, java.util.List<LightweightTypeReference> types)
-
-