lingua-franca 0.10.1
Lingua Franca code generator
Loading...
Searching...
No Matches
org.lflang.validation.ValidatorMessageReporter Class Reference

This class translates messages reported via the ErrorReporrter interface to the interface of a given ValidationMessageAcceptor. More...

Inherits org.lflang.MessageReporterBase.

Public Member Functions

default Stage2 at (Path file)
 Position the message in the file (non-null), at an unknown line.
default Stage2 at (Path file, int line)
 Position the message in the file (non-null), on the given line.
default Stage2 at (Path file, Position pos)
 Position the message in the file, using a position object.
Stage2 at (EObject node)
 Position the message on the given node (must be non-null).
Stage2 at (EObject node, EStructuralFeature feature)
 Position the message on the given node and structural feature (both must be non-null).
Stage2 at (Path file, Range range)
 Position the message on the given range in a given file (both must be non-null).
default Stage2 atNullableLine (Path file, Integer line)
 Position the message in the given file.
void clearHistory ()
 Clear error history, if exists.
boolean getErrorsOccurred ()
 Check if errors where reported.
Stage2 nowhere ()
 Specify that the message has no relevant position, ie it does not belong to a particular file.
 ValidatorMessageReporter (ValidationMessageAcceptor acceptor, BaseLFValidator.ValidatorStateAccess stateAccess)

Protected Member Functions

void report (Path path, Range range, DiagnosticSeverity severity, String message)
 Report the given message as an error on the current object.
void reportOnNode (EObject node, DiagnosticSeverity severity, String message)
 Implementation of the reporting methods that use a node as position.
void reportOnNode (EObject node, EStructuralFeature feature, DiagnosticSeverity severity, String message)
void reportWithoutPosition (DiagnosticSeverity severity, String message)
 Implementation of the reporting methods for nowhere().
Stage2 wrap (Stage2 e)
 A wrapper that takes care of setting the error flag if needed.

Detailed Description

This class translates messages reported via the ErrorReporrter interface to the interface of a given ValidationMessageAcceptor.

Effectively this allows to report errors via the ErrorReporter interface during validator checks, while having the validator still track all the reported warnings and messages. This is required for some functionality, like the construction of an instance graph in LFValidator.checkModel(). Since the instance graph is also used in other components, it does not report directly to the validator, but uses our custom ErrorReporter interface that we use during code generation. This class bridges the gap between the ErrorReporter interface and the messages that the validator expects.

Author
Christian Menard

Constructor & Destructor Documentation

◆ ValidatorMessageReporter()

org.lflang.validation.ValidatorMessageReporter.ValidatorMessageReporter ( ValidationMessageAcceptor acceptor,
BaseLFValidator.ValidatorStateAccess stateAccess )

Member Function Documentation

◆ at() [1/6]

default Stage2 org.lflang.MessageReporter.at ( Path file)
inherited

Position the message in the file (non-null), at an unknown line.

Implementations usually will report on the first line of the file.

◆ at() [2/6]

default Stage2 org.lflang.MessageReporter.at ( Path file,
int line )
inherited

Position the message in the file (non-null), on the given line.

Implemented in org.lflang.federated.generator.LineAdjustingMessageReporter, and org.lflang.generator.LanguageServerMessageReporter.

◆ at() [3/6]

default Stage2 org.lflang.MessageReporter.at ( Path file,
Position pos )
inherited

Position the message in the file, using a position object.

◆ at() [4/6]

Stage2 org.lflang.MessageReporterBase.at ( EObject node)
inherited

Position the message on the given node (must be non-null).

Implements org.lflang.MessageReporter.

◆ at() [5/6]

Stage2 org.lflang.MessageReporterBase.at ( EObject node,
EStructuralFeature feature )
inherited

Position the message on the given node and structural feature (both must be non-null).

Implements org.lflang.MessageReporter.

◆ at() [6/6]

Stage2 org.lflang.MessageReporterBase.at ( Path file,
Range range )
inherited

Position the message on the given range in a given file (both must be non-null).

Implements org.lflang.MessageReporter.

◆ atNullableLine()

default Stage2 org.lflang.MessageReporter.atNullableLine ( Path file,
Integer line )
inherited

Position the message in the given file.

The line may be null. This is a convenience wrapper that calls either at(Path, int) or at(Path).

◆ clearHistory()

void org.lflang.MessageReporterBase.clearHistory ( )
inherited

Clear error history, if exists.

This is usually only the case for error markers in Epoch (Eclipse).

Implements org.lflang.MessageReporter.

◆ getErrorsOccurred()

boolean org.lflang.MessageReporterBase.getErrorsOccurred ( )
inherited

◆ nowhere()

Stage2 org.lflang.MessageReporterBase.nowhere ( )
inherited

Specify that the message has no relevant position, ie it does not belong to a particular file.

Implements org.lflang.MessageReporter.

◆ report()

void org.lflang.validation.ValidatorMessageReporter.report ( Path path,
Range range,
DiagnosticSeverity severity,
String message )
protected

Report the given message as an error on the current object.

Unfortunately, there is no way to provide a path and a line number to the ValidationMessageAcceptor as messages can only be reported directly as EObjects. While it is not an ideal solution, this method composes a messages indicating the location of the error and reports this on the object currently under validation. This way, the error message is not lost, but it is not necessarily reported precisely at the location of the actual error.

Reimplemented from org.lflang.MessageReporterBase.

◆ reportOnNode() [1/2]

void org.lflang.MessageReporterBase.reportOnNode ( EObject node,
DiagnosticSeverity severity,
String message )
protectedinherited

Implementation of the reporting methods that use a node as position.

◆ reportOnNode() [2/2]

void org.lflang.validation.ValidatorMessageReporter.reportOnNode ( EObject node,
EStructuralFeature feature,
DiagnosticSeverity severity,
String message )
protected

Reimplemented from org.lflang.MessageReporterBase.

◆ reportWithoutPosition()

void org.lflang.validation.ValidatorMessageReporter.reportWithoutPosition ( DiagnosticSeverity severity,
String message )
protected

Implementation of the reporting methods for nowhere().

Reimplemented from org.lflang.MessageReporterBase.

◆ wrap()

Stage2 org.lflang.MessageReporterBase.wrap ( Stage2 e)
protectedinherited

A wrapper that takes care of setting the error flag if needed.


The documentation for this class was generated from the following file:
  • /Users/runner/work/lingua-franca/lingua-franca/core/src/main/java/org/lflang/validation/ValidatorMessageReporter.java