google / google/ksp

Any way to get `constantValue`?

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

Description

Is there any equivalent API for the `VariableElement.getConstantValue()` method from Java annotation processing?

If no, is there any suggested workaround or timeframe when KSP will support it?

For example from this source code, I'm looking to obtain the "my_string" string:
```
object MyClass {
const val STR = "my_string"
}
```

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.