Summary
ValidatorGenerator and its nested ApplyValidator
(java/src/main/kotlin/io/spine/tools/validation/java/generate/ValidatorGenerator.kt,
~49 lines) appear to be dead code — never instantiated anywhere in the
repository.
Found while raising test coverage in #318: the class shows as 100% uncovered
because it is unreachable, not because it lacks tests.
Evidence
- A repo-wide search for
ValidatorGenerator( finds no instantiation — only
self-references within its own file.
- The nested-message validation it was designed to generate is instead handled
at runtime by io.spine.validation.ValidatorRegistry.validate(this),
invoked from ValidationCodeInjector.validateMethodBody
(java/src/main/kotlin/io/spine/tools/validation/java/generate/ValidationCodeInjector.kt,
~line 153). So ValidatorGenerator/ApplyValidator is a superseded
compile-time approach.
Proposed action
- Verify the classes are genuinely unused — check reflection /
ServiceLoader
/ DI wiring too, not just direct constructor calls.
- If confirmed dead, remove
ValidatorGenerator.kt along with any now-unused
imports/helpers it pulled in.
- Build
:java and run the validation test suites to confirm nothing breaks.
This is a production-code change, so it is intentionally not part of the
coverage-only PR #318 — it needs its own review.
Filed as a follow-up from #318.
Summary
ValidatorGeneratorand its nestedApplyValidator(
java/src/main/kotlin/io/spine/tools/validation/java/generate/ValidatorGenerator.kt,~49 lines) appear to be dead code — never instantiated anywhere in the
repository.
Found while raising test coverage in #318: the class shows as 100% uncovered
because it is unreachable, not because it lacks tests.
Evidence
ValidatorGenerator(finds no instantiation — onlyself-references within its own file.
at runtime by
io.spine.validation.ValidatorRegistry.validate(this),invoked from
ValidationCodeInjector.validateMethodBody(
java/src/main/kotlin/io/spine/tools/validation/java/generate/ValidationCodeInjector.kt,~line 153). So
ValidatorGenerator/ApplyValidatoris a supersededcompile-time approach.
Proposed action
ServiceLoader/ DI wiring too, not just direct constructor calls.
ValidatorGenerator.ktalong with any now-unusedimports/helpers it pulled in.
:javaand run the validation test suites to confirm nothing breaks.This is a production-code change, so it is intentionally not part of the
coverage-only PR #318 — it needs its own review.
Filed as a follow-up from #318.