Record Class TargetType
java.lang.Object
java.lang.Record
com.google.errorprone.util.TargetType
An expression's target type, see
targetType(VisitorState).-
Constructor Summary
ConstructorsConstructorDescriptionTargetType(com.sun.tools.javac.code.Type type, TreePath path) Creates an instance of aTargetTyperecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.path()Returns the value of thepathrecord component.static @Nullable TargetTypetargetType(VisitorState state) Returns the target type of the tree at the givenVisitorState's path, or elsenull.final StringtoString()Returns a string representation of this record class.com.sun.tools.javac.code.Typetype()Returns the value of thetyperecord component.
-
Constructor Details
-
TargetType
Creates an instance of aTargetTyperecord class.- Parameters:
type- the value for thetyperecord componentpath- the value for thepathrecord component
-
-
Method Details
-
targetType
Returns the target type of the tree at the givenVisitorState's path, or elsenull.For example, the target type of an assignment expression is the variable's type, and the target type of a return statement is the enclosing method's type.
A general mental model is that the target type of an expression where the value is used is the highest supertype that you could cast to and still have this compile.
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
type
public com.sun.tools.javac.code.Type type()Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-
path
Returns the value of thepathrecord component.- Returns:
- the value of the
pathrecord component
-