Class TypePathEntry

java.lang.Object
org.checkerframework.afu.scenelib.el.TypePathEntry

public class TypePathEntry extends Object
A TypePathEntry is a way to get from one node in a TypePath to another. One can treat these as edges in a graph.

A TypePathEntry corresponds to a step in an ASM TypePath.

List<TypePathEntry> corresponds to an ASM TypePath. List<TypePathEntry> also corresponds to the javac class com.sun.tools.javac.code.TypeAnnotationPosition.

TypePathEntry is immutable.

  • Field Details

    • step

      public final int step
      The kind of TypePathEntry; that is, how to get from the previous node in a TypePath to this one. One of TypePath.ARRAY_ELEMENT, TypePath.INNER_TYPE, TypePath.WILDCARD_BOUND, TypePath.TYPE_ARGUMENT.

      This corresponds to javac class com.sun.tools.javac.code.TypeAnnotationPosition.TypePathEntry.

    • argument

      public final int argument
      If this represents a type argument (that is, step == TYPE_ARGUMENT), then the index for the type argument. Otherwise, 0.
    • ARRAY_ELEMENT

      public static final @InternedDistinct TypePathEntry ARRAY_ELEMENT
      The canonical ARRAY_ELEMENT TypePathEntry for building TypePaths.
    • INNER_TYPE

      public static final @InternedDistinct TypePathEntry INNER_TYPE
      The canonical INNER_TYPE TypePathEntry for building TypePaths.
    • WILDCARD_BOUND

      public static final @InternedDistinct TypePathEntry WILDCARD_BOUND
      The canonical WILDCARD_BOUND TypePathEntry for building TypePaths.
  • Method Details

    • create

      public static TypePathEntry create(int step, int argument)
      Create a TypePathEntry.
      Parameters:
      step - the type of the TypePathEntry
      argument - index of the type argument or 0
      Returns:
      a TypePathEntry
    • equals

      public boolean equals(TypePathEntry o)
      Returns true if this TypePathEntry equals o; a slightly faster variant of equals(Object) for when the argument is statically known to be another nonnull TypePathEntry.
      Parameters:
      o - the TypePathEntry to compare to this
      Returns:
      true if this equals o
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public static String toString(int step, int argument)
      Converts a TypePathEntry to a String. The TypePathEntry is passed in as its component parts: step and argument.
      Parameters:
      step - the kind of TypePathEntry
      argument - a type index if the step == TYPE_ARGUMENT, otherwise ignored
      Returns:
      the String reresentaion of the TypePathEntry
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getTypePathFromBinary

      public static org.objectweb.asm.TypePath getTypePathFromBinary(List<Integer> integerList)
      Converts a type path represented by a list of integers to a TypePath.
      Parameters:
      integerList - the integer list in the form [step1, argument1, step2, argument2, ...] where step1 and argument1 are the step and argument of the first entry (or edge) of a type path. Each step is a TypePath constant; see step.
      Returns:
      the TypePath corresponding to integerList, or null if the argument is null
    • getTypePathEntryListFromBinary

      public static List<TypePathEntry> getTypePathEntryListFromBinary(List<Integer> integerList)
      Converts a type path represented by a list of Integers to a list of TypePathEntry elements.
      Parameters:
      integerList - the Integer list in the form [step1, argument1, step2, argument2, ...] where step1 and argument1 are the step and argument of the first entry (or edge) of a type path. Each step is a TypePath constant; see step.
      Returns:
      the list of TypePathEntry elements corresponding to integerList, or null if the argument is null
    • listToTypePath

      public static org.objectweb.asm.TypePath listToTypePath(List<TypePathEntry> typePathEntryList)
      Converts a type path represented by a list of TypePathEntry to a TypePath.
      Parameters:
      typePathEntryList - the TypePathEntry list corresponding to the location of some type annotation
      Returns:
      the TypePath corresponding to typePathEntryList, or null if the argument is null or empty
    • typePathToList

      public static List<TypePathEntry> typePathToList(org.objectweb.asm.TypePath typePath)
      Converts a TypePath to a list of TypePathEntry elements.
      Parameters:
      typePath - the TypePath corresponding to the location of some type annotation
      Returns:
      the list of TypePathEntry elements corresponding to typePath, or null if the argument is null