I want to implement a project using kotlin/multiplatform consisting of a backend on the jvm and a web-app in js. The structure would be like this:
root
|- webapp (kotlin/js using kotlin-react)
|- shared (kotlin/multiplatform for shared data)
|- server (kotlin/jvm using micronauts)
The data classes used by the applications belong in the shared project, but to use jpa I need jvm-annotations.
A solution would be to not use kotlin data-classes and inherit in the jvm. I also tried to implement the jpa annotations using the experimental @OptionalExpectation but that went nowhere since:
- they require non-annotation-types when used with
typealiaswhich can't be implemented with@OptionalExpectation. - let the multiplatform-annotations inherit from the multiplatform-annotations isn't possible since kotlin doesn't yet support annotation inheritance.
Should I refrain from using the data-class feature and use inheritance or is there a more elegant way?