Class Diagnostics
java.lang.Object
be.imgn.gaia.processing.Diagnostics
Reports errors, warnings and notes at a precise place in the source: an element, one of its annotations, or one
attribute of that annotation.
diagnostics.on(method).error("must be public");
diagnostics.on(type).annotation("com.example.Mapper").attribute("target").error("must be an interface");
It counts the errors it reports, so a step can report every problem it finds, then skip generating code if there was any.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionfinal classA report about an element, possibly narrowed to one of its annotations and one attribute of it. -
Method Summary
Modifier and TypeMethodDescriptionvoiderror(ProcessingException exception) Reports the error an exception carries, with its message, at the place it names: its element, one of its annotations, or one attribute of that annotation.voidReports an error about no element in particular, such as an invalid option.intReturns the number of errors reported so far through these diagnostics.booleanReturns whether any error was reported through these diagnostics.voidReports a note about no element in particular.Starts a report about an element.voidReports a warning about no element in particular.
-
Method Details
-
on
Starts a report about an element.- Parameters:
element- the element the report is about- Returns:
- the report, to narrow to an annotation and then report
-
error
Reports an error about no element in particular, such as an invalid option. It makes the compilation fail.- Parameters:
message- the message
-
error
Reports the error an exception carries, with its message, at the place it names: its element, one of its annotations, or one attribute of that annotation. It makes the compilation fail. The stack trace of the exception is not reported.try { validate(element); } catch (ProcessingException e) { diagnostics.error(e); }- Parameters:
exception- the exception
-
warning
Reports a warning about no element in particular.- Parameters:
message- the message
-
note
Reports a note about no element in particular.- Parameters:
message- the message
-
errorCount
public int errorCount()Returns the number of errors reported so far through these diagnostics.- Returns:
- the number of errors
-
hasErrors
public boolean hasErrors()Returns whether any error was reported through these diagnostics.- Returns:
trueif an error was reported
-