-
Notifications
You must be signed in to change notification settings - Fork 288
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
Accessing properties, functions and typealiases by their fully qualified name #112
Comments
Yes it is possible. Can you give an example why this is necessary or convenient? |
For example I tried to rewrite my DI plugin to use KSP. I generate top-level functions and typealiases but I can never reference them again (in other compilation units) because I can only get classes by their name. Btw there should be also a way to get all declarations in a package. E.g. getDeclarationsInPackage(fqName: String). |
You can do |
I don't need to get the declarations in the current compilation unit but from others. So I cannot search for them in the files of the current compilation |
See for example Dagger Hilt or Anvil from Square. Both of them wouldn't be possible to be implemented with KSP because they aggregate information across compilations. They store the information as classes and properties in a single package. Eventually they read the information of all modules and do the code generation. |
Thanks, this is an interesting use case that we didn't thought of. Will add the API. BTW, it should be possible by accessing FileKt where top level functions and properties are stored. That is platform and implementation specific, though. |
It should be possible get properties, functions and typealiases by their fully qualified name.
Api could look similar like
Resolver.getClassDeclarationByName
The text was updated successfully, but these errors were encountered: