Skip to content

Commit

Permalink
xds: Fix test compilation for confused javac
Browse files Browse the repository at this point in the history
The internal build fails with "reference to assertThat is ambiguous". It
isn't clear why the internal build fails while the external one is okay,
but it is clear that the wildcard T return of readOutbound() is probably
confusing things as javac is considering assertThat(BigDecimal) as a
possible match.

The T return type is a hidden, convenience cast. We force the type
passed to assertThat() to be Object to avoid any ambiguity.
  • Loading branch information
ejona86 committed Sep 16, 2021
1 parent 49842d2 commit 9d9d8ec
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,9 @@ public void filterSelectorChange_drainsConnection() {
channel.runPendingTasks();
channelHandlerCtx = pipeline.context(next);
assertThat(channelHandlerCtx).isNotNull();
assertThat(channel.readOutbound()).isNull();
// Force return value to Object, to avoid confusing javac of the type passed to assertThat()
Object msg = channel.readOutbound();
assertThat(msg).isNull();

selectorManager.updateSelector(new FilterChainSelector(
new HashMap<FilterChain, ServerRoutingConfig>(), null, noopConfig));
Expand Down

0 comments on commit 9d9d8ec

Please sign in to comment.