54
54
import com .google .common .collect .Maps ;
55
55
import com .google .common .collect .Sets ;
56
56
import com .google .common .collect .TreeTraverser ;
57
- import com .google .common .util .concurrent .ListenableFuture ;
58
57
import dagger .Component ;
59
58
import dagger .Reusable ;
60
59
import dagger .internal .codegen .ComponentDescriptor .ComponentMethodDescriptor ;
@@ -488,9 +487,6 @@ public Iterable<MultibindingDeclaration> apply(Key key) {
488
487
* the following types, returns a {@link ProductionBinding}.
489
488
*
490
489
* <ul>
491
- * <li>{@link Producer Producer<SetOrMap>}
492
- * <li>{@link Produced Produced<SetOrMap>}
493
- * <li>{@link ListenableFuture ListenableFuture<SetOrMap>}
494
490
* <li>{@code Set<Produced<T>>}
495
491
* <li>{@code Map<K, Producer<V>>}
496
492
* <li>{@code Map<K, Produced<V>>}
@@ -504,7 +500,7 @@ private Optional<? extends ContributionBinding> syntheticMultibinding(
504
500
Iterable <MultibindingDeclaration > multibindingDeclarations ) {
505
501
if (isEmpty (multibindingContributions ) && isEmpty (multibindingDeclarations )) {
506
502
return Optional .absent ();
507
- } else if (multibindingsRequireProduction (multibindingContributions , request )) {
503
+ } else if (multibindingsRequireProduction (multibindingContributions , request . key () )) {
508
504
return Optional .of (
509
505
productionBindingFactory .syntheticMultibinding (request , multibindingContributions ));
510
506
} else {
@@ -514,33 +510,17 @@ private Optional<? extends ContributionBinding> syntheticMultibinding(
514
510
}
515
511
516
512
private boolean multibindingsRequireProduction (
517
- Iterable <ContributionBinding > multibindingContributions , DependencyRequest request ) {
518
- switch (request .kind ()) {
519
- case PRODUCER :
520
- case PRODUCED :
521
- case FUTURE :
513
+ Iterable <ContributionBinding > multibindingContributions , Key requestKey ) {
514
+ if (MapType .isMap (requestKey )) {
515
+ MapType mapType = MapType .from (requestKey );
516
+ if (mapType .valuesAreTypeOf (Producer .class ) || mapType .valuesAreTypeOf (Produced .class )) {
522
517
return true ;
523
-
524
- case INSTANCE :
525
- case LAZY :
526
- case PROVIDER :
527
- case PROVIDER_OF_LAZY :
528
- if (MapType .isMap (request .key ())) {
529
- MapType mapType = MapType .from (request .key ());
530
- if (mapType .valuesAreTypeOf (Producer .class )
531
- || mapType .valuesAreTypeOf (Produced .class )) {
532
- return true ;
533
- }
534
- } else if (SetType .isSet (request .key ())
535
- && SetType .from (request .key ()).elementsAreTypeOf (Produced .class )) {
536
- return true ;
537
- }
538
- return Iterables .any (multibindingContributions , isOfType (BindingType .PRODUCTION ));
539
-
540
- case MEMBERS_INJECTOR :
541
- default :
542
- throw new AssertionError (request .kind ());
518
+ }
519
+ } else if (SetType .isSet (requestKey )
520
+ && SetType .from (requestKey ).elementsAreTypeOf (Produced .class )) {
521
+ return true ;
543
522
}
523
+ return Iterables .any (multibindingContributions , isOfType (BindingType .PRODUCTION ));
544
524
}
545
525
546
526
private ImmutableSet <ContributionBinding > createDelegateBindings (
0 commit comments