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

Fix classes being 'lost' when earlier rounds of annotation processing succeed before a later round fails #3324

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

facboy
Copy link

@facboy facboy commented Nov 18, 2024

What it does

Annotation processing can fail with a SourceTypeCollisionException when a to-be generated type is referenced by an 'existing' source file. When this happens the compiler 'recompiles' the original files together with the newly generated files. The current implementation is buggy because annotation processing can go through multiple rounds, with each round generating new files. It is possible for earlier rounds to 'succeed', only for a later round to fail with a SourceTypeCollisionException requiring a restart. The current implementation 'loses' those files generated in earlier successful rounds.

This PR fixes this issue by ensuring that files from earlier rounds are also included in the retry.

How to test

Unfortunately I only have a local project I am working on (which is how I discovered the bug). It's a WIP but I could make it available.

Author checklist

… succeed before a later round fails

Specifically, when a later round of annotation processing fails with a `SourceTypeCollisionException` (i.e. generated type referenced before it has been created).
@jukzi
Copy link
Contributor

jukzi commented Nov 26, 2024

Please add a junit test as a separate commit that shows the error and gets solved by this commit. You can use this as sample: #1698

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

Successfully merging this pull request may close these issues.

2 participants