Class ValueDeclaration
java.lang.Object
de.fraunhofer.aisec.cpg.graph.Node
de.fraunhofer.aisec.cpg.graph.declarations.Declaration
de.fraunhofer.aisec.cpg.graph.declarations.ValueDeclaration
- All Implemented Interfaces:
HasType,Persistable,IVisitable<de.fraunhofer.aisec.cpg.graph.Node>
- Direct Known Subclasses:
EnumConstantDeclaration,FieldDeclaration,FunctionDeclaration,ParamVariableDeclaration,TypeParamDeclaration,VariableDeclaration
public abstract class ValueDeclaration extends Declaration implements HasType
A declaration who has a type.
-
Nested Class Summary
Nested classes/interfaces inherited from class de.fraunhofer.aisec.cpg.graph.Node
de.fraunhofer.aisec.cpg.graph.Node.CompanionNested classes/interfaces inherited from interface de.fraunhofer.aisec.cpg.graph.HasType
HasType.SecondaryTypeEdge, HasType.TypeListener -
Field Summary
Fields Modifier and Type Field Description protected java.util.Set<Type>possibleSubTypesprotected TypetypeFields inherited from class de.fraunhofer.aisec.cpg.graph.Node
Companion, EMPTY_NAME, TO_STRING_STYLE -
Constructor Summary
Constructors Constructor Description ValueDeclaration() -
Method Summary
Modifier and Type Method Description booleanequals(java.lang.Object o)java.util.Set<Type>getPossibleSubTypes()TypegetPropagationType()There is no case in which we would want to propagate a referenceType as in this case always the underlying ObjectType should be propagatedTypegetType()java.util.Set<HasType.TypeListener>getTypeListeners()inthashCode()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.voidsetPossibleSubTypes(java.util.Set<Type> possibleSubTypes, java.util.Collection<HasType> root)Set the node's possible subtypes.voidsetType(Type type, java.util.Collection<HasType> root)Set the node's type.java.lang.StringtoString()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 PassMethods inherited from class de.fraunhofer.aisec.cpg.graph.Node
addAnnotations, addNextDFG, addNextEOG, addPrevDFG, addPrevEOG, addTypedef, clearNextEOG, disconnectFromGraph, getAnnotations, getArgumentIndex, getAstChildren, getCode, getComment, getFile, getId, getLocation, getName, getNextDFG, getNextEOG, getNextEOGEdges, getPrevDFG, getPrevEOG, getPrevEOGEdges, getTypedefs, isImplicit, isInferred, removeNextDFG, removePrevDFG, removePrevEOGEntry, setAnnotations, setArgumentIndex, setCode, setComment, setFile, setId, setImplicit, setInferred, setLocation, setName, setNextDFG, setNextEOG, setNextEOGEdges, setPrevDFG, setPrevEOG, setPrevEOGEdges, setTypedefsMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface de.fraunhofer.aisec.cpg.graph.HasType
setPossibleSubTypes, setTypeMethods inherited from interface de.fraunhofer.aisec.cpg.processing.IVisitable
accept
-
Field Details
-
type
-
possibleSubTypes
-
-
Constructor Details
-
ValueDeclaration
public ValueDeclaration()
-
-
Method Details
-
getType
-
getPropagationType
There is no case in which we would want to propagate a referenceType as in this case always the underlying ObjectType should be propagated- Specified by:
getPropagationTypein interfaceHasType- Returns:
- Type that should be propagated
-
setType
Description copied from interface:HasTypeSet the node's type. This may start a chain of type listener notifications- Specified by:
setTypein interfaceHasType- 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.
-
resetTypes
Description copied from interface:HasTypeUsed to set the type and clear the possible subtypes list for when a type is more precise than the current.- Specified by:
resetTypesin interfaceHasType- Parameters:
type- the more precise type
-
registerTypeListener
- Specified by:
registerTypeListenerin interfaceHasType
-
unregisterTypeListener
- Specified by:
unregisterTypeListenerin interfaceHasType
-
getTypeListeners
- Specified by:
getTypeListenersin interfaceHasType
-
getPossibleSubTypes
- Specified by:
getPossibleSubTypesin interfaceHasType
-
setPossibleSubTypes
public void setPossibleSubTypes(java.util.Set<Type> possibleSubTypes, @NotNull java.util.Collection<HasType> root)Description copied from interface:HasTypeSet the node's possible subtypes. Listener circle detection works the same way as withHasType.setType(Type, Collection<HasType>)- Specified by:
setPossibleSubTypesin interfaceHasTyperoot- A list of already seen nodes which is used for detecting loops.
-
refreshType
public void refreshType()- Specified by:
refreshTypein interfaceHasType
-
toString
public java.lang.String toString()- Overrides:
toStringin classde.fraunhofer.aisec.cpg.graph.Node
-
equals
public boolean equals(java.lang.Object o)- Overrides:
equalsin classde.fraunhofer.aisec.cpg.graph.Node
-
hashCode
public int hashCode()- Overrides:
hashCodein classde.fraunhofer.aisec.cpg.graph.Node
-
updateType
Description copied from interface:HasTypeSideeffect free type modification WARNING: This should only be used by the TypeSystem Pass- Specified by:
updateTypein interfaceHasType- Parameters:
type- new type
-
updatePossibleSubtypes
- Specified by:
updatePossibleSubtypesin interfaceHasType
-