kotlinx.serialization icon indicating copy to clipboard operation
kotlinx.serialization copied to clipboard

java.lang.ClassFormatError: Too many arguments in method signature for `Serializable` data class

Open AmrNashat-Adyen opened this issue 6 months ago • 1 comments

Recently, in Adyen we ran into this issue of having too many arguments in method signature when constructing a serializable data class.

And we were considering implementing and upstreaming the proposed alternative solution by elizarov on Dec 18, 2019. But since it was proposed on 2019, I'm wondering if this is still valid and possible to do after 6 years.

Assuming that we have a valid use case for this and it's not just a technical debt or a poorly designed class with a lot of properties, would you accept a PR with this alternative solution? And is it possible to implement?

AmrNashat-Adyen avatar Jun 10 '25 08:06 AmrNashat-Adyen

Hi! We've put this issue aside because there seems to be a low demand for it (although it is non-zero, given your request and issue references). I would say that having data classes with >256 properties is still a questionable architecture choice, but you seem to be sure that this is a valid use case for you. Yes, it is possible to implement the workaround by boxing everything (or only the arguments that go beyond the 250 limit) to the array to pass it to the constructor. I would not object to such PR. Note that the current compiler plugin API is unstable and may be significantly changed over time, so you need to start working with the most recent compiler version.

sandwwraith avatar Jun 10 '25 13:06 sandwwraith