Package de.fraunhofer.aisec.cpg.graph
Interface HasType
- All Known Implementing Classes:
ArrayCreationExpression,ArrayRangeExpression,ArraySubscriptionExpression,BinaryOperator,CallExpression,CastExpression,CompoundStatementExpression,ConditionalExpression,ConstructorDeclaration,DeclaredReferenceExpression,DeleteExpression,DesignatedInitializerExpression,EnumConstantDeclaration,ExplicitConstructorInvocation,Expression,ExpressionList,FieldDeclaration,FunctionDeclaration,InitializerListExpression,Literal,MemberCallExpression,MemberExpression,MethodDeclaration,NewExpression,ParamVariableDeclaration,StaticCallExpression,TypeExpression,TypeIdExpression,TypeParamDeclaration,UnaryOperator,UninitializedValue,ValueDeclaration,VariableDeclaration
public interface HasType
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceHasType.SecondaryTypeEdgeThe Typeresolver needs to be aware of all outgoing edges to types in order to merge equal types to the same node.static interfaceHasType.TypeListener -
Method Summary
Modifier and Type Method Description java.util.Set<Type>getPossibleSubTypes()TypegetPropagationType()TypegetType()java.util.Set<HasType.TypeListener>getTypeListeners()voidrefreshType()voidregisterTypeListener(HasType.TypeListener listener)voidresetTypes(Type type)Used to set the type and clear the possible subtypes list for when a type is more precise than the current.default voidsetPossibleSubTypes(java.util.Set<Type> possibleSubTypes)voidsetPossibleSubTypes(java.util.Set<Type> possibleSubTypes, @NonNull java.util.Collection<HasType> root)Set the node's possible subtypes.default voidsetType(Type type)voidsetType(Type type, java.util.Collection<HasType> root)Set the node's type.voidunregisterTypeListener(HasType.TypeListener listener)voidupdatePossibleSubtypes(java.util.Set<Type> types)voidupdateType(Type type)Sideeffect free type modification WARNING: This should only be used by the TypeSystem Pass
-
Method Details
-
getType
Type getType() -
getPropagationType
Type getPropagationType()- Returns:
- The returned Type is always the same as getType() with the exception of ReferenceType since there is no case in which we want to propagate a reference when using typeChanged()
-
setType
-
updateType
Sideeffect free type modification WARNING: This should only be used by the TypeSystem Pass- Parameters:
type- new type
-
updatePossibleSubtypes
-
setType
Set the node's type. This may start a chain of type listener notifications- Parameters:
type- new typeroot- The nodes which we have seen in the type change chain. When a node receives a type setting command where root.contains(this), we know that we have a type listener circle and can abort. If root is an empty list, the type change is seen as an externally triggered event and subsequent type listeners receive the current node as their root.
-
getPossibleSubTypes
java.util.Set<Type> getPossibleSubTypes() -
setPossibleSubTypes
-
setPossibleSubTypes
void setPossibleSubTypes(java.util.Set<Type> possibleSubTypes, @NonNull java.util.Collection<HasType> root)Set the node's possible subtypes. Listener circle detection works the same way as withsetType(Type, Collection<HasType>)- Parameters:
possibleSubTypes-root- A list of already seen nodes which is used for detecting loops.
-
registerTypeListener
-
unregisterTypeListener
-
getTypeListeners
java.util.Set<HasType.TypeListener> getTypeListeners() -
refreshType
void refreshType() -
resetTypes
Used to set the type and clear the possible subtypes list for when a type is more precise than the current.- Parameters:
type- the more precise type
-