Package net.sourceforge.pmd.lang.java.ast

Interface TypeNode

    • Method Detail

      • getTypeMirror

        default @NonNullJTypeMirror getTypeMirror()
        Returns the compile-time type of this node. For example, for a string literal, returns the type mirror forString, 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, in1 + "", the numeric literal will have typeint, but it is converted toString by the surrounding concatenation expression. Similarly, inCollections.singletonList(1), theASTNumericLiteral node has typeint, but the type of the method formal isInteger, 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, returnsTypeSystem.UNKNOWN.