Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Internal - Specialize ConfigParser for declarative configuration parser SPI - #558

Merged
cleverchuk merged 1 commit into
mainfrom
cc/NH-132095
Aug 6, 2026
Merged

Internal - Specialize ConfigParser for declarative configuration parser SPI#558
cleverchuk merged 1 commit into
mainfrom
cc/NH-132095

Conversation

@cleverchuk

Copy link
Copy Markdown
Contributor

TL;DR

Replaces the raw ConfigParser SPI registration used by declarative YAML
config parsers with a dedicated, properly-typed marker interface,
DeclarativeConfigPropertyParser. This removes two @SuppressWarnings
workarounds that existed solely because the SPI type was raw, and allows
dropping the module-wide -Xlint:-processing suppression from the Java
conventions plugin.

Background

ConfigParser<T, R> is a generic conversion interface used across the
config system. The declarative YAML parsers all specialize it to
ConfigParser<DeclarativeConfigProperties, R> for various R, but were
registered for discovery via @AutoService(ConfigParser.class) — i.e.
against the raw generic type rather than a concrete parameterization.

That raw registration had two costs:

  • Every implementer needed @SuppressWarnings("rawtypes") to compile
    cleanly under -Xlint:all -Werror.
  • The consumer, which loads implementers via
    ServiceLoader.load(ConfigParser.class, ...), got back raw
    ConfigParser instances and had to unchecked-cast each one to
    ConfigParser<DeclarativeConfigProperties, Object> before it could be
    stored in its typed registry map.
  • Separately, the annotation-ownership warnings this raw usage produced
    were being blanket-suppressed project-wide via -Xlint:-processing in
    the shared Java conventions plugin, which also silenced any other
    unrelated processing warnings from any module using that convention.

Change

Introduces DeclarativeConfigPropertyParser, an interface that fixes the
generic parameters: ConfigParser<DeclarativeConfigProperties, Object>.
All 11 YAML declarative config parsers (profiling settings, logging,
proxy, SQL query max length, SQL tag databases, stacktrace filters,
tracing mode, transaction naming schemes, transaction settings, trigger
trace, URL sample rate) now implement this interface directly instead of
ConfigParser<DeclarativeConfigProperties, R>, and register via
@AutoService(DeclarativeConfigPropertyParser.class) instead of
@AutoService(ConfigParser.class).

The consumer's ServiceLoader.load(...) call is updated to load
DeclarativeConfigPropertyParser directly, so the loaded instances are
already correctly typed for the registry map — no cast needed.

With the raw-type usage gone, the underlying annotation-ownership warning
no longer fires, so -Xlint:-processing is removed from the shared Java
conventions plugin — tightening lint enforcement for every module built
with that plugin, not just this one.

Why this approach

Rather than suppressing the warnings at each of the 11 call sites (or
leaving the project-wide -Xlint escape hatch in place), narrowing the
SPI contract to a single, correctly-typed interface eliminates the root
cause: the type system now reflects that every implementer of this SPI is
a DeclarativeConfigProperties-to-Object parser, so no raw type or
unchecked cast is ever necessary to satisfy that contract.

Verification

  • Full project compileJava passes under -Werror, confirming the
    -Xlint:-processing removal doesn't surface new lint failures anywhere
    else in the build.
  • All existing parser unit tests and the declarative config parser test
    suite pass unchanged.
  • Confirmed via generated META-INF/services output that all 11 parsers
    are registered under the new SPI type, with none left registered under
    the old one.

No functional or behavioral change — this is purely an SPI-typing and
lint-cleanliness improvement.

Test services data

  1. e-1712644058766987264
  2. e-1712643928659124224
  3. e-1742334541200846848
  4. e-1777406072376840192

Copilot AI review requested due to automatic review settings August 4, 2026 21:46
@cleverchuk
cleverchuk requested review from a team as code owners August 4, 2026 21:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR tightens the declarative YAML configuration parser SPI by introducing a dedicated, properly typed service interface (DeclarativeConfigPropertyParser) and migrating all declarative YAML parsers and their consumer to use it, eliminating prior raw-type/unchecked-cast workarounds and enabling removal of a global -Xlint:-processing suppression in the shared Java conventions plugin.

Changes:

  • Add DeclarativeConfigPropertyParser as a specialized SPI (ConfigParser<DeclarativeConfigProperties, Object>) for declarative configuration property parsers.
  • Update all declarative YAML parser implementations to register via @AutoService(DeclarativeConfigPropertyParser.class) and implement the new interface.
  • Update the ServiceLoader consumer to load the new SPI directly, and remove -Xlint:-processing from shared Java compilation conventions.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.

Show a summary per file
File Description
libs/shared/src/main/java/com/solarwinds/opentelemetry/extensions/config/parser/yaml/DeclarativeConfigPropertyParser.java Introduces the dedicated, correctly-typed SPI for declarative config property parsing.
libs/shared/src/main/java/com/solarwinds/opentelemetry/extensions/config/parser/yaml/DeclarativeConfigParser.java Loads DeclarativeConfigPropertyParser via ServiceLoader and removes the prior unchecked cast path.
libs/shared/src/main/java/com/solarwinds/opentelemetry/extensions/config/parser/yaml/UrlSampleRateConfigParser.java Migrates SPI registration and implementation to the new declarative parser SPI.
libs/shared/src/main/java/com/solarwinds/opentelemetry/extensions/config/parser/yaml/TriggerTraceParser.java Migrates SPI registration and implementation to the new declarative parser SPI.
libs/shared/src/main/java/com/solarwinds/opentelemetry/extensions/config/parser/yaml/TransactionSettingsConfigParser.java Migrates SPI registration and implementation to the new declarative parser SPI.
libs/shared/src/main/java/com/solarwinds/opentelemetry/extensions/config/parser/yaml/TransactionNamingSchemesParser.java Migrates SPI registration and implementation to the new declarative parser SPI.
libs/shared/src/main/java/com/solarwinds/opentelemetry/extensions/config/parser/yaml/TracingModeParser.java Migrates SPI registration and implementation to the new declarative parser SPI.
libs/shared/src/main/java/com/solarwinds/opentelemetry/extensions/config/parser/yaml/StacktraceFilterParser.java Migrates SPI registration and implementation to the new declarative parser SPI.
libs/shared/src/main/java/com/solarwinds/opentelemetry/extensions/config/parser/yaml/SqlTagDatabasesParser.java Migrates SPI registration and implementation to the new declarative parser SPI.
libs/shared/src/main/java/com/solarwinds/opentelemetry/extensions/config/parser/yaml/SqlQueryMaxLengthParser.java Migrates SPI registration and implementation to the new declarative parser SPI.
libs/shared/src/main/java/com/solarwinds/opentelemetry/extensions/config/parser/yaml/ProxyParser.java Migrates SPI registration and implementation to the new declarative parser SPI.
libs/shared/src/main/java/com/solarwinds/opentelemetry/extensions/config/parser/yaml/LogSettingParser.java Migrates SPI registration and implementation to the new declarative parser SPI.
custom/src/main/java/com/solarwinds/opentelemetry/extensions/config/parser/yaml/ProfilingSettingsParser.java Migrates SPI registration and implementation (in custom) to the new declarative parser SPI.
buildSrc/src/main/kotlin/solarwinds.java-conventions.gradle.kts Removes -Xlint:-processing now that the motivating raw-type processing warnings are eliminated.

@cheempz cheempz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@cleverchuk
cleverchuk merged commit 85f1807 into main Aug 6, 2026
18 checks passed
@cleverchuk
cleverchuk deleted the cc/NH-132095 branch August 6, 2026 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants