Interface TypeNode

    • Method Detail

      • getTypeMirror

        default @NonNull JTypeMirror getTypeMirror()
        Returns the compile-time type of this node. For example, for a string literal, returns the type mirror for String, for a method call, returns the return type of the call, etc.

        This method ignores conversions applied to the value of the node because of its context. For example, in 1 + "", the numeric literal will have type int, but it is converted to String by the surrounding concatenation expression. Similarly, in Collections.singletonList(1), the ASTNumericLiteral node has type int, but the type of the method formal is Integer, and boxing is applied at runtime. Possibly, an API will be added to expose this information.

        Returns:
        The type mirror. Never returns null; if the type is unresolved, returns TypeSystem.UNKNOWN.