Interface JTypeDeclSymbol

    • Method Detail

      • 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
      • isInterface

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