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

[KSP2] "PSI has changed since creation" in SymbolProcessor::finish #2113

Open
kuanyingchou opened this issue Sep 20, 2024 · 1 comment
Open
Milestone

Comments

@kuanyingchou
Copy link
Collaborator

kuanyingchou commented Sep 20, 2024

I saw this in XProcessing's XTypeTest.wildcardWithMissingType and this could be more of a feature request.

In XProcessing we run a pseudo last run when SymbolProcessor::finish is called here and may still try to access types and annotations in finish. But we're hitting PSI has changed since creation. Could it be that things are cleaned up here?

If it is since there're no new files generated and the caches are still valid is it possible to delay the clean up in the last round so that we won't hit this error in onError or finish? For example, if there're two rounds, instead of:

round 1
clean up
round 2 (final round)
clean up
onError or finish

we do:

round 1
clean up
round 2 (final round)
onError or finish
clean up

This one looks similar to #1854.

@acejingbo
Copy link

acejingbo commented Dec 23, 2024

+1 to this request

In KAPT many processors does some finishing checks/summaries/codegens when round.isProcessingOver=true(for example creating a class that contain 1 method for each @MyAnnotation in source file, this can only be done when knowing no more source files will have generated by this or other annotation processors) (acknowledging the fact that these "summary codegen" won't be annotation-processed)
In KSP1 we can sorta simulate that by doing those in finish()
But in KSP2 they all cause problems like #1854. Specifically, i can't even do things like comparing a type with resolver.builtIns.intType, etc.

Right now if we wanna do any final checks/summaries/codegens, we can no longer use "finish()", so would kinda have to "force" a last round of "process()" by a dummy codegen or what. This doesn't feels like a sustainable approach, but we have no choice if we ever wanna migrate to ksp2...

I thin kuanyingchou's suggested solution would really help

@ting-yuan ting-yuan added this to the 1.0.30 milestone Jan 15, 2025
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

3 participants