https://kotlinlang.org logo
#arrow
Title
# arrow
u

Ulrich Schuster

03/04/2024, 3:30 PM
I just ran into the same KAPT error on a seemingly unrelated piece of code. Looking at the actual class, it turns out that the Java code for the `NonEmptySet<T>`` seemed to be the problem. An explicit type annotation for the set made the error disappear. No Idea if this is in any way helpful for your problem, though.
🙌 1
m

Marcus Ilgner

03/04/2024, 3:32 PM
that is a helpful hint! Unfortunately in this case, having a type annotation was the whole point so I wouldn't have to implement this method separately for each type 😬 But I'll give it a try to further narrow it down 👍
Update: changing
NonEmptySet<T>
to a specific
NonEmptySet<DataResource>
didn't fix the issue. Looks like I might have to replace
NonEmptySet
with a regular
Set
or
List
for now... 🤔 Update 2: when replacing ``NonEmptySet` with
Set
, it compiles fine again.
a

Alejandro Serrano.Mena

03/04/2024, 3:50 PM
this is a very weird error we find from time to time and we don't really know how to solve... it seems to be related to the difference in name between the declaration of a type and extension functions, but we've never been able to understand the whole thing
😬 1
m

Marcus Ilgner

03/14/2024, 12:56 PM
I just ran into a related issue: when trying to use mockk to mock a class that uses
NonEmptySet
, it became unable to properly register the mock. Then we changed the signature to use a regular
Set
and everything worked again.
s

simon.vergauwen

03/14/2024, 2:02 PM
That sounds like a bug between
@JvmInline value class
and Mockk 🤔 but can't find to find an issue ticket for it. Does Mockk work with inline classes?
i

ianbrandt

03/14/2024, 3:18 PM
I'm not sure whether these cover your issue, but I know there's at least two open issues for the latest version of MockK regarding value classes: • https://github.com/mockk/mockk/issues/1232https://github.com/mockk/mockk/issues/1225 The latter has a merged PR awaiting release.
1
☝️ 1