package bluej.compiler;

import java.io.Serializable;


| A compiler diagostic (error, warning, or other note) | | @author Davin McCall | public class Diagnostic implements Serializable{ public static int ERROR = 0; public static int WARNING = 1; public static int NOTE = 2; public static enum DiagnosticOrigin { JAVAC("javac"), STRIDE_EARLY("stride_early"), STRIDE_LATE("stride_late"), UNKNOWN("unknown"); private String serverOrigin; private DiagnosticOrigin(String serverOrigin) { this.serverOrigin = serverOrigin; } } private final int type; private String message; private final String fileName; private final long startLine; private final long startColumn; private final long endLine; private final long endColumn; private String xpath = null; private int xmlStart = -1; private int xmlEnd = -1; private final DiagnosticOrigin origin; private final int diagnosticIdentifier;
| Constructor for Diagnostic objects representing notes. | public Diagnostic(int type, String message) { this(type, message, null, -1, -1, -1, -1, DiagnosticOrigin.UNKNOWN, -1); }
| Constructor for error and warning diagnostics associated with | a particular position in the source code. | | @param type ERROR, WARNING or NOTE. | @param message The diagnostic message | @param fileName The file associated with the diagnostic (might be null). | @param startLine The line where the error/problem begins (less than 1 == unknown) | @param startColumn The column where the error/problem begins; must be valid if | {}code startLine} is greater than 0. Tab stops are every 8 spaces. | @param endLine The line where the error/problem ends; must be valid if | {}code startLine} is greater than 0 | @param endColumn The column where the error/problem ends; must be valid if | {}code startLine} is greater than 0. Tab stops are every 8 spaces. | @param origin The origin of the error message, e.g. "javac" or "stride_late". |* @param identifier The identifier of the diagnostic. Used to match up with later events * about the same diagnostic, such as shown_error_message events. */ public Diagnostic(int type, String message, String fileName, | |long startLine, long startColumn, long endLine, long endColumn, DiagnosticOrigin origin, int identifier) | |{ | |this.type = type; | |this.message = message; | |this.fileName = fileName; | |this.startLine = startLine; | |this.startColumn = startColumn; | |this.endLine = endLine; | |this.endColumn = endColumn; | |this.origin = origin; | |this.diagnosticIdentifier = identifier; | |} | |/** | Get the type of the diagnostic - ERROR, WARNING or NOTE. | public int getType() { return type; }
| Get the end column of the error. Return is valid only if {}code getStartLine()} returns | a valid line number (greater than 0). Caller should be prepared for this value to be slightly | inaccurate (it might extend past the actual end of the line). Tab stops are every | 8 spaces. | public long getEndColumn() { return endColumn; }
| Get the end line of the error. Return is valid only if {}code getStartLine()} returns | a valid line number (greater than 0). | public long getEndLine() { return endLine; }
| Set the diagnostic message (the message to be presented to the end user). | This can change because we try to make the message more helpful to the user, | e.g. by suggesting likely mis-spellings. | public void setMessage(String message) { this.message = message; }
| Get the diagnostic message which can be presented to the end user. | public String getMessage() { return message; }
| Get the starting column of the error/problem. Return is only valid if | {}code getStartLine()} returns a valid line (greater than 0). Tab stops | are every 8 spaces. | public long getStartColumn() { return startColumn; }
| Get the starting line of the error/problem, if known. Return is valid if | it is greater than 0. | public long getStartLine() { return startLine; }
| Get the filename associated with the error/problem. May be null. | public String getFileName() { return fileName; }
| Gets the internal identifier of the diagnostic (unique during this session) | public int getIdentifier() { return diagnosticIdentifier; } public String getXPath() { return xpath; }
| Sets the XPath, and start and end indexes within the item. | public void setXPath(String XPath, int xmlStart, int xmlEnd) { this.xpath = XPath; this.xmlStart = xmlStart; this.xmlEnd = xmlEnd; } public int getXmlStart() { return xmlStart; } public int getXmlEnd() { return xmlEnd; } public String getOrigin() { return origin.serverOrigin; } }
top, use, map, class Diagnostic

.   DiagnosticOrigin
.   Diagnostic
.   getType
.   getEndColumn
.   getEndLine
.   setMessage
.   getMessage
.   getStartColumn
.   getStartLine
.   getFileName
.   getIdentifier
.   getXPath
.   setXPath
.   getXmlStart
.   getXmlEnd
.   getOrigin




181 neLoCode + 48 LoComm