Skip to content

Set and Map multibindings may generate methods which are too large #4934

@damianw

Description

@damianw

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions