-
Notifications
You must be signed in to change notification settings - Fork 1.2k
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KotlinGenerator should generate open properties in generated records #13467
Comments
Thanks for your suggestion. Why does ModelMapper require that, given that there are getters and setters, which it should use instead? |
@lukaseder That I don't particularly know. I know it only applies when you bring in a custom mapping. A default setup does not require any fields to be I'm not familiar with the JOOQ codebase, but if pointed in the right direction I may be able to tackle this. |
I see. I checked the bytecode generated from the two versions. The difference is: Without
With
So, the difference is that these getters and setters are either I don't want to spend too much time making this configurable, or pointing you in directions, given that you don't have access to the integration tests or the commercial source code. I'll just go ahead and implement this minor change for jOOQ 3.17. |
As far as I can tell, only records are affected? "POJOs" produce data classes by default, which are implicitly final. Interfaces are open by default. |
Can you try if this fixes the issue for you? https://github.com/jOOQ/jOOQ/commit/0b3c99e00ac76f8882ae4b0cfa10b688bdf28229.patch |
Of course, the patch causes a regression when we generate |
It seems we can just apply the usual ugly workaround of annotating those properties with https://youtrack.jetbrains.com/issue/KT-31420 Since this only affects properties produce the conflict documented here: #11912, I can live with this ugliness. |
Done |
@lukaseder Thanks you! |
Use case:
Using the KotlinGenerator for JOOQ, it creates various records such as
Some use cases require field level properties within classes to be open. For example, ModelMapper requires fields to be not
final
when provided with custom type mappings. By default, Kotlin fields are consideredfinal
.Making the field
open
fixes these sort of compatibility issues.Possible solution you'd like to see:
Similar to the visibility modifier I think it would be nice for JOOQ to provide a native configuration option to specify fields as open.
Possible workarounds:
The only workaround I'm aware of is manually editing the fields generated.
Versions:
The text was updated successfully, but these errors were encountered: