Skip to content

feat: extensible type discovery#68

Merged
MessiasLima merged 4 commits into
mainfrom
36-add-serviceloader-based-resolver-discovery-for-third-party-packages
Jun 16, 2026
Merged

feat: extensible type discovery#68
MessiasLima merged 4 commits into
mainfrom
36-add-serviceloader-based-resolver-discovery-for-third-party-packages

Conversation

@MessiasLima

@MessiasLima MessiasLima commented Jun 16, 2026

Copy link
Copy Markdown
Owner

Summary

Introduce a ServiceLoader-based extensibility mechanism that allows third-party libraries to contribute custom TypeResolvers without requiring user configuration.

Key changes:

  • TypeResolverProvider SPI — New interface in dev.appoutlet.some.core with a createResolvers(strategyProvider, random) method. Implementations are discovered via java.util.ServiceLoader at runtime.
  • DefaultStrategyProvider — Extracted from SomeConfig into a standalone StrategyProvider implementation backed by a strategy map, used by resolvers and the discovery pipeline.
  • Refactored resolver constructors — All resolvers that previously accepted individual strategy parameters (e.g. NullableResolver(nullableStrategy), ListResolver(collectionStrategy)) now accept a StrategyProvider instead, fetching strategies via the idiomatic get<T>() extension.
  • Resolver chain ordering — Discovered resolvers are inserted between NullableResolver and built-in resolvers, giving third-party types precedence over built-in ones while keeping user type factories highest and ClassResolver lowest.
  • Graceful failure — Discovery errors and misbehaving providers are silently swallowed so the built-in chain always remains functional.
  • autoservice-ir plugin — Added to generate META-INF/services entries from @AutoService annotations at compile time, used in test fixtures.
  • Test coverage — Added ServiceLoaderDiscoveryTest, DefaultStrategyProviderTest, and test-only providers (TestTypeResolverProvider, FailingTypeResolverProvider) to verify discovery, precedence, and failure resilience. All existing resolver tests updated for the new StrategyProvider-based constructors.

Checklist

  • Tests were added or updated when needed
  • Documentation was updated when needed

@MessiasLima MessiasLima linked an issue Jun 16, 2026 that may be closed by this pull request
6 tasks
@github-project-automation github-project-automation Bot moved this to Ready in Some Jun 16, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces third-party resolver discovery via ServiceLoader and refactors strategy resolution by introducing DefaultStrategyProvider and passing StrategyProvider to various resolvers. Feedback focuses on improving robustness and encapsulation: specifically, making a defensive copy of _strategies in the builder, robustly iterating over ServiceLoader to handle individual provider failures, removing a redundant DefaultStrategyProvider instantiation, and restricting the visibility of strategyProvider and random properties to private in several resolvers.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/main/kotlin/dev/appoutlet/some/config/SomeConfigBuilder.kt Outdated
Comment thread src/main/kotlin/dev/appoutlet/some/config/SomeConfig.kt Outdated
Comment thread src/main/kotlin/dev/appoutlet/some/config/SomeConfig.kt Outdated
Comment thread src/main/kotlin/dev/appoutlet/some/resolver/CustomTypeFactoryResolver.kt Outdated
Comment thread src/main/kotlin/dev/appoutlet/some/resolver/ClassResolver.kt Outdated
Comment thread src/main/kotlin/dev/appoutlet/some/resolver/ListResolver.kt Outdated
@MessiasLima MessiasLima changed the title extensible type discovery feat: extensible type discovery Jun 16, 2026
@MessiasLima MessiasLima force-pushed the 36-add-serviceloader-based-resolver-discovery-for-third-party-packages branch from c465415 to 70de7f4 Compare June 16, 2026 23:31
@MessiasLima MessiasLima merged commit 660e80d into main Jun 16, 2026
1 check passed
@MessiasLima MessiasLima deleted the 36-add-serviceloader-based-resolver-discovery-for-third-party-packages branch June 16, 2026 23:33
@github-project-automation github-project-automation Bot moved this from Ready to Done in Some Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Add ServiceLoader-based resolver discovery for third-party packages

1 participant