Skip to content

Commit 58b2928

Browse files
authored
Fix set component registration issue. (#209)
The issue manidests with registered value components being missing at runtime.
1 parent 44dbf50 commit 58b2928

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

firebase-common/src/main/java/com/google/firebase/components/ComponentRuntime.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ private void processInstanceComponents() {
7575
for (Map.Entry<Component<?>, Lazy<?>> entry : components.entrySet()) {
7676
Component<?> component = entry.getKey();
7777
if (!component.isValue()) {
78-
return;
78+
continue;
7979
}
8080

8181
Lazy<?> lazy = entry.getValue();

firebase-common/src/test/java/com/google/firebase/components/ComponentRuntimeTest.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,4 +266,22 @@ public void setComponents_shouldParticipateInCycleDetection() {
266266
// success.
267267
}
268268
}
269+
270+
@Test
271+
public void setComponents_shouldNotPreventValueComponentsFromBeingRegistered() {
272+
ComponentRuntime runtime =
273+
new ComponentRuntime(
274+
EXECUTOR,
275+
Collections.emptySet(),
276+
Component.intoSet(1, Integer.class),
277+
Component.intoSet(2, Integer.class),
278+
Component.of(2f, Float.class),
279+
Component.intoSet(3, Integer.class),
280+
Component.intoSet(4, Integer.class),
281+
Component.of(4d, Double.class));
282+
283+
assertThat(runtime.setOf(Integer.class)).containsExactly(1, 2, 3, 4);
284+
assertThat(runtime.get(Float.class)).isEqualTo(2f);
285+
assertThat(runtime.get(Double.class)).isEqualTo(4d);
286+
}
269287
}

0 commit comments

Comments
 (0)