Skip to content

Remove dead ValidatorGenerator/ApplyValidator (unreachable, superseded by ValidatorRegistry) #319

Description

@alexander-yevsyukov

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

  1. Verify the classes are genuinely unused — check reflection / ServiceLoader
    / DI wiring too, not just direct constructor calls.
  2. If confirmed dead, remove ValidatorGenerator.kt along with any now-unused
    imports/helpers it pulled in.
  3. 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.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

Status
🏗 In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions