Skip to content

feat(processor): add an option to configure validation strictness #39

Description

@LMLiam

Problem

The processor's validations are hard‑coded to Diagnostic.Kind.ERROR (fail the build). There is no way for a consumer to relax a check — e.g. to allow a class that implements a contract without @ServiceProvider during a migration, or to treat "missing provider" as a warning. A configurable strictness option would make adoption smoother.

Evidence

  • Missing‑@ServiceProvider is always an ERROR (ServiceSchemeProcessor.kt:125-129).
  • Non‑@ServiceContract target is always an ERROR (ServiceSchemeProcessor.kt:148-152).
  • The @SupportedOptions(...) annotation is currently misused for incrementality (see the incremental‑processing issue) — there is genuinely no processor option wired up to read via processingEnv.options.

Proposed implementation

  • Introduce real processor options (read from processingEnv.options), e.g. spiTooling.strict (default true) and/or per‑check toggles, and declare them in @SupportedOptions (its actual purpose).
  • When relaxed, downgrade the corresponding diagnostics to WARNING.
  • Wire the option through kapt (kapt { arguments { arg(...) } }) / annotationProcessorArgs / KSP options and document it.

Acceptance criteria

  • A consumer can downgrade the missing‑provider / non‑contract‑target checks to warnings via a documented processor option.
  • Default behavior (strict) is unchanged; tests cover both strict and relaxed modes.

✅ Triage decision (2026-06-06)

Approved. Add consumer-tunable strictness via real processor options (read from processingEnv.options, declared in @SupportedOptions — its correct use; see #14). Default stays strict; allow downgrading the missing-provider / non-contract-target diagnostics to warnings. Wire the option through KSP options / annotationProcessorArgs and document it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:processorAnnotation processor: discovery, validation, META-INF/services generationstatus:readyTriaged and ready for worktype:featureFeature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions