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

createAnnotatedEnumSerializer and createSimpleEnumSerializer functions must be made ABI-public #2703

Closed
broadwaylamb opened this issue Jun 5, 2024 · 1 comment
Assignees
Labels

Comments

@broadwaylamb
Copy link

broadwaylamb commented Jun 5, 2024

These functions:

are internal, but the kotlinx.serialization compiler plugin generates calls to these functions in user code. This is access violation.

Why this is important to us (the Kotlin compiler team): we're trying to enable visibility checks during IR validation in the compiler. Basically, these checks try to ensure that e.g. an internal function is only ever called from the same module it's declared in. We're trying to enable these checks in compiler tests, however, the kotlinx.serialization-related tests are failing because of access violations.

We suggest annotating these functions (and potentially other internal functions, calls to which may be emitted into user code by the compiler plugin) as @PublishedApi, or making them public.

@sandwwraith
Copy link
Member

Yes, they should. We usually annotate everything that can be called from generated code with @PublishedApi (see e.g.

internal fun noCompiledSerializer(forClass: String): KSerializer<*> =
), but it was forgotten for these particular functions.

@sandwwraith sandwwraith added the bug label Jun 5, 2024
sandwwraith added a commit that referenced this issue Jun 5, 2024
…d code

Since these functions can be called from other modules, they should have this annotation to satisfy a compiler visibility checker.

Fixes #2703
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants