feat: extensible type discovery#68
Conversation
There was a problem hiding this comment.
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.
c465415 to
70de7f4
Compare
Summary
Introduce a ServiceLoader-based extensibility mechanism that allows third-party libraries to contribute custom
TypeResolvers without requiring user configuration.Key changes:
TypeResolverProviderSPI — New interface indev.appoutlet.some.corewith acreateResolvers(strategyProvider, random)method. Implementations are discovered viajava.util.ServiceLoaderat runtime.DefaultStrategyProvider— Extracted fromSomeConfiginto a standaloneStrategyProviderimplementation backed by a strategy map, used by resolvers and the discovery pipeline.NullableResolver(nullableStrategy),ListResolver(collectionStrategy)) now accept aStrategyProviderinstead, fetching strategies via the idiomaticget<T>()extension.NullableResolverand built-in resolvers, giving third-party types precedence over built-in ones while keeping user type factories highest andClassResolverlowest.autoservice-irplugin — Added to generateMETA-INF/servicesentries from@AutoServiceannotations at compile time, used in test fixtures.ServiceLoaderDiscoveryTest,DefaultStrategyProviderTest, and test-only providers (TestTypeResolverProvider,FailingTypeResolverProvider) to verify discovery, precedence, and failure resilience. All existing resolver tests updated for the newStrategyProvider-based constructors.Checklist