Interface JTypeDeclSymbol

All Superinterfaces:
AnnotableSymbol, JAccessibleElementSymbol, JElementSymbol
All Known Subinterfaces:
JClassSymbol, JTypeParameterSymbol

public interface JTypeDeclSymbol extends JAccessibleElementSymbol
A symbol that declares a type. These include

Note: type symbols are not types, they declare types. See JTypeMirror.getSymbol() for more details.

Since:
7.0.0
  • Method Details

    • isUnresolved

      default boolean isUnresolved()
      Returns true if this class is a symbolic reference to an unresolved class. In that case no information about the symbol are known except its name, and the accessors of this class return default values.

      This kind of symbol is introduced to allow for some best-effort symbolic resolution. For example in:

      
       import org.Bar;
      
       Bar foo = new Bar();
       
      and supposing org.Bar is not on the classpath. The type of foo is Bar, which we can qualify to org.Bar thanks to the import (via symbol tables, and without even querying the classpath). Even though we don't know what members org.Bar has, a test for typeIs("org.Bar") would succeed with certainty, so it makes sense to preserve the name information and not give up too early.

      Note that unresolved types are always created from an unresolved canonical name, so they can't be just any type. For example, they can't be array types, nor local classes (since those are lexically scoped, so always resolvable), nor anonymous classes (can only be referenced on their declaration site), type variables, etc.

      Specified by:
      isUnresolved in interface JElementSymbol
    • getSimpleName

      @NonNull String getSimpleName()
      Returns the simple name of this class, as specified by Class.getSimpleName().
      Specified by:
      getSimpleName in interface JElementSymbol
      Returns:
      the name
    • isInterface

      default boolean isInterface()
      This returns true if this is an interface. Annotation types are also interface types.