com.google.javascript.jscomp
Class JSError

java.lang.Object
  extended by com.google.javascript.jscomp.JSError

public class JSError
extends Object

Compile error description


Field Summary
 String description
          Description of the error
 CheckLevel level
          Deprecated. Use #getDefaultLevel
 int lineNumber
          Line number of the source
 String sourceName
          Name of the source
 
Method Summary
 boolean equals(Object o)
           
 String format(CheckLevel level, MessageFormatter formatter)
          Format a message at the given level.
 int getCharno()
          Get the character number.
 CheckLevel getDefaultLevel()
          The default level, before any of the WarningsGuards are applied.
 int getNodeLength()
           
 int getNodeSourceOffset()
           
 DiagnosticType getType()
           
 int hashCode()
           
static JSError make(DiagnosticType type, String... arguments)
          Creates a JSError with no source information
static JSError make(String sourceName, int lineno, int charno, CheckLevel level, DiagnosticType type, String... arguments)
          Creates a JSError at a given source location
static JSError make(String sourceName, int lineno, int charno, DiagnosticType type, String... arguments)
          Creates a JSError at a given source location
static JSError make(String sourceName, Node n, CheckLevel level, DiagnosticType type, String... arguments)
          Creates a JSError from a file and Node position.
static JSError make(String sourceName, Node n, DiagnosticType type, String... arguments)
          Creates a JSError from a file and Node position.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

description

public final String description
Description of the error


sourceName

public final String sourceName
Name of the source


lineNumber

public final int lineNumber
Line number of the source


level

@Deprecated
public final CheckLevel level
Deprecated. Use #getDefaultLevel
Method Detail

make

public static JSError make(DiagnosticType type,
                           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(String sourceName,
                           int lineno,
                           int charno,
                           DiagnosticType type,
                           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(String sourceName,
                           int lineno,
                           int charno,
                           CheckLevel level,
                           DiagnosticType type,
                           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(String sourceName,
                           Node n,
                           DiagnosticType type,
                           String... arguments)
Creates a JSError from a file and Node position.

Parameters:
sourceName - The source file name
n - Determines the line and char position within the source file name
type - The DiagnosticType
arguments - Arguments to be incorporated into the message

make

public static JSError make(String sourceName,
                           Node n,
                           CheckLevel level,
                           DiagnosticType type,
                           String... arguments)
Creates a JSError from a file and Node position.

Parameters:
sourceName - The source file name
n - Determines the line and char position within the source file name
type - The DiagnosticType
arguments - Arguments to be incorporated into the message

getType

public DiagnosticType getType()

format

public String format(CheckLevel level,
                     MessageFormatter formatter)
Format a message at the given level.

Returns:
the formatted message or null

toString

public String toString()
Overrides:
toString in class Object

getCharno

public int getCharno()
Get the character number.


getNodeSourceOffset

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

getNodeLength

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

getDefaultLevel

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


equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object