# Class CodeDiagnostic

java.lang.Object
com.codename1.ui.CodeDiagnostic

public class CodeDiagnostic extends Object

A diagnostic (error / warning / information) shown in a `CodeEditor` as a squiggly underline over a source range, a marker in the line-number gutter and a tooltip carrying the message.

Positions are 1-based: line `1` is the first line and column `1` is the first character of a line, matching the convention used by most compilers and language servers.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `ERROR`
  Severity for a problem that should block / is an error.
  `static final String`
  `INFO`
  Severity for purely informational hints.
  `static final String`
  `WARNING`
  Severity for a non-blocking warning.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CodeDiagnostic(int line, int column, int endLine, int endColumn, String message)`
  Creates a diagnostic spanning an explicit range.
  `CodeDiagnostic(int line, int column, String message)`
  Creates a single-position diagnostic that underlines from the given column to the end of the token / line.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `getColumn()`
  The 1-based start column.
  `int`
  `getEndColumn()`
  The 1-based end column (exclusive).
  `int`
  `getEndLine()`
  The 1-based end line.
  `int`
  `getLine()`
  The 1-based start line.
  `String`
  `getMessage()`
  The message shown in the tooltip.
  `String`
  `getSeverity()`
  The severity, one of `#ERROR`, `#WARNING` or `#INFO`.
  `CodeDiagnostic`
  `setSeverity(String severity)`
  Sets the severity.

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### ERROR

    public static final String ERROR
    Severity for a problem that should block / is an error.
    See Also:
      - Constant Field Values

  - ### WARNING

    public static final String WARNING
    Severity for a non-blocking warning.
    See Also:
      - Constant Field Values

  - ### INFO

    public static final String INFO
    Severity for purely informational hints.
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### CodeDiagnostic

    public CodeDiagnostic(int line, int column, String message)

    Creates a single-position diagnostic that underlines from the given column to the end of the token / line.

    ###### Parameters

    - `line`: the 1-based line

    - `column`: the 1-based start column

    - `message`: the human readable message

  - ### CodeDiagnostic

    public CodeDiagnostic(int line, int column, int endLine, int endColumn, String message)

    Creates a diagnostic spanning an explicit range.

    ###### Parameters

    - `line`: the 1-based start line

    - `column`: the 1-based start column

    - `endLine`: the 1-based end line

    - `endColumn`: the 1-based end column (exclusive)

    - `message`: the human readable message

- ## Method Details

  - ### getLine

    public int getLine()
    The 1-based start line.

  - ### getColumn

    public int getColumn()
    The 1-based start column.

  - ### getEndLine

    public int getEndLine()
    The 1-based end line.

  - ### getEndColumn

    public int getEndColumn()
    The 1-based end column (exclusive).

  - ### getSeverity

    public String getSeverity()
    The severity, one of `#ERROR`, `#WARNING` or `#INFO`.

  - ### setSeverity

    public CodeDiagnostic setSeverity(String severity)

    Sets the severity. Returns this for chaining.

    ###### Parameters

    - `severity`: one of `#ERROR`, `#WARNING`, `#INFO`

  - ### getMessage

    public String getMessage()
    The message shown in the tooltip.