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.Companion

    Nested 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> possibleSubTypes  
    protected Type type  

    Fields 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
    boolean equals​(java.lang.Object o)  
    java.util.Set<Type> getPossibleSubTypes()  
    Type 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
    Type getType()  
    java.util.Set<HasType.TypeListener> getTypeListeners()  
    int hashCode()  
    void refreshType()  
    void registerTypeListener​(HasType.TypeListener listener)  
    void resetTypes​(Type type)
    Used to set the type and clear the possible subtypes list for when a type is more precise than the current.
    void setPossibleSubTypes​(java.util.Set<Type> possibleSubTypes, java.util.Collection<HasType> root)
    Set the node's possible subtypes.
    void setType​(Type type, java.util.Collection<HasType> root)
    Set the node's type.
    java.lang.String toString()  
    void unregisterTypeListener​(HasType.TypeListener listener)  
    void updatePossibleSubtypes​(java.util.Set<Type> types)  
    void updateType​(Type type)
    Sideeffect free type modification WARNING: This should only be used by the TypeSystem Pass

    Methods 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, setTypedefs

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface de.fraunhofer.aisec.cpg.graph.HasType

    setPossibleSubTypes, setType

    Methods inherited from interface de.fraunhofer.aisec.cpg.processing.IVisitable

    accept
  • Field Details

    • type

      protected Type type
    • possibleSubTypes

      protected java.util.Set<Type> possibleSubTypes
  • Constructor Details

    • ValueDeclaration

      public ValueDeclaration()
  • Method Details

    • getType

      public Type getType()
      Specified by:
      getType in interface HasType
    • getPropagationType

      public Type 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:
      getPropagationType in interface HasType
      Returns:
      Type that should be propagated
    • setType

      public void setType​(Type type, java.util.Collection<HasType> root)
      Description copied from interface: HasType
      Set the node's type. This may start a chain of type listener notifications
      Specified by:
      setType in interface HasType
      Parameters:
      type - new type
      root - 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

      public void resetTypes​(Type type)
      Description copied from interface: HasType
      Used to set the type and clear the possible subtypes list for when a type is more precise than the current.
      Specified by:
      resetTypes in interface HasType
      Parameters:
      type - the more precise type
    • registerTypeListener

      public void registerTypeListener​(HasType.TypeListener listener)
      Specified by:
      registerTypeListener in interface HasType
    • unregisterTypeListener

      public void unregisterTypeListener​(HasType.TypeListener listener)
      Specified by:
      unregisterTypeListener in interface HasType
    • getTypeListeners

      public java.util.Set<HasType.TypeListener> getTypeListeners()
      Specified by:
      getTypeListeners in interface HasType
    • getPossibleSubTypes

      public java.util.Set<Type> getPossibleSubTypes()
      Specified by:
      getPossibleSubTypes in interface HasType
    • setPossibleSubTypes

      public void setPossibleSubTypes​(java.util.Set<Type> possibleSubTypes, @NotNull java.util.Collection<HasType> root)
      Description copied from interface: HasType
      Set the node's possible subtypes. Listener circle detection works the same way as with HasType.setType(Type, Collection)
      Specified by:
      setPossibleSubTypes in interface HasType
      Parameters:
      possibleSubTypes - the set of possible sub types
      root - A list of already seen nodes which is used for detecting loops.
    • refreshType

      public void refreshType()
      Specified by:
      refreshType in interface HasType
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class de.fraunhofer.aisec.cpg.graph.Node
    • equals

      public boolean equals​(java.lang.Object o)
      Overrides:
      equals in class de.fraunhofer.aisec.cpg.graph.Node
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class de.fraunhofer.aisec.cpg.graph.Node
    • updateType

      public void updateType​(Type type)
      Description copied from interface: HasType
      Sideeffect free type modification WARNING: This should only be used by the TypeSystem Pass
      Specified by:
      updateType in interface HasType
      Parameters:
      type - new type
    • updatePossibleSubtypes

      public void updatePossibleSubtypes​(java.util.Set<Type> types)
      Specified by:
      updatePossibleSubtypes in interface HasType