Record Class AbstractCollectionIncompatibleTypeMatcher.MatchResult

java.lang.Object
java.lang.Record
com.google.errorprone.bugpatterns.collectionincompatibletype.AbstractCollectionIncompatibleTypeMatcher.MatchResult
Enclosing class:
AbstractCollectionIncompatibleTypeMatcher

public static record AbstractCollectionIncompatibleTypeMatcher.MatchResult(ExpressionTree sourceTree, com.sun.tools.javac.code.Type sourceType, com.sun.tools.javac.code.Type targetType, AbstractCollectionIncompatibleTypeMatcher matcher) extends Record
Encapsulates the result of matching a Collection.contains(Object)-like call, including the source and target types.
  • Constructor Details

    • MatchResult

      public MatchResult(ExpressionTree sourceTree, com.sun.tools.javac.code.Type sourceType, com.sun.tools.javac.code.Type targetType, AbstractCollectionIncompatibleTypeMatcher matcher)
      Creates an instance of a MatchResult record class.
      Parameters:
      sourceTree - the value for the sourceTree record component
      sourceType - the value for the sourceType record component
      targetType - the value for the targetType record component
      matcher - the value for the matcher record component
  • Method Details

    • create

      public static AbstractCollectionIncompatibleTypeMatcher.MatchResult create(ExpressionTree sourceTree, com.sun.tools.javac.code.Type sourceType, com.sun.tools.javac.code.Type targetType, AbstractCollectionIncompatibleTypeMatcher matcher)
    • message

      public String message(String sourceType, String targetType)
    • buildFix

      public Optional<Fix> buildFix()
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • sourceTree

      public ExpressionTree sourceTree()
      Returns the value of the sourceTree record component.
      Returns:
      the value of the sourceTree record component
    • sourceType

      public com.sun.tools.javac.code.Type sourceType()
      Returns the value of the sourceType record component.
      Returns:
      the value of the sourceType record component
    • targetType

      public com.sun.tools.javac.code.Type targetType()
      Returns the value of the targetType record component.
      Returns:
      the value of the targetType record component
    • matcher

      Returns the value of the matcher record component.
      Returns:
      the value of the matcher record component