Paulo Cereda
08/20/2026, 9:25 PMkotlin-reflect a compileOnly dependency instead of api, so the published artifact no longer propagates it automatically. Downstream consumers who want data class marshall/unmarshall must add kotlin-reflect explicitly; those who don't are unaffected. The first call to a data class operation should throw a custom exception with a clear message if kotlin-reflect is absent. So far, so good.
Here comes the tricky part: the testing situation. Normal test tasks run with kotlin-reflect present (all tests pass). However, as it is now, I cannot have tests that would catch the exception when this dependency is missing. I have three scenarios: (a) tests that need kotlin-reflect present in the classpath to succeed, (b) tests that need kotlin-reflect absent from the classpath to succeed, and (c) tests that have nothing to do with data classes, so they work regardless.
Does anyone have suggestions on how I could tackle this? Thanks! kodee happyYoussef Shoaib [MOD]
08/20/2026, 9:45 PMjvm-test-suite. Simply create a new test suite, associateWith(sourceSets.test.get()) on its kotlin source set, and add kotlin-reflect to it.
Alternatively, you can do some runtime magic to make a class loader that throws ClassNotFoundException for classes in kotlin.reflect.full.ephemient
08/21/2026, 12:50 AMephemient
08/21/2026, 12:52 AMYoussef Shoaib [MOD]
08/21/2026, 1:01 AMtestRuns would work well enough btw
I meant making a custom classloader that overrides loadClass and throws. It's kind of a hack, but it's also just the API surface that's available lolPaulo Cereda
08/22/2026, 9:35 AM