When using Set or Map multibindings, Dagger may generate methods which are too large to be compiled. We are only experiencing this when using dagger.fastInit. This appears to be caused by the expressions generated in SetRequestRepresentation here and MapRequestRepresentation here.
For example, in our case a large Set multibinding generates ImmutableSet.<...>of(expressions) where expressions is extremely long and causes the Java compiler to produce a code too large error. For sets, a workaround is to shard the multibindings and then have ElementsIntoSet bindings for each shard into the primary set. Maps can use a similar strategy, but won't have compile-time key checking across the different shards.
When using
SetorMapmultibindings, Dagger may generate methods which are too large to be compiled. We are only experiencing this when usingdagger.fastInit. This appears to be caused by the expressions generated inSetRequestRepresentationhere andMapRequestRepresentationhere.For example, in our case a large
Setmultibinding generatesImmutableSet.<...>of(expressions)whereexpressionsis extremely long and causes the Java compiler to produce acode too largeerror. For sets, a workaround is to shard the multibindings and then haveElementsIntoSetbindings for each shard into the primary set. Maps can use a similar strategy, but won't have compile-time key checking across the different shards.