Has anyone considered a compiler plugin for mockin...
# compiler
d
Has anyone considered a compiler plugin for mocking?
s
Yes, but a big problem there is that you cannot alter bytecode of all dependencies, so mocking of final classes is quite annoying to implement
And people love to mock their final classes 😅
r
Could you pass it through something like the all-open plugin first?
🤔 1
d
Ah, I mean like mocking interfaces and abstract classes. I feel, if one has to mock final classes then they probably need a redesign.
And people love to mock their final classes 😅
Very unfortunate
s
I was thinking about it for some time, but just figured it isn't worth it (use stubs instead ;)) It is not that hard to integrate with mockk or similar frameworks though, if you really wanted to
r
Say what you will about mocking is bad, but there's still plenty of people using mockk on the JVM side who would love to have a compiler plugin to make it easier to migrate their tests to native.
s
Yeah, I am just saying that I didn't want to invest in that myself, but happy to help if someone wants to take on this
It isn't /very/ hard to create mocks for interfaces and abstract methods at compile time The only limitation I remember about is resolution of generics if you want to support something like
mockk<T>
I saw used quite often
d
I'm interested in building this but don't want to do it by myself. Also don't know where to start with regards to project structure.
The generic one should be doable with some substitution in the plug in.