Vladimir Tagakov
02/24/2023, 1:38 AMCollectAnnotatedSymbolsVisitor appropriately.
But maybe you think it is a good idea to introduce an annotations() fun like javac processors have and infer what exactly should be visited with given set of KSP processors and all annotations they aim to use?Jiaxiang
02/24/2023, 1:58 AMVladimir Tagakov
02/24/2023, 2:08 AMClassDeclaration for my processor since its annotation will never be placed anywhere but type itself.
getSymbolsWithAnnotation spends 95%+ of time traversing properties, function declarations, etc. When I only need ClassDeclarations traversed.
I think that it could be avoided if KSP knew upfront where annotations used by its SymbolProcessors could be possibly used.Vladimir Tagakov
02/24/2023, 2:10 AMClassDeclarations 🙂Jiaxiang
02/24/2023, 2:13 AMResolverImpl as a reference)Vladimir Tagakov
02/24/2023, 2:17 AMSymbolProcessor API? Mind me making a PR with this optimization?
I think it is possible to change SymbolProcessor api without breaking backwards compatibilityJiaxiang
02/24/2023, 2:26 AMVladimir Tagakov
02/24/2023, 2:31 AMfun usedAnnotations(): Set<String> = emptySet() method to the SymbolProcessor interface.
Here it is possible to gather all used annotations from all processors and configure resolver accordingly so it will skip declarations that doesn’t make sense to traverse by configuring CollectAnnotatedSymbolsVisitorVladimir Tagakov
02/24/2023, 2:33 AMJiaxiang
02/24/2023, 2:35 AMVladimir Tagakov
02/25/2023, 1:01 AM