Declaration Vs Property
Some code constructs can be represented as declarations (declaration-site) and as properties (use-site).
Declaration Site
Consider this annotation class:
The above code represents the declaration of the CustomLogger
annotation class, the place in the code where this annotation is declared (declaration-site). This declaration can be retrieved by filtering KoScope
declarations...
For example, such declaration can be used to check if annotations reside in a desired package:
Use Site
Now consider this function:
The above code also contains CustomLogger
annotation. However, this time code represents the place in the code where the annotation is used (use-site). Such annotations can be accessed using the annotations
property:
Such properties can be used to check if the function annotated with CustomLogger
annotation has the correct name prefix:
Last updated