google / google/ksp

[KSP2] Symbols appear missing from `getSymbolsWithAnnotation` of a `TYPE_USE` annotation

Open
#2,374 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
3.5k
Forks
415
Avg merge
1d 2h
Merged PRs (30d)
53

Description

We have a java annotation, say

MyAnnatation.java
```
package com.example;

@Documented
@Retention(CLASS)
@Target(TYPE_USE)
public @interface MyAnnatation {}
````

Workload.kt
```
package com.example

interface Hoo

interface Koo

class Foo :
@MyAnnatation Hoo,
@MyAnnatation Koo { }
```

Use:

```
val symbols = resolver.getSymbolsWithAnnotation(MyAnnatation::class.java.name).toList()
```

Expected Results
```
[Hoo, Koo]
```

Actual Results:
```
[] // empty
``

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.