@@ -314,34 +314,25 @@ private MethodSpec callProducesMethod(ProductionBinding binding, FactoryFields f
314314 methodBuilder .addAnnotation (AnnotationSpecs .suppressWarnings (UNCHECKED ));
315315 }
316316
317- CodeBlock moduleCodeBlock ;
318- if (factoryFields .moduleField .isPresent ()) {
319- moduleCodeBlock = CodeBlock .of (factoryFields .moduleField .get ().name );
320- } else if (binding .contributingModule ().isPresent ()
321- && binding .contributingModule ().get ().isKotlinObject ()) {
322- moduleCodeBlock = CodeBlock .of (
323- "$T.INSTANCE" , binding .bindingTypeElement ().get ().getClassName ());
324- } else {
325- moduleCodeBlock = CodeBlock .of ("$T" , binding .bindingTypeElement ().get ().getClassName ());
326- }
327-
328- CodeBlock factoryMethodCall =
317+ CodeBlock moduleCodeBlock =
329318 CodeBlock .of (
330319 "$L.$L($L)" ,
331- moduleCodeBlock ,
320+ factoryFields .moduleField .isPresent ()
321+ ? factoryFields .moduleField .get ().name
322+ : CodeBlock .of ("$T" , binding .bindingTypeElement ().get ().getClassName ()),
332323 getSimpleName (binding .bindingElement ().get ()),
333324 makeParametersCodeBlock (parameterCodeBlocks .build ()));
334325
335326 switch (binding .productionKind ().get ()) {
336327 case IMMEDIATE :
337328 methodBuilder .addStatement (
338- "return $T.<$T>immediateFuture($L)" , FUTURES , contributedTypeName , factoryMethodCall );
329+ "return $T.<$T>immediateFuture($L)" , FUTURES , contributedTypeName , moduleCodeBlock );
339330 break ;
340331 case FUTURE :
341- methodBuilder .addStatement ("return $L" , factoryMethodCall );
332+ methodBuilder .addStatement ("return $L" , moduleCodeBlock );
342333 break ;
343334 case SET_OF_FUTURE :
344- methodBuilder .addStatement ("return $T.allAsSet($L)" , PRODUCERS , factoryMethodCall );
335+ methodBuilder .addStatement ("return $T.allAsSet($L)" , PRODUCERS , moduleCodeBlock );
345336 break ;
346337 }
347338 return methodBuilder .build ();
0 commit comments