Class ObjectType

java.lang.Object
de.fraunhofer.aisec.cpg.graph.Node
de.fraunhofer.aisec.cpg.graph.types.Type
de.fraunhofer.aisec.cpg.graph.types.ObjectType
All Implemented Interfaces:
HasType.SecondaryTypeEdge, Persistable, IVisitable<de.fraunhofer.aisec.cpg.graph.Node>

public class ObjectType
extends Type
implements HasType.SecondaryTypeEdge
This is the main type in the Type system. ObjectTypes describe objects, as instances of a class. This also includes primitive data types.
  • Constructor Details

  • Method Details

    • updateType

      public void updateType​(java.util.Collection<Type> typeState)
      Specified by:
      updateType in interface HasType.SecondaryTypeEdge
    • replaceGenerics

      public void replaceGenerics​(Type oldType, Type newType)
    • getGenerics

      public java.util.List<Type> getGenerics()
    • getGenericPropertyEdges

      public java.util.List<de.fraunhofer.aisec.cpg.graph.edge.PropertyEdge<Type>> getGenericPropertyEdges()
    • getRecordDeclaration

      public RecordDeclaration getRecordDeclaration()
    • setRecordDeclaration

      public void setRecordDeclaration​(RecordDeclaration recordDeclaration)
    • reference

      public PointerType reference​(PointerType.PointerOrigin pointerOrigin)
      Specified by:
      reference in class Type
      Parameters:
      pointerOrigin - Reason for the reference (array of pointer)
      Returns:
      PointerType to a ObjectType, e.g. int*
    • dereference

      public Type dereference()
      Specified by:
      dereference in class Type
      Returns:
      UnknownType, as we cannot infer any type information when dereferencing an ObjectType, as it is just some memory and its interpretation is unknown
    • duplicate

      public Type duplicate()
      Specified by:
      duplicate in class Type
      Returns:
      Creates an exact copy of the current type (chain)
    • setGenerics

      public void setGenerics​(java.util.List<Type> generics)
    • addGeneric

      public void addGeneric​(Type generic)
    • addGenerics

      public void addGenerics​(java.util.List<Type> generics)
    • isSimilar

      public boolean isSimilar​(Type t)
      Description copied from class: Type
      Required for possibleSubTypes to check if the new Type should be considered a subtype or not
      Overrides:
      isSimilar in class Type
      Parameters:
      t - other type the similarity is checked with
      Returns:
      True if the parameter t is equal to the current type (this)
    • equals

      public boolean equals​(java.lang.Object o)
      Overrides:
      equals in class Type
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Type