Class CollectDiagnostics
java.lang.Object
ca.mcscert.jpipe.compiler.model.Transformation<Unit, DiagnosticSnapshot>
ca.mcscert.jpipe.compiler.steps.transformations.CollectDiagnostics
Gathers everything a diagnostic report shows into a single
DiagnosticSnapshot.
This is the one place that walks the Unit for reporting purposes. The
renderers downstream (DiagnosticReport for text,
JsonDiagnosticReport for JSON) consume the snapshot and never touch
the model, which is what guarantees the two formats describe the same thing.
-
Nested Class Summary
Nested classes/interfaces inherited from class Transformation
Transformation.Step<I,O> -
Field Summary
Fields inherited from class Transformation
logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected DiagnosticSnapshotrun(Unit input, CompilationContext ctx) Business logic of this step.snapshot(Unit input, CompilationContext ctx) Describes what a compilation produced and reported.
-
Constructor Details
-
CollectDiagnostics
public CollectDiagnostics()
-
-
Method Details
-
run
Description copied from class:TransformationBusiness logic of this step. Must not returnnull; may throw any exception. Usectxto report non-fatal diagnostics or inspect previously accumulated errors.- Specified by:
runin classTransformation<Unit, DiagnosticSnapshot>- Parameters:
input- the value produced by the previous step.ctx- compilation context carrying the source path and diagnostic bag.- Returns:
- the transformed value — never
null.
-
snapshot
Describes what a compilation produced and reported.Callable directly, and not only as a pipeline step, so that a compilation which aborted on a fatal diagnostic can still be reported on — pass an empty
Unitfor the models it never got to build.- Parameters:
input- the compiled unit; empty, nevernull, when the pipeline aborted.ctx- the context carrying diagnostics, statistics and actions.- Returns:
- the render-agnostic report payload.
-