Class ClassName

java.lang.Object
com.google.errorprone.ClassName

@Immutable public final class ClassName extends Object
Encapsulates a qualified class name and caches its resolved javac Symbol.ClassSymbol, Type, and Name across a compilation.
  • Method Details

    • of

      public static ClassName of(String name)
      Constructs a ClassName from a qualified canonical or binary class name (e.g. "java.util.List", "java.util.Map.Entry", or "java.util.Map$Entry").
      Throws:
      IllegalArgumentException - if name is empty, ends with '.', is primitive/void, is an array type ("[...]"), or is parameterized ("<...>")
    • binaryName

      public com.sun.tools.javac.util.Name binaryName(VisitorState state)
      Returns the cached javac Name for the binary name.
    • symbol

      public @Nullable com.sun.tools.javac.code.Symbol.ClassSymbol symbol(VisitorState state)
      Resolves and caches the Symbol.ClassSymbol for this class in the current compilation, or returns null if the symbol is not available.
    • type

      public @Nullable com.sun.tools.javac.code.Type type(VisitorState state)
      Resolves and caches the Type for this class in the current compilation, or returns null if the symbol is not available.
    • asTypeSupplier

      public Supplier<@Nullable com.sun.tools.javac.code.Type> asTypeSupplier()
      Returns a Supplier view of type(VisitorState).
    • equals

      public boolean equals(@Nullable Object obj)
      Overrides:
      equals in class Object
    • hashCode

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

      public String toString()
      Overrides:
      toString in class Object