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

Remove @ExperimentalUnsignedTypes annotation from kotlin code generator. #7092

Merged
merged 1 commit into from
Feb 14, 2022

Conversation

aaronriekenberg
Copy link
Contributor

Remove @ExperimentalUnsignedTypes from generated kotlin code as unsigned types are no longer experimental in Kotlin 1.5 and newer: https://kotlinlang.org/docs/whatsnew15.html#stable-unsigned-integer-types

Fixes #7087

@github-actions github-actions bot added c++ codegen Involving generating code from schema kotlin labels Feb 8, 2022
@dbaileychess
Copy link
Collaborator

@paulovap Do you want to take a look?

@@ -259,7 +259,6 @@ class KotlinGenerator : public BaseGenerator {
GenerateComment(enum_def.doc_comment, writer, &comment_config);

writer += "@Suppress(\"unused\")";
writer += "@ExperimentalUnsignedTypes";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to make this optional for kotlin users before 1.5?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we change the behaviour to not generate the annotations by default, the user will have to do a change on their build system. Either by invoking flatc with a flag, like --kotlin-unsigned-annotation or by introducing a flags on Kotlin compiler(kotlinc) as defined here.

The other option is to add a flag to suppress generating this annotation --kotlin-supress-unsigned-annotation, keeping the current behaviour default.

AFAIK, Kotlin users adopt newer versions of quite fast so I would be leaning to simply not generating the annotation (keeping current PR as is). Users of old versions can add flags on their build system to remediate that.

Maybe we can leave the PR open for a few more days to see if Kotlin users can provide feedback.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the info. Lets leave open for a bit and if I don't hear anything I will merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ codegen Involving generating code from schema kotlin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add option to remove @ExperimentalUnsignedTypes in kotlin code as these are no longer unstable
3 participants