Daniil Elovkov
12/05/2024, 10:48 PMresolver.getSymbolsWithAnnotation
returns deferred symbols from previous rounds from all symbol processors, not only the current one?
This line of code:
deferredSymbols.values.flatten().mapNotNull { it.restore() }.toSet()
in ResolverAAImpl. deferredSymbols
is a map with symbol processor as a key. But values.flatten
combines all deferred symbols from all processors.
Isn’t it unfortunate that processors are not isolated in this sense, and if one processor relies on some deferring logic of its own, another one can spoil it?hfhbd
12/06/2024, 6:22 AMDaniil Elovkov
12/06/2024, 8:16 AMDaniil Elovkov
12/06/2024, 9:23 AMgetSymbolsWithAnnotations
returns the sum of newly generated and deferred symbols. There is no doubt that all newly generated symbols have to visible to all processors. But it’s not clear why deferred symbols have to follow the same logic.
If I, as a processor author, decide that the declaration is ready and I have already handled it and I defer some other declarations but not this one, I don’t expect it to be returned to me again, in the next round.
But it will be returned, if another processor decides it cannot handle it just now, and defers it.
So, effectively, in order to avoid processing something twice, I will always have to check that symbols returned to me are really either new or have been deferred by my processor. And that check is exactly what the map from processor to deferred symbols already contains by being a map.
Or am I missing something?