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

Incompatible with kotlinx-serialization #56

Open
edenman opened this issue Sep 8, 2021 · 2 comments
Open

Incompatible with kotlinx-serialization #56

edenman opened this issue Sep 8, 2021 · 2 comments

Comments

@edenman
Copy link

edenman commented Sep 8, 2021

Ok so #16 and #24 raised this, but I felt like it was worth reopening since redacting fields in a kotlinx @Serializable class actually seems like a very common usecase.

The problem: the compiler plugin infrastructure doesn't currently support multiple compiler plugins operating on the same class if they both need to look at the constructors of the class. Kotlinx serialization uses a compiler plugin, so Redacted's compiler breaks.

Possible solution: Add a KSP plugin to generate a new possiblyRedactedToString() method for all @Serializable classes. Then still use a compiler plugin to replace toString() but instead of doing it only if a @Redacted annotation is present, do it for all @Serializable classes.

I think this would work, but it's probably too niche to support for this library. What do you think?

@ZacSweers
Copy link
Owner

I think that would need to be a separate library. I do wish they'd offer better answers here for 3rd party plugins. What will happen when they break compose? "Sorry this wasn't supported anyway bye". Anvil has experienced similar issues as well.

@edenman
Copy link
Author

edenman commented Sep 8, 2021

Cool, thanks for the quick reply! I'll post here if I end up open-sourcing something

@ZacSweers ZacSweers changed the title Allow coexistence with kotlinx-serialization Incompatible with kotlinx-serialization Sep 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants