Fix flag app being empty.

Kotlin evaluates `object` declarations lazily.
We have to access `Flags` before it will populate
the list, and we were asking for the list during
construction of our dagger graph.

Bug: 257302229
Test: manual
Change-Id: Iadfbbbc50ee2fb09260f5d119898fb50b3cc90f9
This commit is contained in:
Dave Mankoff
2022-11-15 21:40:05 +00:00
parent 6fe4159252
commit aea66f750b
2 changed files with 10 additions and 2 deletions

View File

@@ -22,7 +22,11 @@ object FlagsFactory {
private val flagMap = mutableMapOf<String, Flag<*>>()
val knownFlags: Map<String, Flag<*>>
get() = flagMap
get() {
// We need to access Flags in order to initialize our map.
assert(flagMap.contains(Flags.TEAMFOOD.name)) { "Where is teamfood?" }
return flagMap
}
fun unreleasedFlag(
id: Int,

View File

@@ -22,7 +22,11 @@ object FlagsFactory {
private val flagMap = mutableMapOf<String, Flag<*>>()
val knownFlags: Map<String, Flag<*>>
get() = flagMap
get() {
// We need to access Flags in order to initialize our map.
assert(flagMap.contains(Flags.TEAMFOOD.name)) { "Where is teamfood?" }
return flagMap
}
fun unreleasedFlag(
id: Int,