Class TypePathEntry
java.lang.Object
org.checkerframework.afu.scenelib.el.TypePathEntry
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 Summary
FieldsModifier and TypeFieldDescriptionfinal intIf this represents a type argument (that is, step == TYPE_ARGUMENT), then the index for the type argument.static final @InternedDistinct TypePathEntryThe canonical ARRAY_ELEMENT TypePathEntry for building TypePaths.static final @InternedDistinct TypePathEntryThe canonical INNER_TYPE TypePathEntry for building TypePaths.final intThe kind of TypePathEntry; that is, how to get from the previous node in a TypePath to this one.static final @InternedDistinct TypePathEntryThe canonical WILDCARD_BOUND TypePathEntry for building TypePaths. -
Method Summary
Modifier and TypeMethodDescriptionstatic TypePathEntrycreate(int step, int argument) Create a TypePathEntry.booleanbooleanReturns true if thisTypePathEntryequalso; a slightly faster variant ofequals(Object)for when the argument is statically known to be another nonnullTypePathEntry.static List<TypePathEntry> getTypePathEntryListFromBinary(List<Integer> integerList) Converts a type path represented by a list of Integers to a list ofTypePathEntryelements.static org.objectweb.asm.TypePathgetTypePathFromBinary(List<Integer> integerList) Converts a type path represented by a list of integers to aTypePath.inthashCode()static org.objectweb.asm.TypePathlistToTypePath(List<TypePathEntry> typePathEntryList) Converts a type path represented by a list ofTypePathEntryto aTypePath.toString()static StringtoString(int step, int argument) Converts a TypePathEntry to a String.static List<TypePathEntry> typePathToList(org.objectweb.asm.TypePath typePath) Converts aTypePathto a list ofTypePathEntryelements.
-
Field Details
-
step
public final int stepThe 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 argumentIf this represents a type argument (that is, step == TYPE_ARGUMENT), then the index for the type argument. Otherwise, 0. -
ARRAY_ELEMENT
The canonical ARRAY_ELEMENT TypePathEntry for building TypePaths. -
INNER_TYPE
The canonical INNER_TYPE TypePathEntry for building TypePaths. -
WILDCARD_BOUND
The canonical WILDCARD_BOUND TypePathEntry for building TypePaths.
-
-
Method Details
-
create
Create a TypePathEntry.- Parameters:
step- the type of the TypePathEntryargument- index of the type argument or 0- Returns:
- a TypePathEntry
-
equals
Returns true if thisTypePathEntryequalso; a slightly faster variant ofequals(Object)for when the argument is statically known to be another nonnullTypePathEntry.- Parameters:
o- theTypePathEntryto compare to this- Returns:
- true if this equals
o
-
equals
-
hashCode
public int hashCode() -
toString
Converts a TypePathEntry to a String. The TypePathEntry is passed in as its component parts: step and argument.- Parameters:
step- the kind of TypePathEntryargument- a type index if the step == TYPE_ARGUMENT, otherwise ignored- Returns:
- the String reresentaion of the TypePathEntry
-
toString
-
getTypePathFromBinary
Converts a type path represented by a list of integers to aTypePath.- 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 aTypePathconstant; seestep.- Returns:
- the
TypePathcorresponding tointegerList, or null if the argument is null
-
getTypePathEntryListFromBinary
Converts a type path represented by a list of Integers to a list ofTypePathEntryelements.- 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 aTypePathconstant; seestep.- Returns:
- the list of
TypePathEntryelements corresponding tointegerList, or null if the argument is null
-
listToTypePath
Converts a type path represented by a list ofTypePathEntryto aTypePath.- Parameters:
typePathEntryList- theTypePathEntrylist corresponding to the location of some type annotation- Returns:
- the
TypePathcorresponding totypePathEntryList, or null if the argument is null or empty
-
typePathToList
Converts aTypePathto a list ofTypePathEntryelements.- Parameters:
typePath- theTypePathcorresponding to the location of some type annotation- Returns:
- the list of
TypePathEntryelements corresponding totypePath, or null if the argument is null
-