Skip to content
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

Support @JvmStatic on generated Kotlin builders #767

Closed
kbrooks opened this issue Aug 6, 2021 · 4 comments
Closed

Support @JvmStatic on generated Kotlin builders #767

kbrooks opened this issue Aug 6, 2021 · 4 comments
Assignees
Labels
enhancement New feature or request good-first-issue Good for newcomers kotlin Pull requests that update Kotlin code
Milestone

Comments

@kbrooks
Copy link
Contributor

kbrooks commented Aug 6, 2021

Is your feature request related to a problem? Please describe.
I want to convert a project that is using the Java code generation to Kotlin in a codebase that relies heavily on generated builders. In order for the Kotlin code to be backwards compatible with the old Java code, the generated builders need a @JvmStatic annotation so they can be referenced like static methods from Java.

Describe the solution you'd like

Is there a way to configure the code generation to place a @JvmStatic annotation on the builder in the generated companion object?

@jxnu-liguobin
Copy link
Collaborator

Not supported. In general, scala/kotlin do not use the builder pattern. So I didn't consider compatibility with java at first, just for functional consistency.

But I agree to add this annotation to these methods by default, It's very simple. What about you? It would be better if you could create a pr. (add @JvmStatic on builder method).

@jxnu-liguobin jxnu-liguobin added enhancement New feature or request good-first-issue Good for newcomers kotlin Pull requests that update Kotlin code labels Aug 7, 2021
@kbrooks
Copy link
Contributor Author

kbrooks commented Aug 8, 2021 via email

@jxnu-liguobin
Copy link
Collaborator

kotlinClassGraphqlRequest.ftl request
kotlinClassGraphqlType.ftl type

@kobylynskyi
Copy link
Owner

Will soon be released as part of 5.3.0. Thanks for your patience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good-first-issue Good for newcomers kotlin Pull requests that update Kotlin code
Projects
None yet
Development

No branches or pull requests

3 participants