You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm consistently seeing in multiple processors that getSymbolsWithAnnotation() returns duplicate symbols or symbols processed in previous rounds in multi round scenarios with deferred symbols. I wanted to file this issue to start the discussion.
getSymbolsWithAnnotation() says in its documentation:
Note that in multiple round processing, only symbols from deferred symbols of last round and symbols from newly generated files will be returned in this function.
But I'm seeing the following:
Round 1: A KSClassDeclaration can't be processed and is deferred.
Round 2: getSymbolsWithAnnotation() returns the deferred symbol twice in the Sequence. Ignoring one entry allows us to process the KSClassDeclaration. It's not returned as deferred symbol anymore, but other symbols are deferred.
Round 3: getSymbolsWithAnnotation() returns the already processed KSClassDeclaration.
This happens with KSP 1.9.24-1.0.20 but also 2.0.0-1.0.22.
We've implemented workarounds such as:
fun Resolver.getNewSymbolsWithAnnotation(annotation:KClass<*>): Sequence<KSAnnotated> {
val newFiles = getNewFiles().toSet()
return getSymbolsWithAnnotation(annotation)
.filter { it.containingFile in newFiles }
}
To filter symbols ourselves. We also keep track of all successfully processed symbols and ignore them when getSymbolsWithAnnotation() returns them again.
I have yet to build a sample to reproduce the issue outside of our internal code, but I wanted to file this issue to start the discussion. Is there a chance that caching issues or other problems could trigger this bug?
The text was updated successfully, but these errors were encountered:
I'm consistently seeing in multiple processors that
getSymbolsWithAnnotation()
returns duplicate symbols or symbols processed in previous rounds in multi round scenarios with deferred symbols. I wanted to file this issue to start the discussion.getSymbolsWithAnnotation()
says in its documentation:But I'm seeing the following:
KSClassDeclaration
can't be processed and is deferred.getSymbolsWithAnnotation()
returns the deferred symbol twice in theSequence
. Ignoring one entry allows us to process theKSClassDeclaration
. It's not returned as deferred symbol anymore, but other symbols are deferred.getSymbolsWithAnnotation()
returns the already processedKSClassDeclaration
.This happens with KSP
1.9.24-1.0.20
but also2.0.0-1.0.22
.We've implemented workarounds such as:
To filter symbols ourselves. We also keep track of all successfully processed symbols and ignore them when
getSymbolsWithAnnotation()
returns them again.I have yet to build a sample to reproduce the issue outside of our internal code, but I wanted to file this issue to start the discussion. Is there a chance that caching issues or other problems could trigger this bug?
The text was updated successfully, but these errors were encountered: