You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor DataClassResolver into ClassResolver so it can resolve any class with a constructor — not just data classes with a primary constructor. Currently, the resolver fails when a class lacks a primary constructor even if it has secondary constructors that could be used instead.
Scope and constraints
In scope: Renaming DataClassResolver to ClassResolver, iterating over all constructors, updating SomeConfig, AGENTS.md, imports, KDocs, and adding dedicated unit tests
Out of scope: Changing how constructor parameters are resolved (property factories, default values, generic mapping remain unchanged)
ClassResolver should remain the last resolver in the chain
Must preserve backward-compatible behavior for classes that already work today (primary constructor success path)
References
Current implementation: src/main/kotlin/dev/appoutlet/some/resolver/DataClassResolver.kt
New unit tests for ClassResolver cover: (a) resolution via primary constructor, (b) resolution via secondary constructor when primary is absent, (c) fallback to secondary constructor when primary fails, (d) exception when all constructors fail, (e) canResolve rejects non-class types, (f) resolution of class with empty constructor
Investigate: Can ClassResolver instantiate classes with only private constructors? Document the behavior (success via reflection, failure with specific exception, or canResolve returns false) and add a test that asserts the determined behavior
Description
Refactor
DataClassResolverintoClassResolverso it can resolve any class with a constructor — not just data classes with a primary constructor. Currently, the resolver fails when a class lacks a primary constructor even if it has secondary constructors that could be used instead.Scope and constraints
DataClassResolvertoClassResolver, iterating over all constructors, updatingSomeConfig,AGENTS.md, imports, KDocs, and adding dedicated unit testsClassResolvershould remain the last resolver in the chainReferences
src/main/kotlin/dev/appoutlet/some/resolver/DataClassResolver.ktsrc/main/kotlin/dev/appoutlet/some/config/SomeConfig.kt(line 134)src/test/kotlin/dev/appoutlet/some/integration/Scope
DataClassResolver.kttoClassResolver.ktDataClassResolvertoClassResolverSomeConfig.ktAGENTS.mdregistration-order listDataClassResolverAcceptance criteria
ClassResolver.canResolve()returnstruefor classes with at least one accessible constructor (primary or secondary)ClassResolver.canResolve()returnsfalsefor types without any constructors (abstract classes, interfaces, etc.)ClassResolver.resolve()iterates over all declared constructors in order, attempting to generate arguments and callcallBy()for eachSomeInstantiationExceptionis thrown with the class name and a summary of failuresDataClassIntegrationTest,CircularReferenceIntegrationTest,DefaultValueStrategyIntegrationTest,PropertyFactoryIntegrationTest,GenericsIntegrationTest) continue to passClassResolvercover: (a) resolution via primary constructor, (b) resolution via secondary constructor when primary is absent, (c) fallback to secondary constructor when primary fails, (d) exception when all constructors fail, (e)canResolverejects non-class types, (f) resolution of class with empty constructorClassResolverinstantiate classes with only private constructors? Document the behavior (success via reflection, failure with specific exception, orcanResolvereturnsfalse) and add a test that asserts the determined behavior./gradlew testpasses