Tóth István Zoltán
02/25/2024, 6:57 AMinterface Test : Service
And the class I would like to generate:
class Test$Impl : Test { }
I tried to figure out how to use FirDeclarationGenerationExtension
for this but I couldn't. getTopLevelClassIds
is called very early, and I don't know how to figure out which interfaces should I process.
Any pointers? Thanks in advance.Javier
02/25/2024, 9:46 AMJavier
02/25/2024, 9:47 AMTóth István Zoltán
02/26/2024, 5:37 AMTóth István Zoltán
02/26/2024, 5:43 AMdmitriy.novozhilov
02/26/2024, 6:27 AMTóth István Zoltán
02/26/2024, 7:15 AMgetTopLevelClassIds
is called very early and I can't figure out how to collect the classes I want to process.
In ExternalClassGenerator of the fir plugin prototype a predicate is used but when I tried it I got an empty result. I also checked the cache it uses with debugger and it was empty.
From FirDeclarationGenerationExtension:
• the getTopLevelClassIds
method is called AFTER the SUPERTYPES phase
• the generateTopLevelClassLikeDeclaration
method is called ON the SUPERTYPES phase
I don't understand how would this work.dmitriy.novozhilov
02/26/2024, 7:19 AMFrom `FirDeclarationGenerationExtension`:
• themethod is called AFTER the SUPERTYPES phasegetTopLevelClassIds
• theIt's a problem in the documentation. This comment about "after supertypes" is about methods about callablesmethod is called ON the SUPERTYPES phasegenerateTopLevelClassLikeDeclaration
getTopLevelClassIds
will be called on the supertypes stagedmitriy.novozhilov
02/26/2024, 7:20 AMThe problem is thatOnly using predicatesis called very early and I can't figure out how to collect the classes I want to process.getTopLevelClassIds
In ExternalClassGenerator of the fir plugin prototype a predicate is used but when I tried it I got an empty result. I also checked the cache it uses with debugger and it was empty.That's strange Did you register your predicates in the extension itself?
Tóth István Zoltán
02/26/2024, 7:22 AMoverride fun FirDeclarationPredicateRegistrar.registerPredicates() {
register(PREDICATE)
}
dmitriy.novozhilov
02/26/2024, 7:24 AMTóth István Zoltán
02/26/2024, 7:37 AMTóth István Zoltán
02/26/2024, 7:44 AM