Package com.google.javascript.jscomp
Class JSError
- java.lang.Object
-
- com.google.javascript.jscomp.JSError
-
public class JSError extends java.lang.Object
Compile error description
-
-
Field Summary
Fields Modifier and Type Field Description java.lang.String
description
Description of the errorCheckLevel
level
Deprecated.Use #getDefaultLevelint
lineNumber
Line number of the sourcejava.lang.String
sourceName
Name of the source
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
java.lang.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
getLineNumber()
Get the line number.int
getNodeLength()
int
getNodeSourceOffset()
DiagnosticType
getType()
int
hashCode()
static JSError
make(DiagnosticType type, java.lang.String... arguments)
Creates a JSError with no source informationstatic JSError
make(Node n, DiagnosticType type, java.lang.String... arguments)
Creates a JSError from a file and Node position.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 locationstatic JSError
make(java.lang.String sourceName, int lineno, int charno, DiagnosticType type, java.lang.String... arguments)
Creates a JSError at a given source locationstatic JSError
make(java.lang.String sourceName, Node n, CheckLevel level, DiagnosticType type, java.lang.String... arguments)
Creates a JSError from a file and Node position.static JSError
make(java.lang.String sourceName, Node n, DiagnosticType type, java.lang.String... arguments)
Creates a JSError from a file and Node position.java.lang.String
toString()
-
-
-
Field Detail
-
description
public final java.lang.String description
Description of the error
-
sourceName
public final java.lang.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, java.lang.String... arguments)
Creates a JSError with no source information- Parameters:
type
- The DiagnosticTypearguments
- 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 namelineno
- Line number with source file, or -1 if unknowncharno
- Column number within line, or -1 for whole line.type
- The DiagnosticTypearguments
- 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 namelineno
- Line number with source file, or -1 if unknowncharno
- Column number within line, or -1 for whole line.type
- The DiagnosticTypearguments
- Arguments to be incorporated into the message
-
make
public static JSError make(java.lang.String sourceName, Node n, DiagnosticType type, java.lang.String... arguments)
Creates a JSError from a file and Node position.- Parameters:
sourceName
- The source file namen
- Determines the line and char position within the source file nametype
- The DiagnosticTypearguments
- 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 nametype
- The DiagnosticTypearguments
- Arguments to be incorporated into the message
-
make
public static JSError make(java.lang.String sourceName, Node n, CheckLevel level, DiagnosticType type, java.lang.String... arguments)
Creates a JSError from a file and Node position.- Parameters:
sourceName
- The source file namen
- Determines the line and char position within the source file nametype
- The DiagnosticTypearguments
- Arguments to be incorporated into the message
-
getType
public DiagnosticType getType()
-
format
public java.lang.String format(CheckLevel level, MessageFormatter formatter)
Format a message at the given level.- Returns:
- the formatted message or
null
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getCharno
public int getCharno()
Get the character number.
-
getLineNumber
public int getLineNumber()
Get the line number. One-based.
-
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(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-