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.

        The type mirror. Never returns null; if the type is unresolved, returns TypeSystem.UNKNOWN.
      • getType

        default @Nullable Class<?> getType()
        This doesn't work. PMD doesn't load classes, it just reads the bytecode. Compare the symbol of the type mirror instead.
        Get the Java Class associated with this node.
        The Java Class, may return null.