Class JSError

  • All Implemented Interfaces:
    java.io.Serializable

    public abstract class JSError
    extends java.lang.Object
    implements java.io.Serializable
    Compile error description.
    See Also:
    Serialized Form
    • Method Detail

      • getType

        public abstract DiagnosticType getType()
        A type of the error.
      • getDescription

        public abstract java.lang.String getDescription()
        Description of the error.
      • getSourceName

        @Nullable
        public abstract java.lang.String getSourceName()
        Name of the source
      • getLineno

        public abstract int getLineno()
        One-indexed line number of the error location.
      • getCharno

        public abstract int getCharno()
        Zero-indexed character number of the error location.
      • getNode

        @Nullable
        public abstract Node getNode()
        Node where the warning occurred.
      • getDefaultLevel

        public abstract CheckLevel getDefaultLevel()
        The default level, before any of the WarningsGuards are applied.
      • make

        public static JSError make​(DiagnosticType type,
                                   java.lang.String... arguments)
        Creates a JSError with no source information
        Parameters:
        type - The DiagnosticType
        arguments - Arguments to be incorporated into the message
      • make

        public static JSError make​(java.lang.String sourceName,
                                   int lineno,
                                   int charno,
                                   DiagnosticType type,
                                   java.lang.String... arguments)
        Creates a JSError at a given source location
        Parameters:
        sourceName - The source file name
        lineno - Line number with source file, or -1 if unknown
        charno - Column number within line, or -1 for whole line.
        type - The DiagnosticType
        arguments - Arguments to be incorporated into the message
      • make

        public static JSError make​(java.lang.String sourceName,
                                   int lineno,
                                   int charno,
                                   CheckLevel level,
                                   DiagnosticType type,
                                   java.lang.String... arguments)
        Creates a JSError at a given source location
        Parameters:
        sourceName - The source file name
        lineno - Line number with source file, or -1 if unknown
        charno - Column number within line, or -1 for whole line.
        type - The DiagnosticType
        arguments - Arguments to be incorporated into the message
      • make

        public static JSError make​(Node n,
                                   DiagnosticType type,
                                   java.lang.String... arguments)
        Creates a JSError from a file and Node position.
        Parameters:
        n - Determines the line and char position and source file name
        type - The DiagnosticType
        arguments - Arguments to be incorporated into the message
      • toString

        public final java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        Returns:
        the default rendering of an error as text.
      • format

        public final java.lang.String format​(CheckLevel level,
                                             MessageFormatter formatter)
        Format a message at the given level.
        Returns:
        the formatted message or null
      • getNodeSourceOffset

        public final int getNodeSourceOffset()
        Returns:
        the offset of the region the Error applies to, or -1 if the offset is unknown.
      • getNodeLength

        public final int getNodeLength()
        Returns:
        the length of the region the Error applies to, or 0 if the length is unknown.
      • getLineNumber

        public final int getLineNumber()
        Alias for getLineno().