check-flagged-apis: add Flag value class

Add a value class to represent Flag names. We could use plain Strings
but having a dedicated class (with no overhead compared to String) makes
the intent of the code much clearer.

Bug: 334870672
Test: m check-flagged-apis && check-flagged-apis
Change-Id: Icdd4fb97d3fd49e507b7559504ea173a3dc52dea
This commit is contained in:
Mårten Kongstad 2024-04-16 11:23:22 +02:00
parent e0179976cd
commit dc3fc2e0bc

View file

@ -57,6 +57,19 @@ internal value class Symbol(val name: String) {
override fun toString(): String = name.toString() override fun toString(): String = name.toString()
} }
/**
* Class representing the fully qualified name of an aconfig flag.
*
* This includes both the flag's package and name, separated by a dot, e.g.:
* <pre>
* com.android.aconfig.test.disabled_ro
* <pre>
*/
@JvmInline
internal value class Flag(val name: String) {
override fun toString(): String = name.toString()
}
class CheckCommand : CliktCommand() { class CheckCommand : CliktCommand() {
override fun run() { override fun run() {
println("hello world") println("hello world")