diff --git a/java/dagger/internal/codegen/base/FrameworkTypes.java b/java/dagger/internal/codegen/base/FrameworkTypes.java index 2a56e1d8bba..e607f766461 100644 --- a/java/dagger/internal/codegen/base/FrameworkTypes.java +++ b/java/dagger/internal/codegen/base/FrameworkTypes.java @@ -16,7 +16,6 @@ package dagger.internal.codegen.base; -import static dagger.internal.codegen.extension.DaggerStreams.toImmutableSet; import static dagger.internal.codegen.xprocessing.XTypes.isTypeOf; import androidx.room.compiler.processing.XType; @@ -32,7 +31,11 @@ public final class FrameworkTypes { // TODO(erichang): Add the Jakarta Provider here private static final ImmutableSet PROVISION_TYPES = - ImmutableSet.of(TypeNames.PROVIDER, TypeNames.LAZY, TypeNames.MEMBERS_INJECTOR); + ImmutableSet.of( + TypeNames.PROVIDER, + TypeNames.JAKARTA_PROVIDER, + TypeNames.LAZY, + TypeNames.MEMBERS_INJECTOR); // NOTE(beder): ListenableFuture is not considered a producer framework type because it is not // defined by the framework, so we can't treat it specially in ordinary Dagger. @@ -42,13 +45,15 @@ public final class FrameworkTypes { private static final ImmutableSet ALL_FRAMEWORK_TYPES = ImmutableSet.builder().addAll(PROVISION_TYPES).addAll(PRODUCTION_TYPES).build(); - private static final ImmutableSet SET_VALUE_FRAMEWORK_TYPES = + public static final ImmutableSet SET_VALUE_FRAMEWORK_TYPES = ImmutableSet.of(TypeNames.PRODUCED); public static final ImmutableSet MAP_VALUE_FRAMEWORK_TYPES = - MapType.VALID_FRAMEWORK_REQUEST_KINDS.stream() - .map(RequestKinds::frameworkClassName) - .collect(toImmutableSet()); + ImmutableSet.of( + TypeNames.PRODUCED, + TypeNames.PRODUCER, + TypeNames.PROVIDER, + TypeNames.JAKARTA_PROVIDER); /** Returns true if the type represents a producer-related framework type. */ public static boolean isProducerType(XType type) { diff --git a/java/dagger/internal/codegen/base/MapType.java b/java/dagger/internal/codegen/base/MapType.java index f9c6304084a..ba4b1e79274 100644 --- a/java/dagger/internal/codegen/base/MapType.java +++ b/java/dagger/internal/codegen/base/MapType.java @@ -35,8 +35,10 @@ @AutoValue public abstract class MapType { // TODO(b/28555349): support PROVIDER_OF_LAZY here too + // TODO(b/376124787): We could consolidate this with a similar list in FrameworkTypes + // if we had a better way to go from RequestKind to framework ClassName or vice versa /** The valid framework request kinds allowed on a multibinding map value. */ - public static final ImmutableSet VALID_FRAMEWORK_REQUEST_KINDS = + private static final ImmutableSet VALID_FRAMEWORK_REQUEST_KINDS = ImmutableSet.of(RequestKind.PROVIDER, RequestKind.PRODUCER, RequestKind.PRODUCED); private XType type; @@ -107,12 +109,19 @@ public XType unwrappedFrameworkValueType() { */ public RequestKind valueRequestKind() { checkArgument(!isRawType()); - for (RequestKind frameworkRequestKind : VALID_FRAMEWORK_REQUEST_KINDS) { - if (valuesAreTypeOf(RequestKinds.frameworkClassName(frameworkRequestKind))) { - return frameworkRequestKind; - } + RequestKind requestKind = RequestKinds.getRequestKind(valueType()); + if (VALID_FRAMEWORK_REQUEST_KINDS.contains(requestKind)) { + return requestKind; + } else if (requestKind == RequestKind.PROVIDER_OF_LAZY) { + // This is kind of a weird case. We don't support Map>, so we also don't support + // Map>> directly. However, if the user bound that themselves, we don't + // want that to get confused as a normal instance request, so return PROVIDER here. + return RequestKind.PROVIDER; + } else { + // Not all RequestKinds are supported, so if there's a map value that matches an unsupported + // RequestKind, just treat it like it is a normal instance request. + return RequestKind.INSTANCE; } - return RequestKind.INSTANCE; } /** {@code true} if {@code type} is a {@link java.util.Map} type. */ diff --git a/java/dagger/internal/codegen/base/RequestKinds.java b/java/dagger/internal/codegen/base/RequestKinds.java index 4fb39186b95..fdf1c2020ed 100644 --- a/java/dagger/internal/codegen/base/RequestKinds.java +++ b/java/dagger/internal/codegen/base/RequestKinds.java @@ -97,6 +97,8 @@ public static TypeName requestTypeName(RequestKind requestKind, TypeName keyType private static final ImmutableMap FRAMEWORK_CLASSES = ImmutableMap.of( + // Default to the javax Provider since that is what is used for the binding graph + // representation. PROVIDER, TypeNames.PROVIDER, LAZY, TypeNames.LAZY, PRODUCER, TypeNames.PRODUCER, @@ -111,10 +113,15 @@ public static RequestKind getRequestKind(XType type) { return RequestKind.INSTANCE; } - if (isTypeOf(type, TypeNames.PROVIDER) && isTypeOf(unwrapType(type), TypeNames.LAZY)) { + if ((isTypeOf(type, TypeNames.PROVIDER) || isTypeOf(type, TypeNames.JAKARTA_PROVIDER)) + && isTypeOf(unwrapType(type), TypeNames.LAZY)) { return RequestKind.PROVIDER_OF_LAZY; } + if (isTypeOf(type, TypeNames.JAKARTA_PROVIDER)) { + return RequestKind.PROVIDER; + } + return FRAMEWORK_CLASSES.keySet().stream() .filter(kind -> isTypeOf(type, FRAMEWORK_CLASSES.get(kind))) .collect(toOptional()) diff --git a/java/dagger/internal/codegen/binding/ComponentDeclarations.java b/java/dagger/internal/codegen/binding/ComponentDeclarations.java index 401dcf3031f..ac2ebd4939f 100644 --- a/java/dagger/internal/codegen/binding/ComponentDeclarations.java +++ b/java/dagger/internal/codegen/binding/ComponentDeclarations.java @@ -25,10 +25,12 @@ import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSetMultimap; import com.google.common.collect.Multimaps; +import com.squareup.javapoet.ClassName; import com.squareup.javapoet.ParameterizedTypeName; import com.squareup.javapoet.TypeName; import com.squareup.javapoet.WildcardTypeName; import dagger.internal.codegen.base.DaggerSuperficialValidation; +import dagger.internal.codegen.base.FrameworkTypes; import dagger.internal.codegen.javapoet.TypeNames; import dagger.internal.codegen.model.DaggerAnnotation; import dagger.internal.codegen.model.Key; @@ -38,11 +40,6 @@ /** Stores the bindings and declarations of a component by key. */ final class ComponentDeclarations { - private static final ImmutableSet MAP_FRAMEWORK_TYPENAMES = - ImmutableSet.of(TypeNames.PROVIDER, TypeNames.PRODUCER, TypeNames.PRODUCED); - private static final ImmutableSet SET_FRAMEWORK_TYPENAMES = - ImmutableSet.of(TypeNames.PRODUCED); - private final KeyFactory keyFactory; private final ImmutableSetMultimap bindings; private final ImmutableSetMultimap delegates; @@ -320,14 +317,14 @@ private static TypeName unwrapMultibindingTypeName(TypeName typeName) { return ParameterizedTypeName.get( mapTypeName.rawType, mapKeyTypeName, - unwrapFrameworkTypeName(mapValueTypeName, MAP_FRAMEWORK_TYPENAMES)); + unwrapFrameworkTypeName(mapValueTypeName, FrameworkTypes.MAP_VALUE_FRAMEWORK_TYPES)); } if (isValidSetMultibindingTypeName(typeName)) { ParameterizedTypeName setTypeName = (ParameterizedTypeName) typeName; TypeName setValueTypeName = getOnlyElement(setTypeName.typeArguments); return ParameterizedTypeName.get( setTypeName.rawType, - unwrapFrameworkTypeName(setValueTypeName, SET_FRAMEWORK_TYPENAMES)); + unwrapFrameworkTypeName(setValueTypeName, FrameworkTypes.SET_VALUE_FRAMEWORK_TYPES)); } return typeName; } @@ -354,7 +351,7 @@ private static boolean isValidSetMultibindingTypeName(TypeName typeName) { } private static TypeName unwrapFrameworkTypeName( - TypeName typeName, ImmutableSet frameworkTypeNames) { + TypeName typeName, ImmutableSet frameworkTypeNames) { if (typeName instanceof ParameterizedTypeName) { ParameterizedTypeName parameterizedTypeName = (ParameterizedTypeName) typeName; if (frameworkTypeNames.contains(parameterizedTypeName.rawType)) { diff --git a/java/dagger/internal/codegen/binding/KeyFactory.java b/java/dagger/internal/codegen/binding/KeyFactory.java index e03814899bb..693382e4908 100644 --- a/java/dagger/internal/codegen/binding/KeyFactory.java +++ b/java/dagger/internal/codegen/binding/KeyFactory.java @@ -38,6 +38,7 @@ import dagger.Binds; import dagger.BindsOptionalOf; import dagger.internal.codegen.base.ContributionType; +import dagger.internal.codegen.base.FrameworkTypes; import dagger.internal.codegen.base.MapType; import dagger.internal.codegen.base.OptionalType; import dagger.internal.codegen.base.RequestKinds; @@ -97,10 +98,7 @@ private XType optionalOf(XType type) { /** Returns {@code Map>}. */ private XType mapOfFrameworkType(XType keyType, ClassName frameworkClassName, XType valueType) { - checkArgument( - MapType.VALID_FRAMEWORK_REQUEST_KINDS.stream() - .map(RequestKinds::frameworkClassName) - .anyMatch(frameworkClassName::equals)); + checkArgument(FrameworkTypes.MAP_VALUE_FRAMEWORK_TYPES.contains(frameworkClassName)); return mapOf( keyType, processingEnv.getDeclaredType( @@ -317,10 +315,7 @@ public Key unwrapMapValueType(Key key) { * type. */ private Key wrapMapValue(Key key, ClassName frameworkClassName) { - checkArgument( - MapType.VALID_FRAMEWORK_REQUEST_KINDS.stream() - .map(RequestKinds::frameworkClassName) - .anyMatch(frameworkClassName::equals)); + checkArgument(FrameworkTypes.MAP_VALUE_FRAMEWORK_TYPES.contains(frameworkClassName)); if (MapType.isMap(key)) { MapType mapType = MapType.from(key); if (!mapType.isRawType() && !mapType.valuesAreTypeOf(frameworkClassName)) { diff --git a/java/dagger/internal/codegen/binding/SourceFiles.java b/java/dagger/internal/codegen/binding/SourceFiles.java index 350051522f4..ff17ab27881 100644 --- a/java/dagger/internal/codegen/binding/SourceFiles.java +++ b/java/dagger/internal/codegen/binding/SourceFiles.java @@ -95,14 +95,6 @@ public final class SourceFiles { dependency -> { ClassName frameworkClassName = frameworkTypeMapper.getFrameworkType(dependency.kind()).frameworkClassName(); - // Remap factory fields back to javax.inject.Provider to maintain backwards compatibility - // for now. In a future release, we should change this to Dagger Provider. This will still - // be a breaking change, but keeping compatibility for a while should reduce the - // likelihood of breakages as it would require components built at much older versions - // using factories built at newer versions to break. - if (frameworkClassName.equals(TypeNames.DAGGER_PROVIDER)) { - frameworkClassName = TypeNames.PROVIDER; - } return FrameworkField.create( ParameterizedTypeName.get( frameworkClassName, diff --git a/java/dagger/internal/codegen/javapoet/TypeNames.java b/java/dagger/internal/codegen/javapoet/TypeNames.java index 930ec141828..52e8928c6cf 100644 --- a/java/dagger/internal/codegen/javapoet/TypeNames.java +++ b/java/dagger/internal/codegen/javapoet/TypeNames.java @@ -88,6 +88,7 @@ public final class TypeNames { public static final ClassName MEMBERS_INJECTORS = ClassName.get("dagger.internal", "MembersInjectors"); public static final ClassName PROVIDER = ClassName.get("javax.inject", "Provider"); + public static final ClassName JAKARTA_PROVIDER = ClassName.get("jakarta.inject", "Provider"); public static final ClassName DAGGER_PROVIDER = ClassName.get("dagger.internal", "Provider"); public static final ClassName DAGGER_PROVIDERS = ClassName.get("dagger.internal", "Providers"); public static final ClassName PROVIDER_OF_LAZY = diff --git a/java/dagger/internal/codegen/writing/FactoryGenerator.java b/java/dagger/internal/codegen/writing/FactoryGenerator.java index 7fee1b394b6..c60cdf30594 100644 --- a/java/dagger/internal/codegen/writing/FactoryGenerator.java +++ b/java/dagger/internal/codegen/writing/FactoryGenerator.java @@ -31,6 +31,7 @@ import static dagger.internal.codegen.javapoet.AnnotationSpecs.Suppression.RAWTYPES; import static dagger.internal.codegen.javapoet.AnnotationSpecs.Suppression.UNCHECKED; import static dagger.internal.codegen.javapoet.AnnotationSpecs.suppressWarnings; +import static dagger.internal.codegen.javapoet.CodeBlocks.makeParametersCodeBlock; import static dagger.internal.codegen.javapoet.CodeBlocks.parameterNames; import static dagger.internal.codegen.javapoet.TypeNames.factoryOf; import static dagger.internal.codegen.model.BindingKind.INJECTION; @@ -48,12 +49,14 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; import com.squareup.javapoet.AnnotationSpec; import com.squareup.javapoet.ClassName; import com.squareup.javapoet.CodeBlock; import com.squareup.javapoet.FieldSpec; import com.squareup.javapoet.MethodSpec; import com.squareup.javapoet.ParameterSpec; +import com.squareup.javapoet.ParameterizedTypeName; import com.squareup.javapoet.TypeName; import com.squareup.javapoet.TypeSpec; import dagger.internal.codegen.base.SourceFileGenerator; @@ -73,6 +76,7 @@ import dagger.internal.codegen.model.Scope; import dagger.internal.codegen.writing.InjectionMethods.InjectionSiteMethod; import dagger.internal.codegen.writing.InjectionMethods.ProvisionMethod; +import java.util.List; import java.util.Optional; import java.util.stream.Stream; import javax.inject.Inject; @@ -135,7 +139,7 @@ private TypeSpec.Builder factoryBuilder(ContributionBinding binding) { return factoryBuilder .addMethod(getMethod(binding, factoryFields)) - .addMethod(staticCreateMethod(binding, factoryFields)) + .addMethods(staticCreateMethod(binding, factoryFields)) .addMethod(staticProvisionMethod(binding)); } @@ -193,10 +197,12 @@ private MethodSpec constructorMethod(FactoryFields factoryFields) { // Provider bazProvider) { // return new FooModule_ProvidesFooFactory(module, barProvider, bazProvider); // } - private MethodSpec staticCreateMethod(ContributionBinding binding, FactoryFields factoryFields) { + private ImmutableList staticCreateMethod( + ContributionBinding binding, FactoryFields factoryFields) { // We use a static create method so that generated components can avoid having to refer to the // generic types of the factory. (Otherwise they may have visibility problems referring to the // types.) + ImmutableList.Builder methodsBuilder = ImmutableList.builder(); MethodSpec.Builder createMethodBuilder = methodBuilder("create") .addModifiers(PUBLIC, STATIC) @@ -219,8 +225,32 @@ private MethodSpec staticCreateMethod(ContributionBinding binding, FactoryFields "return new $T($L)", parameterizedGeneratedTypeNameForBinding(binding), parameterNames(parameters)); + // If any of the parameters take a Dagger Provider type, we also need to make a + // Javax Provider type for backwards compatibility with components generated at + // an older version. + // Eventually, we will need to remove this and break backwards compatibility + // in order to fully cut the Javax dependency. + if (hasDaggerProviderParams(parameters)) { + methodsBuilder.add(javaxCreateMethod(binding, parameters)); + } } - return createMethodBuilder.build(); + methodsBuilder.add(createMethodBuilder.build()); + return methodsBuilder.build(); + } + + private MethodSpec javaxCreateMethod( + ContributionBinding binding, ImmutableList parameters) { + ImmutableList remappedParams = remapParamsToJavaxProvider(parameters); + return methodBuilder("create") + .addModifiers(PUBLIC, STATIC) + .returns(parameterizedGeneratedTypeNameForBinding(binding)) + .addTypeVariables(bindingTypeElementTypeVariableNames(binding)) + .addParameters(remappedParams) + .addStatement( + "return new $T($L)", + parameterizedGeneratedTypeNameForBinding(binding), + wrappedParametersCodeBlock(remappedParams)) + .build(); } // Example 1: Provision binding. @@ -379,6 +409,54 @@ private static Optional factoryTypeName(ContributionBinding binding) { : Optional.of(factoryOf(providedTypeName(binding))); } + // Open for sharing with ProducerFactoryGenerator and MembersInjectorGenerator + static boolean hasDaggerProviderParams(List params) { + return params.stream().anyMatch(param -> isDaggerProviderType(param.type)); + } + + // Open for sharing with ProducerFactoryGenerator and MembersInjectorGenerator + // Returns a code block that represents a parameter list where any javax Provider + // types are wrapped in an asDaggerProvider call + static CodeBlock wrappedParametersCodeBlock(List params) { + return makeParametersCodeBlock( + Lists.transform( + params, + input -> + isProviderType(input.type) + ? CodeBlock.of( + "$T.asDaggerProvider($N)", TypeNames.DAGGER_PROVIDERS, input) + : CodeBlock.of("$N", input))); + } + + // Open for sharing with ProducerFactoryGenerator and MembersInjectorGenerator + static ImmutableList remapParamsToJavaxProvider(List params) { + return params.stream() + .map(param -> ParameterSpec.builder( + remapDaggerProviderToProvider(param.type), param.name).build()) + .collect(toImmutableList()); + } + + private static boolean isDaggerProviderType(TypeName type) { + return type instanceof ParameterizedTypeName + && ((ParameterizedTypeName) type).rawType.equals(TypeNames.DAGGER_PROVIDER); + } + + private static boolean isProviderType(TypeName type) { + return type instanceof ParameterizedTypeName + && ((ParameterizedTypeName) type).rawType.equals(TypeNames.PROVIDER); + } + + private static TypeName remapDaggerProviderToProvider(TypeName type) { + if (type instanceof ParameterizedTypeName) { + ParameterizedTypeName parameterizedTypeName = (ParameterizedTypeName) type; + if (parameterizedTypeName.rawType.equals(TypeNames.DAGGER_PROVIDER)) { + return ParameterizedTypeName.get( + TypeNames.PROVIDER, parameterizedTypeName.typeArguments.toArray(new TypeName[0])); + } + } + return type; + } + /** Represents the available fields in the generated factory class. */ private static final class FactoryFields { static FactoryFields create(ContributionBinding binding) { diff --git a/java/dagger/internal/codegen/writing/MembersInjectorGenerator.java b/java/dagger/internal/codegen/writing/MembersInjectorGenerator.java index d019ba43f8d..b2d841a8f50 100644 --- a/java/dagger/internal/codegen/writing/MembersInjectorGenerator.java +++ b/java/dagger/internal/codegen/writing/MembersInjectorGenerator.java @@ -33,6 +33,9 @@ import static dagger.internal.codegen.javapoet.TypeNames.membersInjectorOf; import static dagger.internal.codegen.javapoet.TypeNames.rawTypeName; import static dagger.internal.codegen.langmodel.Accessibility.isTypeAccessibleFrom; +import static dagger.internal.codegen.writing.FactoryGenerator.hasDaggerProviderParams; +import static dagger.internal.codegen.writing.FactoryGenerator.remapParamsToJavaxProvider; +import static dagger.internal.codegen.writing.FactoryGenerator.wrappedParametersCodeBlock; import static dagger.internal.codegen.writing.GwtCompatibility.gwtIncompatibleAnnotation; import static javax.lang.model.element.Modifier.FINAL; import static javax.lang.model.element.Modifier.PRIVATE; @@ -64,6 +67,7 @@ import dagger.internal.codegen.model.DependencyRequest; import dagger.internal.codegen.model.Key; import dagger.internal.codegen.writing.InjectionMethods.InjectionSiteMethod; +import java.util.List; import javax.inject.Inject; /** @@ -106,7 +110,7 @@ public ImmutableList topLevelTypes(MembersInjectionBinding bin .addSuperinterface(membersInjectorOf(binding.key().type().xprocessing().getTypeName())) .addFields(frameworkFields.values()) .addMethod(constructor(frameworkFields)) - .addMethod(createMethod(binding, frameworkFields)) + .addMethods(createMethod(binding, frameworkFields)) .addMethod(injectMembersMethod(binding, frameworkFields)) .addMethods( binding.injectionSites().stream() @@ -159,22 +163,42 @@ private MethodSpec constructor(ImmutableMap framew // @SuppressWarnings("RAW_TYPE") Provider dep3Provider) { // return new MyClass_MembersInjector(dep1Provider, dep2Provider, dep3Provider); // } - private MethodSpec createMethod( + private ImmutableList createMethod( MembersInjectionBinding binding, ImmutableMap frameworkFields) { - MethodSpec constructor = constructor(frameworkFields); + ImmutableList.Builder methodsBuilder = ImmutableList.builder(); + List params = constructor(frameworkFields).parameters; // We use a static create method so that generated components can avoid having // to refer to the generic types of the factory. // (Otherwise they may have visibility problems referring to the types.) + methodsBuilder.add(methodBuilder("create") + .addModifiers(PUBLIC, STATIC) + .addTypeVariables(bindingTypeElementTypeVariableNames(binding)) + .returns(membersInjectorOf(binding.key().type().xprocessing().getTypeName())) + .addParameters(params) + .addStatement( + "return new $T($L)", + parameterizedGeneratedTypeNameForBinding(binding), + parameterNames(params)) + .build()); + if (hasDaggerProviderParams(params)) { + methodsBuilder.add(javaxCreateMethod(binding, params)); + } + return methodsBuilder.build(); + } + + private MethodSpec javaxCreateMethod( + MembersInjectionBinding binding, List params) { + ImmutableList remappedParams = remapParamsToJavaxProvider(params); return methodBuilder("create") .addModifiers(PUBLIC, STATIC) .addTypeVariables(bindingTypeElementTypeVariableNames(binding)) .returns(membersInjectorOf(binding.key().type().xprocessing().getTypeName())) - .addParameters(constructor.parameters) + .addParameters(remappedParams) .addStatement( "return new $T($L)", parameterizedGeneratedTypeNameForBinding(binding), - parameterNames(constructor.parameters)) + wrappedParametersCodeBlock(remappedParams)) .build(); } diff --git a/java/dagger/internal/codegen/writing/ProducerFactoryGenerator.java b/java/dagger/internal/codegen/writing/ProducerFactoryGenerator.java index 12a13676074..85cc5b06baa 100644 --- a/java/dagger/internal/codegen/writing/ProducerFactoryGenerator.java +++ b/java/dagger/internal/codegen/writing/ProducerFactoryGenerator.java @@ -39,6 +39,9 @@ import static dagger.internal.codegen.javapoet.TypeNames.listOf; import static dagger.internal.codegen.javapoet.TypeNames.listenableFutureOf; import static dagger.internal.codegen.javapoet.TypeNames.producedOf; +import static dagger.internal.codegen.writing.FactoryGenerator.hasDaggerProviderParams; +import static dagger.internal.codegen.writing.FactoryGenerator.remapParamsToJavaxProvider; +import static dagger.internal.codegen.writing.FactoryGenerator.wrappedParametersCodeBlock; import static dagger.internal.codegen.writing.GwtCompatibility.gwtIncompatibleAnnotation; import static dagger.internal.codegen.xprocessing.XElements.asMethod; import static dagger.internal.codegen.xprocessing.XElements.getSimpleName; @@ -76,6 +79,7 @@ import dagger.internal.codegen.javapoet.TypeNames; import dagger.internal.codegen.model.DependencyRequest; import dagger.internal.codegen.model.RequestKind; +import java.util.List; import java.util.Optional; import javax.inject.Inject; @@ -125,7 +129,7 @@ public ImmutableList topLevelTypes(ProductionBinding binding) .filter(field -> !field.equals(factoryFields.monitorField)) .collect(toImmutableList())) .addMethod(constructorMethod(binding, factoryFields)) - .addMethod(staticCreateMethod(binding, factoryFields)) + .addMethods(staticCreateMethod(binding, factoryFields)) .addMethod(collectDependenciesMethod(binding, factoryFields)) .addMethod(callProducesMethod(binding, factoryFields)); @@ -185,17 +189,42 @@ private MethodSpec constructorMethod(ProductionBinding binding, FactoryFields fa // return new FooModule_ProducesFooFactory( // module, executorProvider, productionComponentMonitorProvider, fooProducer, barProducer); // } - private MethodSpec staticCreateMethod(ProductionBinding binding, FactoryFields factoryFields) { - MethodSpec constructor = constructorMethod(binding, factoryFields); + private ImmutableList staticCreateMethod( + ProductionBinding binding, FactoryFields factoryFields) { + ImmutableList.Builder methodsBuilder = ImmutableList.builder(); + List params = constructorMethod(binding, factoryFields).parameters; + methodsBuilder.add(MethodSpec.methodBuilder("create") + .addModifiers(PUBLIC, STATIC) + .returns(parameterizedGeneratedTypeNameForBinding(binding)) + .addTypeVariables(bindingTypeElementTypeVariableNames(binding)) + .addParameters(params) + .addStatement( + "return new $T($L)", + parameterizedGeneratedTypeNameForBinding(binding), + parameterNames(params)) + .build()); + // If any of the parameters take a Dagger Provider type, we also need to make a + // Javax Provider type for backwards compatibility with components generated at + // an older version. + // Eventually, we will need to remove this and break backwards compatibility + // in order to fully cut the Javax dependency. + if (hasDaggerProviderParams(params)) { + methodsBuilder.add(javaxCreateMethod(binding, params)); + } + return methodsBuilder.build(); + } + + private MethodSpec javaxCreateMethod(ProductionBinding binding, List params) { + ImmutableList remappedParams = remapParamsToJavaxProvider(params); return MethodSpec.methodBuilder("create") .addModifiers(PUBLIC, STATIC) .returns(parameterizedGeneratedTypeNameForBinding(binding)) .addTypeVariables(bindingTypeElementTypeVariableNames(binding)) - .addParameters(constructor.parameters) + .addParameters(remappedParams) .addStatement( "return new $T($L)", parameterizedGeneratedTypeNameForBinding(binding), - parameterNames(constructor.parameters)) + wrappedParametersCodeBlock(remappedParams)) .build(); } diff --git a/javatests/dagger/functional/jakarta/BUILD b/javatests/dagger/functional/jakarta/BUILD index 9feb5e20928..8d98d86d7d7 100644 --- a/javatests/dagger/functional/jakarta/BUILD +++ b/javatests/dagger/functional/jakarta/BUILD @@ -32,3 +32,16 @@ GenJavaTests( "@maven//:jakarta_inject_jakarta_inject_api", ], ) + +GenJavaTests( + name = "JakartaProviderTest", + srcs = ["JakartaProviderTest.java"], + javacopts = DOCLINT_HTML_AND_SYNTAX, + deps = [ + "//:dagger_with_compiler", + "//third_party/java/guava/base", + "//third_party/java/junit", + "//third_party/java/truth", + "@maven//:jakarta_inject_jakarta_inject_api", + ], +) diff --git a/javatests/dagger/functional/jakarta/JakartaProviderTest.java b/javatests/dagger/functional/jakarta/JakartaProviderTest.java new file mode 100644 index 00000000000..0c228619fb3 --- /dev/null +++ b/javatests/dagger/functional/jakarta/JakartaProviderTest.java @@ -0,0 +1,228 @@ +/* + * Copyright (C) 2024 The Dagger Authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package dagger.functional.jakarta; + +import static com.google.common.truth.Truth.assertThat; + +import com.google.common.base.Optional; +import dagger.Binds; +import dagger.BindsOptionalOf; +import dagger.Component; +import dagger.Lazy; +import dagger.Module; +import dagger.Provides; +import dagger.multibindings.IntoMap; +import dagger.multibindings.StringKey; +import jakarta.inject.Inject; +import jakarta.inject.Provider; +import jakarta.inject.Qualifier; +import jakarta.inject.Scope; +import java.util.HashMap; +import java.util.Map; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +@RunWith(JUnit4.class) +public final class JakartaProviderTest { + + @Scope + public @interface TestScope {} + + @Qualifier + public @interface TestQualifier {} + + @TestScope + @Component(modules = TestModule.class) + interface TestComponent { + Provider getJakartaFoo(); + + javax.inject.Provider getJavaxFoo(); + + Provider getJakartaBar(); + + javax.inject.Provider getJavaxBar(); + + @TestQualifier + Provider getJakartaQualifiedFoo(); + + @TestQualifier + javax.inject.Provider getJavaxQualifiedFoo(); + + @TestQualifier + Provider getJakartaQualifiedBar(); + + @TestQualifier + javax.inject.Provider getJavaxQualifiedBar(); + + InjectUsages injectUsages(); + + Map> getJakartaProviderMap(); + + Map> getJavaxProviderMap(); + + Map>> getJakartaProviderLazyMap(); + + Map>> getJavaxProviderLazyMap(); + + Map> getManuallyProvidedJakartaMap(); + + Map> getManuallyProvidedJavaxMap(); + + Optional> getPresentOptionalJakartaProvider(); + + Optional> getPresentOptionalJavaxProvider(); + + Optional> getEmptyOptionalJakartaProvider(); + + Optional> getEmptyOptionalJavaxProvider(); + } + + public static final class Foo { + @Inject + Foo() {} + } + + @TestScope + public static final class Bar { + @Inject + Bar() {} + } + + public static final class InjectUsages { + Provider jakartaBar; + Provider jakartaQualifiedBar; + javax.inject.Provider javaxQualifiedBar; + + @Inject + InjectUsages(Provider jakartaBar) { + this.jakartaBar = jakartaBar; + } + + @Inject javax.inject.Provider javaxBar; + + @Inject + void injectBar( + Provider jakartaQualifiedBar, javax.inject.Provider javaxQualifiedBar) { + this.jakartaQualifiedBar = jakartaQualifiedBar; + this.javaxQualifiedBar = javaxQualifiedBar; + } + } + + @Module + abstract static class TestModule { + @Provides + @TestQualifier + static Foo provideFoo( + Provider fooProvider, javax.inject.Provider unusedOtherFooProvider) { + return fooProvider.get(); + } + + @Provides + @TestQualifier + @TestScope + static Bar provideBar( + Provider unusedBarProvider, javax.inject.Provider otherBarProvider) { + // Use the other one in this case just to vary it from Foo + return otherBarProvider.get(); + } + + @Binds + @IntoMap + @StringKey("bar") + abstract Bar bindBarIntoMap(Bar bar); + + // TODO(b/65118638): Use @Binds @IntoMap Lazy once that works properly. + @Provides + @IntoMap + @StringKey("bar") + static Lazy provideLazyIntoMap(Lazy bar) { + return bar; + } + + // Manually provide two Provider maps to make sure they don't conflict. + @Provides + static Map> manuallyProvidedJakartaMap() { + Map> map = new HashMap<>(); + map.put(9L, null); + return map; + } + + @Provides + static Map> manuallyProvidedJavaxMap() { + Map> map = new HashMap<>(); + map.put(0L, null); + return map; + } + + @BindsOptionalOf + abstract String bindOptionalString(); + + @Provides + static String provideString() { + return "present"; + } + + @BindsOptionalOf + abstract Long bindOptionalLong(); + } + + @Test + public void testJakartaProviders() { + TestComponent testComponent = DaggerJakartaProviderTest_TestComponent.create(); + + assertThat(testComponent.getJakartaFoo().get()).isNotNull(); + assertThat(testComponent.getJavaxFoo().get()).isNotNull(); + + assertThat(testComponent.getJakartaBar().get()) + .isSameInstanceAs(testComponent.getJavaxBar().get()); + + assertThat(testComponent.getJakartaQualifiedFoo().get()).isNotNull(); + assertThat(testComponent.getJavaxQualifiedFoo().get()).isNotNull(); + + assertThat(testComponent.getJakartaQualifiedBar().get()) + .isSameInstanceAs(testComponent.getJavaxQualifiedBar().get()); + assertThat(testComponent.getJakartaBar().get()) + .isSameInstanceAs(testComponent.getJakartaQualifiedBar().get()); + + InjectUsages injectUsages = testComponent.injectUsages(); + + assertThat(injectUsages.jakartaBar.get()).isSameInstanceAs(injectUsages.javaxBar.get()); + assertThat(injectUsages.jakartaQualifiedBar.get()) + .isSameInstanceAs(injectUsages.javaxQualifiedBar.get()); + assertThat(injectUsages.jakartaBar.get()) + .isSameInstanceAs(injectUsages.jakartaQualifiedBar.get()); + + assertThat(testComponent.getJakartaProviderMap().get("bar").get()).isSameInstanceAs( + testComponent.getJavaxProviderMap().get("bar").get()); + + assertThat(testComponent.getJakartaProviderLazyMap().get("bar").get().get()).isSameInstanceAs( + testComponent.getJavaxProviderLazyMap().get("bar").get().get()); + + Map> manualJakartaMap = testComponent.getManuallyProvidedJakartaMap(); + assertThat(manualJakartaMap.keySet()).containsExactly(9L); + + Map> manualJavaxMap = + testComponent.getManuallyProvidedJavaxMap(); + assertThat(manualJavaxMap.keySet()).containsExactly(0L); + + assertThat(testComponent.getPresentOptionalJakartaProvider().get().get()).isEqualTo("present"); + assertThat(testComponent.getPresentOptionalJavaxProvider().get().get()).isEqualTo("present"); + assertThat(testComponent.getEmptyOptionalJakartaProvider().isPresent()).isFalse(); + assertThat(testComponent.getEmptyOptionalJavaxProvider().isPresent()).isFalse(); + } +} diff --git a/javatests/dagger/internal/codegen/ModuleFactoryGeneratorTest.java b/javatests/dagger/internal/codegen/ModuleFactoryGeneratorTest.java index 0d7d2f02c15..d315b77e0d3 100644 --- a/javatests/dagger/internal/codegen/ModuleFactoryGeneratorTest.java +++ b/javatests/dagger/internal/codegen/ModuleFactoryGeneratorTest.java @@ -71,6 +71,12 @@ public void providesMethodReturnsProvider() { .hasError("@Provides methods must not return framework types"); } + @Test + public void providesMethodReturnsJakartaProvider() { + assertThatModuleMethod("@Provides jakarta.inject.Provider provideProvider() {}") + .hasError("@Provides methods must not return framework types"); + } + @Test public void providesMethodReturnsLazy() { assertThatModuleMethod("@Provides Lazy provideLazy() {}") diff --git a/javatests/dagger/internal/codegen/goldens/AssistedFactoryTest_testFactoryGeneratorDuplicatedParamNames_DEFAULT_MODE_test.Foo_Factory b/javatests/dagger/internal/codegen/goldens/AssistedFactoryTest_testFactoryGeneratorDuplicatedParamNames_DEFAULT_MODE_test.Foo_Factory index a6334be8c91..23c6cff4820 100644 --- a/javatests/dagger/internal/codegen/goldens/AssistedFactoryTest_testFactoryGeneratorDuplicatedParamNames_DEFAULT_MODE_test.Foo_Factory +++ b/javatests/dagger/internal/codegen/goldens/AssistedFactoryTest_testFactoryGeneratorDuplicatedParamNames_DEFAULT_MODE_test.Foo_Factory @@ -1,10 +1,11 @@ package test; import dagger.internal.DaggerGenerated; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import dagger.internal.ScopeMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @ScopeMetadata @QualifierMetadata @@ -33,6 +34,10 @@ public final class Foo_Factory { return newInstance(argProvider.get(), argProvider2); } + public static Foo_Factory create(javax.inject.Provider argProvider) { + return new Foo_Factory(Providers.asDaggerProvider(argProvider)); + } + public static Foo_Factory create(Provider argProvider) { return new Foo_Factory(argProvider); } diff --git a/javatests/dagger/internal/codegen/goldens/AssistedFactoryTest_testFactoryGeneratorDuplicatedParamNames_FAST_INIT_MODE_test.Foo_Factory b/javatests/dagger/internal/codegen/goldens/AssistedFactoryTest_testFactoryGeneratorDuplicatedParamNames_FAST_INIT_MODE_test.Foo_Factory index a6334be8c91..23c6cff4820 100644 --- a/javatests/dagger/internal/codegen/goldens/AssistedFactoryTest_testFactoryGeneratorDuplicatedParamNames_FAST_INIT_MODE_test.Foo_Factory +++ b/javatests/dagger/internal/codegen/goldens/AssistedFactoryTest_testFactoryGeneratorDuplicatedParamNames_FAST_INIT_MODE_test.Foo_Factory @@ -1,10 +1,11 @@ package test; import dagger.internal.DaggerGenerated; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import dagger.internal.ScopeMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @ScopeMetadata @QualifierMetadata @@ -33,6 +34,10 @@ public final class Foo_Factory { return newInstance(argProvider.get(), argProvider2); } + public static Foo_Factory create(javax.inject.Provider argProvider) { + return new Foo_Factory(Providers.asDaggerProvider(argProvider)); + } + public static Foo_Factory create(Provider argProvider) { return new Foo_Factory(argProvider); } diff --git a/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_basicNameCollision_test.InjectConstructor_Factory b/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_basicNameCollision_test.InjectConstructor_Factory index d0df5cf9950..fc46a0b04fc 100644 --- a/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_basicNameCollision_test.InjectConstructor_Factory +++ b/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_basicNameCollision_test.InjectConstructor_Factory @@ -2,10 +2,11 @@ package test; import dagger.internal.DaggerGenerated; import dagger.internal.Factory; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import dagger.internal.ScopeMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @ScopeMetadata @QualifierMetadata @@ -35,6 +36,11 @@ public final class InjectConstructor_Factory implements Factory factoryProvider) { + return new InjectConstructor_Factory(Providers.asDaggerProvider(factoryProvider)); + } + public static InjectConstructor_Factory create(Provider factoryProvider) { return new InjectConstructor_Factory(factoryProvider); } diff --git a/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_boundedGenerics_test.GenericClass_Factory b/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_boundedGenerics_test.GenericClass_Factory index 4048e80d177..85f3cee312a 100644 --- a/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_boundedGenerics_test.GenericClass_Factory +++ b/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_boundedGenerics_test.GenericClass_Factory @@ -2,11 +2,12 @@ package test; import dagger.internal.DaggerGenerated; import dagger.internal.Factory; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import dagger.internal.ScopeMetadata; import java.util.List; import javax.annotation.processing.Generated; -import javax.inject.Provider; @ScopeMetadata @QualifierMetadata @@ -42,6 +43,12 @@ public final class GenericClass_Factory, B exte return newInstance(aProvider.get(), bProvider.get(), cProvider.get()); } + public static , B extends List, C extends List> GenericClass_Factory create( + javax.inject.Provider aProvider, javax.inject.Provider bProvider, + javax.inject.Provider cProvider) { + return new GenericClass_Factory(Providers.asDaggerProvider(aProvider), Providers.asDaggerProvider(bProvider), Providers.asDaggerProvider(cProvider)); + } + public static , B extends List, C extends List> GenericClass_Factory create( Provider aProvider, Provider bProvider, Provider cProvider) { return new GenericClass_Factory(aProvider, bProvider, cProvider); diff --git a/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_fieldAndMethodGenerics_test.GenericClass_Factory b/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_fieldAndMethodGenerics_test.GenericClass_Factory index de01bb36d27..6e1e620e4a0 100644 --- a/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_fieldAndMethodGenerics_test.GenericClass_Factory +++ b/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_fieldAndMethodGenerics_test.GenericClass_Factory @@ -2,10 +2,11 @@ package test; import dagger.internal.DaggerGenerated; import dagger.internal.Factory; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import dagger.internal.ScopeMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @ScopeMetadata @QualifierMetadata @@ -41,6 +42,11 @@ public final class GenericClass_Factory implements Factory GenericClass_Factory create(javax.inject.Provider aProvider, + javax.inject.Provider bProvider) { + return new GenericClass_Factory(Providers.asDaggerProvider(aProvider), Providers.asDaggerProvider(bProvider)); + } + public static GenericClass_Factory create(Provider aProvider, Provider bProvider) { return new GenericClass_Factory(aProvider, bProvider); diff --git a/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_injectConstructorAndMembersInjection_test.AllInjections_Factory b/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_injectConstructorAndMembersInjection_test.AllInjections_Factory index e1a43ccf943..1558b853521 100644 --- a/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_injectConstructorAndMembersInjection_test.AllInjections_Factory +++ b/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_injectConstructorAndMembersInjection_test.AllInjections_Factory @@ -2,10 +2,11 @@ package test; import dagger.internal.DaggerGenerated; import dagger.internal.Factory; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import dagger.internal.ScopeMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @ScopeMetadata @QualifierMetadata @@ -45,6 +46,11 @@ public final class AllInjections_Factory implements Factory { return instance; } + public static AllInjections_Factory create(javax.inject.Provider sProvider, + javax.inject.Provider sProvider2, javax.inject.Provider sProvider3) { + return new AllInjections_Factory(Providers.asDaggerProvider(sProvider), Providers.asDaggerProvider(sProvider2), Providers.asDaggerProvider(sProvider3)); + } + public static AllInjections_Factory create(Provider sProvider, Provider sProvider2, Provider sProvider3) { return new AllInjections_Factory(sProvider, sProvider2, sProvider3); diff --git a/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_injectConstructorOnGenericClass_test.GenericClass_Factory b/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_injectConstructorOnGenericClass_test.GenericClass_Factory index 79c4577b3de..bc48f594da2 100644 --- a/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_injectConstructorOnGenericClass_test.GenericClass_Factory +++ b/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_injectConstructorOnGenericClass_test.GenericClass_Factory @@ -2,10 +2,11 @@ package test; import dagger.internal.DaggerGenerated; import dagger.internal.Factory; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import dagger.internal.ScopeMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @ScopeMetadata @QualifierMetadata @@ -35,6 +36,10 @@ public final class GenericClass_Factory implements Factory> { return newInstance(tProvider.get()); } + public static GenericClass_Factory create(javax.inject.Provider tProvider) { + return new GenericClass_Factory(Providers.asDaggerProvider(tProvider)); + } + public static GenericClass_Factory create(Provider tProvider) { return new GenericClass_Factory(tProvider); } diff --git a/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_injectConstructor_test.InjectConstructor_Factory b/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_injectConstructor_test.InjectConstructor_Factory index c098e0cfcd0..8368ed387ee 100644 --- a/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_injectConstructor_test.InjectConstructor_Factory +++ b/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_injectConstructor_test.InjectConstructor_Factory @@ -2,10 +2,11 @@ package test; import dagger.internal.DaggerGenerated; import dagger.internal.Factory; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import dagger.internal.ScopeMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @ScopeMetadata @QualifierMetadata @@ -35,6 +36,10 @@ public final class InjectConstructor_Factory implements Factory sProvider) { + return new InjectConstructor_Factory(Providers.asDaggerProvider(sProvider)); + } + public static InjectConstructor_Factory create(Provider sProvider) { return new InjectConstructor_Factory(sProvider); } diff --git a/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_multipleSameTypesWithGenericsAndQualifiersAndLazies_test.GenericClass_Factory b/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_multipleSameTypesWithGenericsAndQualifiersAndLazies_test.GenericClass_Factory index 83065518720..687848e9cdc 100644 --- a/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_multipleSameTypesWithGenericsAndQualifiersAndLazies_test.GenericClass_Factory +++ b/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_multipleSameTypesWithGenericsAndQualifiersAndLazies_test.GenericClass_Factory @@ -4,10 +4,11 @@ import dagger.Lazy; import dagger.internal.DaggerGenerated; import dagger.internal.DoubleCheck; import dagger.internal.Factory; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import dagger.internal.ScopeMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @ScopeMetadata @QualifierMetadata("test.QualifierA") @@ -83,6 +84,17 @@ public final class GenericClass_Factory implements Factory GenericClass_Factory create(javax.inject.Provider aProvider, + javax.inject.Provider a2Provider, javax.inject.Provider paProvider, + javax.inject.Provider qaProvider, javax.inject.Provider laProvider, + javax.inject.Provider sProvider, javax.inject.Provider s2Provider, + javax.inject.Provider psProvider, javax.inject.Provider qsProvider, + javax.inject.Provider lsProvider, javax.inject.Provider bProvider, + javax.inject.Provider b2Provider, javax.inject.Provider pbProvider, + javax.inject.Provider qbProvider, javax.inject.Provider lbProvider) { + return new GenericClass_Factory(Providers.asDaggerProvider(aProvider), Providers.asDaggerProvider(a2Provider), Providers.asDaggerProvider(paProvider), Providers.asDaggerProvider(qaProvider), Providers.asDaggerProvider(laProvider), Providers.asDaggerProvider(sProvider), Providers.asDaggerProvider(s2Provider), Providers.asDaggerProvider(psProvider), Providers.asDaggerProvider(qsProvider), Providers.asDaggerProvider(lsProvider), Providers.asDaggerProvider(bProvider), Providers.asDaggerProvider(b2Provider), Providers.asDaggerProvider(pbProvider), Providers.asDaggerProvider(qbProvider), Providers.asDaggerProvider(lbProvider)); + } + public static GenericClass_Factory create(Provider aProvider, Provider a2Provider, Provider paProvider, Provider qaProvider, Provider laProvider, Provider sProvider, Provider s2Provider, @@ -92,9 +104,9 @@ public final class GenericClass_Factory implements Factory(aProvider, a2Provider, paProvider, qaProvider, laProvider, sProvider, s2Provider, psProvider, qsProvider, lsProvider, bProvider, b2Provider, pbProvider, qbProvider, lbProvider); } - public static GenericClass newInstance(A a, A a2, Provider pa, A qa, Lazy la, - String s, String s2, Provider ps, String qs, Lazy ls, B b, B b2, - Provider pb, B qb, Lazy lb) { + public static GenericClass newInstance(A a, A a2, javax.inject.Provider pa, A qa, + Lazy la, String s, String s2, javax.inject.Provider ps, String qs, Lazy ls, + B b, B b2, javax.inject.Provider pb, B qb, Lazy lb) { return new GenericClass(a, a2, pa, qa, la, s, s2, ps, qs, ls, b, b2, pb, qb, lb); } } diff --git a/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_nestedNameCollision_test.InjectConstructor_Factory b/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_nestedNameCollision_test.InjectConstructor_Factory index 96bfae2521c..0615073419f 100644 --- a/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_nestedNameCollision_test.InjectConstructor_Factory +++ b/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_nestedNameCollision_test.InjectConstructor_Factory @@ -2,10 +2,11 @@ package test; import dagger.internal.DaggerGenerated; import dagger.internal.Factory; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import dagger.internal.ScopeMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; import other.pkg.Outer; @ScopeMetadata @@ -36,6 +37,11 @@ public final class InjectConstructor_Factory implements Factory factoryProvider) { + return new InjectConstructor_Factory(Providers.asDaggerProvider(factoryProvider)); + } + public static InjectConstructor_Factory create(Provider factoryProvider) { return new InjectConstructor_Factory(factoryProvider); } diff --git a/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_samePackageNameCollision_test.InjectConstructor_Factory b/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_samePackageNameCollision_test.InjectConstructor_Factory index e53fd1d2cd2..232767471d0 100644 --- a/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_samePackageNameCollision_test.InjectConstructor_Factory +++ b/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_samePackageNameCollision_test.InjectConstructor_Factory @@ -2,10 +2,11 @@ package test; import dagger.internal.DaggerGenerated; import dagger.internal.Factory; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import dagger.internal.ScopeMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @ScopeMetadata @QualifierMetadata @@ -39,6 +40,12 @@ public final class InjectConstructor_Factory implements Factory otherPackageProvider, + javax.inject.Provider samePackageProvider) { + return new InjectConstructor_Factory(Providers.asDaggerProvider(otherPackageProvider), Providers.asDaggerProvider(samePackageProvider)); + } + public static InjectConstructor_Factory create( Provider otherPackageProvider, Provider samePackageProvider) { diff --git a/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_testBaseClassQualifierMetadata_test.FooBase_Factory b/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_testBaseClassQualifierMetadata_test.FooBase_Factory index ca033b93f30..7771f5fb372 100644 --- a/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_testBaseClassQualifierMetadata_test.FooBase_Factory +++ b/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_testBaseClassQualifierMetadata_test.FooBase_Factory @@ -2,10 +2,11 @@ package test; import dagger.internal.DaggerGenerated; import dagger.internal.Factory; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import dagger.internal.ScopeMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @ScopeMetadata @QualifierMetadata("test.FooBaseConstructorQualifier") @@ -45,6 +46,11 @@ public final class FooBase_Factory implements Factory { return instance; } + public static FooBase_Factory create(javax.inject.Provider iProvider, + javax.inject.Provider injectFieldProvider, javax.inject.Provider fProvider) { + return new FooBase_Factory(Providers.asDaggerProvider(iProvider), Providers.asDaggerProvider(injectFieldProvider), Providers.asDaggerProvider(fProvider)); + } + public static FooBase_Factory create(Provider iProvider, Provider injectFieldProvider, Provider fProvider) { return new FooBase_Factory(iProvider, injectFieldProvider, fProvider); diff --git a/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_testBaseClassQualifierMetadata_test.FooBase_MembersInjector b/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_testBaseClassQualifierMetadata_test.FooBase_MembersInjector index c1603696397..be0404b162b 100644 --- a/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_testBaseClassQualifierMetadata_test.FooBase_MembersInjector +++ b/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_testBaseClassQualifierMetadata_test.FooBase_MembersInjector @@ -3,9 +3,10 @@ package test; import dagger.MembersInjector; import dagger.internal.DaggerGenerated; import dagger.internal.InjectedFieldSignature; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @QualifierMetadata({ "test.FooBaseFieldQualifier", @@ -40,6 +41,11 @@ public final class FooBase_MembersInjector implements MembersInjector { return new FooBase_MembersInjector(injectFieldProvider, fProvider); } + public static MembersInjector create(javax.inject.Provider injectFieldProvider, + javax.inject.Provider fProvider) { + return new FooBase_MembersInjector(Providers.asDaggerProvider(injectFieldProvider), Providers.asDaggerProvider(fProvider)); + } + @Override public void injectMembers(FooBase instance) { injectInjectField(instance, injectFieldProvider.get()); diff --git a/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_testBaseClassQualifierMetadata_test.Foo_Factory b/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_testBaseClassQualifierMetadata_test.Foo_Factory index 2cadc8ebba5..7b4c1d6cd75 100644 --- a/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_testBaseClassQualifierMetadata_test.Foo_Factory +++ b/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_testBaseClassQualifierMetadata_test.Foo_Factory @@ -2,10 +2,11 @@ package test; import dagger.internal.DaggerGenerated; import dagger.internal.Factory; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import dagger.internal.ScopeMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @ScopeMetadata @QualifierMetadata("test.FooConstructorQualifier") @@ -49,6 +50,12 @@ public final class Foo_Factory implements Factory { return instance; } + public static Foo_Factory create(javax.inject.Provider iProvider, + javax.inject.Provider injectFieldProvider, + javax.inject.Provider injectFieldProvider2, javax.inject.Provider fProvider) { + return new Foo_Factory(Providers.asDaggerProvider(iProvider), Providers.asDaggerProvider(injectFieldProvider), Providers.asDaggerProvider(injectFieldProvider2), Providers.asDaggerProvider(fProvider)); + } + public static Foo_Factory create(Provider iProvider, Provider injectFieldProvider, Provider injectFieldProvider2, Provider fProvider) { diff --git a/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_testBaseClassQualifierMetadata_test.Foo_MembersInjector b/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_testBaseClassQualifierMetadata_test.Foo_MembersInjector index bb14c238d2d..535237023d0 100644 --- a/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_testBaseClassQualifierMetadata_test.Foo_MembersInjector +++ b/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_testBaseClassQualifierMetadata_test.Foo_MembersInjector @@ -3,9 +3,10 @@ package test; import dagger.MembersInjector; import dagger.internal.DaggerGenerated; import dagger.internal.InjectedFieldSignature; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @QualifierMetadata({ "test.FooFieldQualifier", @@ -44,6 +45,11 @@ public final class Foo_MembersInjector implements MembersInjector { return new Foo_MembersInjector(injectFieldProvider, injectFieldProvider2, fProvider); } + public static MembersInjector create(javax.inject.Provider injectFieldProvider, + javax.inject.Provider injectFieldProvider2, javax.inject.Provider fProvider) { + return new Foo_MembersInjector(Providers.asDaggerProvider(injectFieldProvider), Providers.asDaggerProvider(injectFieldProvider2), Providers.asDaggerProvider(fProvider)); + } + @Override public void injectMembers(Foo instance) { FooBase_MembersInjector.injectInjectField(instance, injectFieldProvider.get()); diff --git a/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_testComplexQualifierMetadata_test.SomeBinding_Factory b/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_testComplexQualifierMetadata_test.SomeBinding_Factory index d03eefbf27a..4d0c7344182 100644 --- a/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_testComplexQualifierMetadata_test.SomeBinding_Factory +++ b/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_testComplexQualifierMetadata_test.SomeBinding_Factory @@ -2,10 +2,11 @@ package test; import dagger.internal.DaggerGenerated; import dagger.internal.Factory; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import dagger.internal.ScopeMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @ScopeMetadata @QualifierMetadata({ @@ -51,6 +52,12 @@ public final class SomeBinding_Factory implements Factory { return instance; } + public static SomeBinding_Factory create(javax.inject.Provider str1Provider, + javax.inject.Provider str2Provider, javax.inject.Provider injectFieldProvider, + javax.inject.Provider fProvider) { + return new SomeBinding_Factory(Providers.asDaggerProvider(str1Provider), Providers.asDaggerProvider(str2Provider), Providers.asDaggerProvider(injectFieldProvider), Providers.asDaggerProvider(fProvider)); + } + public static SomeBinding_Factory create(Provider str1Provider, Provider str2Provider, Provider injectFieldProvider, Provider fProvider) { diff --git a/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_testComplexQualifierMetadata_test.SomeBinding_MembersInjector b/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_testComplexQualifierMetadata_test.SomeBinding_MembersInjector index a828b6a54fc..63ba30fbdf1 100644 --- a/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_testComplexQualifierMetadata_test.SomeBinding_MembersInjector +++ b/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_testComplexQualifierMetadata_test.SomeBinding_MembersInjector @@ -3,9 +3,10 @@ package test; import dagger.MembersInjector; import dagger.internal.DaggerGenerated; import dagger.internal.InjectedFieldSignature; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @QualifierMetadata({ "test.QualifierWithValue", @@ -41,6 +42,11 @@ public final class SomeBinding_MembersInjector implements MembersInjector create( + javax.inject.Provider injectFieldProvider, javax.inject.Provider fProvider) { + return new SomeBinding_MembersInjector(Providers.asDaggerProvider(injectFieldProvider), Providers.asDaggerProvider(fProvider)); + } + @Override public void injectMembers(SomeBinding instance) { injectInjectField(instance, injectFieldProvider.get()); diff --git a/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_testQualifierMetadata_test.SomeBinding_Factory b/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_testQualifierMetadata_test.SomeBinding_Factory index d0fcf4668e8..441131f24ff 100644 --- a/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_testQualifierMetadata_test.SomeBinding_Factory +++ b/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_testQualifierMetadata_test.SomeBinding_Factory @@ -2,10 +2,11 @@ package test; import dagger.internal.DaggerGenerated; import dagger.internal.Factory; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import dagger.internal.ScopeMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @ScopeMetadata @QualifierMetadata("test.ConstructorParameterQualifier") @@ -45,6 +46,11 @@ public final class SomeBinding_Factory implements Factory { return instance; } + public static SomeBinding_Factory create(javax.inject.Provider dProvider, + javax.inject.Provider injectFieldProvider, javax.inject.Provider fProvider) { + return new SomeBinding_Factory(Providers.asDaggerProvider(dProvider), Providers.asDaggerProvider(injectFieldProvider), Providers.asDaggerProvider(fProvider)); + } + public static SomeBinding_Factory create(Provider dProvider, Provider injectFieldProvider, Provider fProvider) { return new SomeBinding_Factory(dProvider, injectFieldProvider, fProvider); diff --git a/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_testQualifierMetadata_test.SomeBinding_MembersInjector b/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_testQualifierMetadata_test.SomeBinding_MembersInjector index 9f13bcd3bb0..aa147195de0 100644 --- a/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_testQualifierMetadata_test.SomeBinding_MembersInjector +++ b/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_testQualifierMetadata_test.SomeBinding_MembersInjector @@ -3,9 +3,10 @@ package test; import dagger.MembersInjector; import dagger.internal.DaggerGenerated; import dagger.internal.InjectedFieldSignature; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @QualifierMetadata({ "test.FieldQualifier", @@ -41,6 +42,11 @@ public final class SomeBinding_MembersInjector implements MembersInjector create( + javax.inject.Provider injectFieldProvider, javax.inject.Provider fProvider) { + return new SomeBinding_MembersInjector(Providers.asDaggerProvider(injectFieldProvider), Providers.asDaggerProvider(fProvider)); + } + @Override public void injectMembers(SomeBinding instance) { injectInjectField(instance, injectFieldProvider.get()); diff --git a/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_twoGenericTypes_test.GenericClass_Factory b/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_twoGenericTypes_test.GenericClass_Factory index 8de6b8f119b..9c722dc91b3 100644 --- a/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_twoGenericTypes_test.GenericClass_Factory +++ b/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_twoGenericTypes_test.GenericClass_Factory @@ -2,10 +2,11 @@ package test; import dagger.internal.DaggerGenerated; import dagger.internal.Factory; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import dagger.internal.ScopeMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @ScopeMetadata @QualifierMetadata @@ -38,6 +39,11 @@ public final class GenericClass_Factory implements Factory GenericClass_Factory create(javax.inject.Provider aProvider, + javax.inject.Provider bProvider) { + return new GenericClass_Factory(Providers.asDaggerProvider(aProvider), Providers.asDaggerProvider(bProvider)); + } + public static GenericClass_Factory create(Provider aProvider, Provider bProvider) { return new GenericClass_Factory(aProvider, bProvider); diff --git a/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_wildcardDependency_test.InjectConstructor_Factory b/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_wildcardDependency_test.InjectConstructor_Factory index 8b28db6c4b7..bdafd5f34b0 100644 --- a/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_wildcardDependency_test.InjectConstructor_Factory +++ b/javatests/dagger/internal/codegen/goldens/InjectConstructorFactoryGeneratorTest_wildcardDependency_test.InjectConstructor_Factory @@ -2,11 +2,12 @@ package test; import dagger.internal.DaggerGenerated; import dagger.internal.Factory; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import dagger.internal.ScopeMetadata; import java.util.List; import javax.annotation.processing.Generated; -import javax.inject.Provider; @ScopeMetadata @QualifierMetadata @@ -36,6 +37,10 @@ public final class InjectConstructor_Factory implements Factory> objectsProvider) { + return new InjectConstructor_Factory(Providers.asDaggerProvider(objectsProvider)); + } + public static InjectConstructor_Factory create(Provider> objectsProvider) { return new InjectConstructor_Factory(objectsProvider); } diff --git a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_accessibility_DEFAULT_MODE_other.Inaccessible_MembersInjector b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_accessibility_DEFAULT_MODE_other.Inaccessible_MembersInjector index b2c7b237e57..f051e2a7edd 100644 --- a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_accessibility_DEFAULT_MODE_other.Inaccessible_MembersInjector +++ b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_accessibility_DEFAULT_MODE_other.Inaccessible_MembersInjector @@ -3,9 +3,10 @@ package other; import dagger.MembersInjector; import dagger.internal.DaggerGenerated; import dagger.internal.InjectedFieldSignature; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @QualifierMetadata @DaggerGenerated @@ -37,6 +38,11 @@ public final class Inaccessible_MembersInjector implements MembersInjector create(javax.inject.Provider fooProvider, + javax.inject.Provider fooProvider2) { + return new Inaccessible_MembersInjector(Providers.asDaggerProvider(fooProvider), Providers.asDaggerProvider(fooProvider2)); + } + @Override public void injectMembers(Inaccessible instance) { injectFoo(instance, fooProvider.get()); diff --git a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_accessibility_FAST_INIT_MODE_other.Inaccessible_MembersInjector b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_accessibility_FAST_INIT_MODE_other.Inaccessible_MembersInjector index b2c7b237e57..f051e2a7edd 100644 --- a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_accessibility_FAST_INIT_MODE_other.Inaccessible_MembersInjector +++ b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_accessibility_FAST_INIT_MODE_other.Inaccessible_MembersInjector @@ -3,9 +3,10 @@ package other; import dagger.MembersInjector; import dagger.internal.DaggerGenerated; import dagger.internal.InjectedFieldSignature; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @QualifierMetadata @DaggerGenerated @@ -37,6 +38,11 @@ public final class Inaccessible_MembersInjector implements MembersInjector create(javax.inject.Provider fooProvider, + javax.inject.Provider fooProvider2) { + return new Inaccessible_MembersInjector(Providers.asDaggerProvider(fooProvider), Providers.asDaggerProvider(fooProvider2)); + } + @Override public void injectMembers(Inaccessible instance) { injectFoo(instance, fooProvider.get()); diff --git a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_componentWithNestingAndGeneratedType_DEFAULT_MODE_test.OuterType_B_MembersInjector b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_componentWithNestingAndGeneratedType_DEFAULT_MODE_test.OuterType_B_MembersInjector index 8b18ba9ebcd..d2b3141ff5b 100644 --- a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_componentWithNestingAndGeneratedType_DEFAULT_MODE_test.OuterType_B_MembersInjector +++ b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_componentWithNestingAndGeneratedType_DEFAULT_MODE_test.OuterType_B_MembersInjector @@ -3,9 +3,10 @@ package test; import dagger.MembersInjector; import dagger.internal.DaggerGenerated; import dagger.internal.InjectedFieldSignature; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @QualifierMetadata @DaggerGenerated @@ -33,6 +34,10 @@ public final class OuterType_B_MembersInjector implements MembersInjector create(javax.inject.Provider aProvider) { + return new OuterType_B_MembersInjector(Providers.asDaggerProvider(aProvider)); + } + @Override public void injectMembers(OuterType.B instance) { injectA(instance, aProvider.get()); diff --git a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_componentWithNestingAndGeneratedType_FAST_INIT_MODE_test.OuterType_B_MembersInjector b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_componentWithNestingAndGeneratedType_FAST_INIT_MODE_test.OuterType_B_MembersInjector index 8b18ba9ebcd..d2b3141ff5b 100644 --- a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_componentWithNestingAndGeneratedType_FAST_INIT_MODE_test.OuterType_B_MembersInjector +++ b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_componentWithNestingAndGeneratedType_FAST_INIT_MODE_test.OuterType_B_MembersInjector @@ -3,9 +3,10 @@ package test; import dagger.MembersInjector; import dagger.internal.DaggerGenerated; import dagger.internal.InjectedFieldSignature; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @QualifierMetadata @DaggerGenerated @@ -33,6 +34,10 @@ public final class OuterType_B_MembersInjector implements MembersInjector create(javax.inject.Provider aProvider) { + return new OuterType_B_MembersInjector(Providers.asDaggerProvider(aProvider)); + } + @Override public void injectMembers(OuterType.B instance) { injectA(instance, aProvider.get()); diff --git a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_fieldAndMethodGenerics_DEFAULT_MODE_test.GenericClass_MembersInjector b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_fieldAndMethodGenerics_DEFAULT_MODE_test.GenericClass_MembersInjector index 5d22e0dc60c..5c1efb9cacb 100644 --- a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_fieldAndMethodGenerics_DEFAULT_MODE_test.GenericClass_MembersInjector +++ b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_fieldAndMethodGenerics_DEFAULT_MODE_test.GenericClass_MembersInjector @@ -3,9 +3,10 @@ package test; import dagger.MembersInjector; import dagger.internal.DaggerGenerated; import dagger.internal.InjectedFieldSignature; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @QualifierMetadata @DaggerGenerated @@ -37,6 +38,11 @@ public final class GenericClass_MembersInjector implements MembersInjector return new GenericClass_MembersInjector(aProvider, bProvider); } + public static MembersInjector> create( + javax.inject.Provider aProvider, javax.inject.Provider bProvider) { + return new GenericClass_MembersInjector(Providers.asDaggerProvider(aProvider), Providers.asDaggerProvider(bProvider)); + } + @Override public void injectMembers(GenericClass instance) { injectA(instance, aProvider.get()); diff --git a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_fieldAndMethodGenerics_FAST_INIT_MODE_test.GenericClass_MembersInjector b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_fieldAndMethodGenerics_FAST_INIT_MODE_test.GenericClass_MembersInjector index 5d22e0dc60c..5c1efb9cacb 100644 --- a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_fieldAndMethodGenerics_FAST_INIT_MODE_test.GenericClass_MembersInjector +++ b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_fieldAndMethodGenerics_FAST_INIT_MODE_test.GenericClass_MembersInjector @@ -3,9 +3,10 @@ package test; import dagger.MembersInjector; import dagger.internal.DaggerGenerated; import dagger.internal.InjectedFieldSignature; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @QualifierMetadata @DaggerGenerated @@ -37,6 +38,11 @@ public final class GenericClass_MembersInjector implements MembersInjector return new GenericClass_MembersInjector(aProvider, bProvider); } + public static MembersInjector> create( + javax.inject.Provider aProvider, javax.inject.Provider bProvider) { + return new GenericClass_MembersInjector(Providers.asDaggerProvider(aProvider), Providers.asDaggerProvider(bProvider)); + } + @Override public void injectMembers(GenericClass instance) { injectA(instance, aProvider.get()); diff --git a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_fieldInjectionForShadowedMember_DEFAULT_MODE_test.Child_MembersInjector b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_fieldInjectionForShadowedMember_DEFAULT_MODE_test.Child_MembersInjector index bd139a67da9..abd124678f1 100644 --- a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_fieldInjectionForShadowedMember_DEFAULT_MODE_test.Child_MembersInjector +++ b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_fieldInjectionForShadowedMember_DEFAULT_MODE_test.Child_MembersInjector @@ -3,9 +3,10 @@ package test; import dagger.MembersInjector; import dagger.internal.DaggerGenerated; import dagger.internal.InjectedFieldSignature; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @QualifierMetadata @DaggerGenerated @@ -37,6 +38,11 @@ public final class Child_MembersInjector implements MembersInjector { return new Child_MembersInjector(objectProvider, objectProvider2); } + public static MembersInjector create(javax.inject.Provider objectProvider, + javax.inject.Provider objectProvider2) { + return new Child_MembersInjector(Providers.asDaggerProvider(objectProvider), Providers.asDaggerProvider(objectProvider2)); + } + @Override public void injectMembers(Child instance) { Parent_MembersInjector.injectObject(instance, objectProvider.get()); diff --git a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_fieldInjectionForShadowedMember_FAST_INIT_MODE_test.Child_MembersInjector b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_fieldInjectionForShadowedMember_FAST_INIT_MODE_test.Child_MembersInjector index bd139a67da9..abd124678f1 100644 --- a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_fieldInjectionForShadowedMember_FAST_INIT_MODE_test.Child_MembersInjector +++ b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_fieldInjectionForShadowedMember_FAST_INIT_MODE_test.Child_MembersInjector @@ -3,9 +3,10 @@ package test; import dagger.MembersInjector; import dagger.internal.DaggerGenerated; import dagger.internal.InjectedFieldSignature; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @QualifierMetadata @DaggerGenerated @@ -37,6 +38,11 @@ public final class Child_MembersInjector implements MembersInjector { return new Child_MembersInjector(objectProvider, objectProvider2); } + public static MembersInjector create(javax.inject.Provider objectProvider, + javax.inject.Provider objectProvider2) { + return new Child_MembersInjector(Providers.asDaggerProvider(objectProvider), Providers.asDaggerProvider(objectProvider2)); + } + @Override public void injectMembers(Child instance) { Parent_MembersInjector.injectObject(instance, objectProvider.get()); diff --git a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_fieldInjectionWithQualifier_DEFAULT_MODE_test.FieldInjectionWithQualifier_MembersInjector b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_fieldInjectionWithQualifier_DEFAULT_MODE_test.FieldInjectionWithQualifier_MembersInjector index 0762e06c10c..e5f27451234 100644 --- a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_fieldInjectionWithQualifier_DEFAULT_MODE_test.FieldInjectionWithQualifier_MembersInjector +++ b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_fieldInjectionWithQualifier_DEFAULT_MODE_test.FieldInjectionWithQualifier_MembersInjector @@ -3,10 +3,11 @@ package test; import dagger.MembersInjector; import dagger.internal.DaggerGenerated; import dagger.internal.InjectedFieldSignature; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import javax.annotation.processing.Generated; import javax.inject.Named; -import javax.inject.Provider; @QualifierMetadata("javax.inject.Named") @DaggerGenerated @@ -39,6 +40,11 @@ public final class FieldInjectionWithQualifier_MembersInjector implements Member return new FieldInjectionWithQualifier_MembersInjector(aProvider, bProvider); } + public static MembersInjector create( + javax.inject.Provider aProvider, javax.inject.Provider bProvider) { + return new FieldInjectionWithQualifier_MembersInjector(Providers.asDaggerProvider(aProvider), Providers.asDaggerProvider(bProvider)); + } + @Override public void injectMembers(FieldInjectionWithQualifier instance) { injectA(instance, aProvider.get()); diff --git a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_fieldInjectionWithQualifier_FAST_INIT_MODE_test.FieldInjectionWithQualifier_MembersInjector b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_fieldInjectionWithQualifier_FAST_INIT_MODE_test.FieldInjectionWithQualifier_MembersInjector index 0762e06c10c..e5f27451234 100644 --- a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_fieldInjectionWithQualifier_FAST_INIT_MODE_test.FieldInjectionWithQualifier_MembersInjector +++ b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_fieldInjectionWithQualifier_FAST_INIT_MODE_test.FieldInjectionWithQualifier_MembersInjector @@ -3,10 +3,11 @@ package test; import dagger.MembersInjector; import dagger.internal.DaggerGenerated; import dagger.internal.InjectedFieldSignature; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import javax.annotation.processing.Generated; import javax.inject.Named; -import javax.inject.Provider; @QualifierMetadata("javax.inject.Named") @DaggerGenerated @@ -39,6 +40,11 @@ public final class FieldInjectionWithQualifier_MembersInjector implements Member return new FieldInjectionWithQualifier_MembersInjector(aProvider, bProvider); } + public static MembersInjector create( + javax.inject.Provider aProvider, javax.inject.Provider bProvider) { + return new FieldInjectionWithQualifier_MembersInjector(Providers.asDaggerProvider(aProvider), Providers.asDaggerProvider(bProvider)); + } + @Override public void injectMembers(FieldInjectionWithQualifier instance) { injectA(instance, aProvider.get()); diff --git a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_fieldInjection_DEFAULT_MODE_test.FieldInjection_MembersInjector b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_fieldInjection_DEFAULT_MODE_test.FieldInjection_MembersInjector index d8608e209cb..ebb9deb99c6 100644 --- a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_fieldInjection_DEFAULT_MODE_test.FieldInjection_MembersInjector +++ b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_fieldInjection_DEFAULT_MODE_test.FieldInjection_MembersInjector @@ -5,9 +5,10 @@ import dagger.MembersInjector; import dagger.internal.DaggerGenerated; import dagger.internal.DoubleCheck; import dagger.internal.InjectedFieldSignature; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @QualifierMetadata @DaggerGenerated @@ -43,6 +44,12 @@ public final class FieldInjection_MembersInjector implements MembersInjector create(javax.inject.Provider stringProvider, + javax.inject.Provider stringProvider2, + javax.inject.Provider stringProvider3) { + return new FieldInjection_MembersInjector(Providers.asDaggerProvider(stringProvider), Providers.asDaggerProvider(stringProvider2), Providers.asDaggerProvider(stringProvider3)); + } + @Override public void injectMembers(FieldInjection instance) { injectString(instance, stringProvider.get()); @@ -61,7 +68,8 @@ public final class FieldInjection_MembersInjector implements MembersInjector stringProvider) { + public static void injectStringProvider(Object instance, + javax.inject.Provider stringProvider) { ((FieldInjection) instance).stringProvider = stringProvider; } } diff --git a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_fieldInjection_FAST_INIT_MODE_test.FieldInjection_MembersInjector b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_fieldInjection_FAST_INIT_MODE_test.FieldInjection_MembersInjector index d8608e209cb..ebb9deb99c6 100644 --- a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_fieldInjection_FAST_INIT_MODE_test.FieldInjection_MembersInjector +++ b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_fieldInjection_FAST_INIT_MODE_test.FieldInjection_MembersInjector @@ -5,9 +5,10 @@ import dagger.MembersInjector; import dagger.internal.DaggerGenerated; import dagger.internal.DoubleCheck; import dagger.internal.InjectedFieldSignature; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @QualifierMetadata @DaggerGenerated @@ -43,6 +44,12 @@ public final class FieldInjection_MembersInjector implements MembersInjector create(javax.inject.Provider stringProvider, + javax.inject.Provider stringProvider2, + javax.inject.Provider stringProvider3) { + return new FieldInjection_MembersInjector(Providers.asDaggerProvider(stringProvider), Providers.asDaggerProvider(stringProvider2), Providers.asDaggerProvider(stringProvider3)); + } + @Override public void injectMembers(FieldInjection instance) { injectString(instance, stringProvider.get()); @@ -61,7 +68,8 @@ public final class FieldInjection_MembersInjector implements MembersInjector stringProvider) { + public static void injectStringProvider(Object instance, + javax.inject.Provider stringProvider) { ((FieldInjection) instance).stringProvider = stringProvider; } } diff --git a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_injectConstructorAndMembersInjection_DEFAULT_MODE_test.AllInjections_MembersInjector b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_injectConstructorAndMembersInjection_DEFAULT_MODE_test.AllInjections_MembersInjector index 4988b540ef4..34fcdd49191 100644 --- a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_injectConstructorAndMembersInjection_DEFAULT_MODE_test.AllInjections_MembersInjector +++ b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_injectConstructorAndMembersInjection_DEFAULT_MODE_test.AllInjections_MembersInjector @@ -3,9 +3,10 @@ package test; import dagger.MembersInjector; import dagger.internal.DaggerGenerated; import dagger.internal.InjectedFieldSignature; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @QualifierMetadata @DaggerGenerated @@ -37,6 +38,11 @@ public final class AllInjections_MembersInjector implements MembersInjector create(javax.inject.Provider sProvider, + javax.inject.Provider sProvider2) { + return new AllInjections_MembersInjector(Providers.asDaggerProvider(sProvider), Providers.asDaggerProvider(sProvider2)); + } + @Override public void injectMembers(AllInjections instance) { injectS(instance, sProvider.get()); diff --git a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_injectConstructorAndMembersInjection_FAST_INIT_MODE_test.AllInjections_MembersInjector b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_injectConstructorAndMembersInjection_FAST_INIT_MODE_test.AllInjections_MembersInjector index 4988b540ef4..34fcdd49191 100644 --- a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_injectConstructorAndMembersInjection_FAST_INIT_MODE_test.AllInjections_MembersInjector +++ b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_injectConstructorAndMembersInjection_FAST_INIT_MODE_test.AllInjections_MembersInjector @@ -3,9 +3,10 @@ package test; import dagger.MembersInjector; import dagger.internal.DaggerGenerated; import dagger.internal.InjectedFieldSignature; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @QualifierMetadata @DaggerGenerated @@ -37,6 +38,11 @@ public final class AllInjections_MembersInjector implements MembersInjector create(javax.inject.Provider sProvider, + javax.inject.Provider sProvider2) { + return new AllInjections_MembersInjector(Providers.asDaggerProvider(sProvider), Providers.asDaggerProvider(sProvider2)); + } + @Override public void injectMembers(AllInjections instance) { injectS(instance, sProvider.get()); diff --git a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_injectsPrimitive_DEFAULT_MODE_test.InjectedType_Factory b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_injectsPrimitive_DEFAULT_MODE_test.InjectedType_Factory index a9a98e70a7b..458ce48c79b 100644 --- a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_injectsPrimitive_DEFAULT_MODE_test.InjectedType_Factory +++ b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_injectsPrimitive_DEFAULT_MODE_test.InjectedType_Factory @@ -2,10 +2,11 @@ package test; import dagger.internal.DaggerGenerated; import dagger.internal.Factory; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import dagger.internal.ScopeMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @ScopeMetadata @QualifierMetadata @@ -42,6 +43,11 @@ public final class InjectedType_Factory implements Factory { return instance; } + public static InjectedType_Factory create(javax.inject.Provider primitiveIntProvider, + javax.inject.Provider boxedIntProvider) { + return new InjectedType_Factory(Providers.asDaggerProvider(primitiveIntProvider), Providers.asDaggerProvider(boxedIntProvider)); + } + public static InjectedType_Factory create(Provider primitiveIntProvider, Provider boxedIntProvider) { return new InjectedType_Factory(primitiveIntProvider, boxedIntProvider); diff --git a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_injectsPrimitive_DEFAULT_MODE_test.InjectedType_MembersInjector b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_injectsPrimitive_DEFAULT_MODE_test.InjectedType_MembersInjector index 03a049cf968..cc58fd53c3c 100644 --- a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_injectsPrimitive_DEFAULT_MODE_test.InjectedType_MembersInjector +++ b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_injectsPrimitive_DEFAULT_MODE_test.InjectedType_MembersInjector @@ -3,9 +3,10 @@ package test; import dagger.MembersInjector; import dagger.internal.DaggerGenerated; import dagger.internal.InjectedFieldSignature; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @QualifierMetadata @DaggerGenerated @@ -38,6 +39,12 @@ public final class InjectedType_MembersInjector implements MembersInjector create( + javax.inject.Provider primitiveIntProvider, + javax.inject.Provider boxedIntProvider) { + return new InjectedType_MembersInjector(Providers.asDaggerProvider(primitiveIntProvider), Providers.asDaggerProvider(boxedIntProvider)); + } + @Override public void injectMembers(InjectedType instance) { injectPrimitiveInt(instance, primitiveIntProvider.get()); diff --git a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_injectsPrimitive_FAST_INIT_MODE_test.InjectedType_Factory b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_injectsPrimitive_FAST_INIT_MODE_test.InjectedType_Factory index a9a98e70a7b..458ce48c79b 100644 --- a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_injectsPrimitive_FAST_INIT_MODE_test.InjectedType_Factory +++ b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_injectsPrimitive_FAST_INIT_MODE_test.InjectedType_Factory @@ -2,10 +2,11 @@ package test; import dagger.internal.DaggerGenerated; import dagger.internal.Factory; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import dagger.internal.ScopeMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @ScopeMetadata @QualifierMetadata @@ -42,6 +43,11 @@ public final class InjectedType_Factory implements Factory { return instance; } + public static InjectedType_Factory create(javax.inject.Provider primitiveIntProvider, + javax.inject.Provider boxedIntProvider) { + return new InjectedType_Factory(Providers.asDaggerProvider(primitiveIntProvider), Providers.asDaggerProvider(boxedIntProvider)); + } + public static InjectedType_Factory create(Provider primitiveIntProvider, Provider boxedIntProvider) { return new InjectedType_Factory(primitiveIntProvider, boxedIntProvider); diff --git a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_injectsPrimitive_FAST_INIT_MODE_test.InjectedType_MembersInjector b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_injectsPrimitive_FAST_INIT_MODE_test.InjectedType_MembersInjector index 03a049cf968..cc58fd53c3c 100644 --- a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_injectsPrimitive_FAST_INIT_MODE_test.InjectedType_MembersInjector +++ b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_injectsPrimitive_FAST_INIT_MODE_test.InjectedType_MembersInjector @@ -3,9 +3,10 @@ package test; import dagger.MembersInjector; import dagger.internal.DaggerGenerated; import dagger.internal.InjectedFieldSignature; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @QualifierMetadata @DaggerGenerated @@ -38,6 +39,12 @@ public final class InjectedType_MembersInjector implements MembersInjector create( + javax.inject.Provider primitiveIntProvider, + javax.inject.Provider boxedIntProvider) { + return new InjectedType_MembersInjector(Providers.asDaggerProvider(primitiveIntProvider), Providers.asDaggerProvider(boxedIntProvider)); + } + @Override public void injectMembers(InjectedType instance) { injectPrimitiveInt(instance, primitiveIntProvider.get()); diff --git a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_kotlinNullableFieldInjection_DEFAULT_MODE_test.MyClass_MembersInjector b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_kotlinNullableFieldInjection_DEFAULT_MODE_test.MyClass_MembersInjector index 5bfa6b7bdfb..17f220ae0a9 100644 --- a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_kotlinNullableFieldInjection_DEFAULT_MODE_test.MyClass_MembersInjector +++ b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_kotlinNullableFieldInjection_DEFAULT_MODE_test.MyClass_MembersInjector @@ -3,9 +3,10 @@ package test; import dagger.MembersInjector; import dagger.internal.DaggerGenerated; import dagger.internal.InjectedFieldSignature; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; import org.jetbrains.annotations.Nullable; @QualifierMetadata @@ -39,6 +40,12 @@ public final class MyClass_MembersInjector implements MembersInjector { return new MyClass_MembersInjector(nullableStringProvider, nullableObjectProvider); } + public static MembersInjector create( + javax.inject.Provider nullableStringProvider, + javax.inject.Provider nullableObjectProvider) { + return new MyClass_MembersInjector(Providers.asDaggerProvider(nullableStringProvider), Providers.asDaggerProvider(nullableObjectProvider)); + } + @Override public void injectMembers(MyClass instance) { injectNullableString(instance, nullableStringProvider.get()); @@ -55,3 +62,4 @@ public final class MyClass_MembersInjector implements MembersInjector { instance.nullableObject = nullableObject; } } + diff --git a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_kotlinNullableFieldInjection_FAST_INIT_MODE_test.MyClass_MembersInjector b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_kotlinNullableFieldInjection_FAST_INIT_MODE_test.MyClass_MembersInjector index 5bfa6b7bdfb..17f220ae0a9 100644 --- a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_kotlinNullableFieldInjection_FAST_INIT_MODE_test.MyClass_MembersInjector +++ b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_kotlinNullableFieldInjection_FAST_INIT_MODE_test.MyClass_MembersInjector @@ -3,9 +3,10 @@ package test; import dagger.MembersInjector; import dagger.internal.DaggerGenerated; import dagger.internal.InjectedFieldSignature; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; import org.jetbrains.annotations.Nullable; @QualifierMetadata @@ -39,6 +40,12 @@ public final class MyClass_MembersInjector implements MembersInjector { return new MyClass_MembersInjector(nullableStringProvider, nullableObjectProvider); } + public static MembersInjector create( + javax.inject.Provider nullableStringProvider, + javax.inject.Provider nullableObjectProvider) { + return new MyClass_MembersInjector(Providers.asDaggerProvider(nullableStringProvider), Providers.asDaggerProvider(nullableObjectProvider)); + } + @Override public void injectMembers(MyClass instance) { injectNullableString(instance, nullableStringProvider.get()); @@ -55,3 +62,4 @@ public final class MyClass_MembersInjector implements MembersInjector { instance.nullableObject = nullableObject; } } + diff --git a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_methodInjection_DEFAULT_MODE_test.MethodInjection_MembersInjector b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_methodInjection_DEFAULT_MODE_test.MethodInjection_MembersInjector index 0bbbe46c768..1b1e71f0fdb 100644 --- a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_methodInjection_DEFAULT_MODE_test.MethodInjection_MembersInjector +++ b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_methodInjection_DEFAULT_MODE_test.MethodInjection_MembersInjector @@ -4,9 +4,10 @@ import dagger.Lazy; import dagger.MembersInjector; import dagger.internal.DaggerGenerated; import dagger.internal.DoubleCheck; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @QualifierMetadata @DaggerGenerated @@ -47,6 +48,13 @@ public final class MethodInjection_MembersInjector implements MembersInjector create( + javax.inject.Provider stringProvider, javax.inject.Provider stringProvider2, + javax.inject.Provider stringProvider3, + javax.inject.Provider stringProvider4) { + return new MethodInjection_MembersInjector(Providers.asDaggerProvider(stringProvider), Providers.asDaggerProvider(stringProvider2), Providers.asDaggerProvider(stringProvider3), Providers.asDaggerProvider(stringProvider4)); + } + @Override public void injectMembers(MethodInjection instance) { injectNoArgs(instance); @@ -63,7 +71,7 @@ public final class MethodInjection_MembersInjector implements MembersInjector lazyString, - Provider stringProvider) { + javax.inject.Provider stringProvider) { ((MethodInjection) instance).manyArgs(string, lazyString, stringProvider); } } diff --git a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_methodInjection_FAST_INIT_MODE_test.MethodInjection_MembersInjector b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_methodInjection_FAST_INIT_MODE_test.MethodInjection_MembersInjector index 0bbbe46c768..1b1e71f0fdb 100644 --- a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_methodInjection_FAST_INIT_MODE_test.MethodInjection_MembersInjector +++ b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_methodInjection_FAST_INIT_MODE_test.MethodInjection_MembersInjector @@ -4,9 +4,10 @@ import dagger.Lazy; import dagger.MembersInjector; import dagger.internal.DaggerGenerated; import dagger.internal.DoubleCheck; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @QualifierMetadata @DaggerGenerated @@ -47,6 +48,13 @@ public final class MethodInjection_MembersInjector implements MembersInjector create( + javax.inject.Provider stringProvider, javax.inject.Provider stringProvider2, + javax.inject.Provider stringProvider3, + javax.inject.Provider stringProvider4) { + return new MethodInjection_MembersInjector(Providers.asDaggerProvider(stringProvider), Providers.asDaggerProvider(stringProvider2), Providers.asDaggerProvider(stringProvider3), Providers.asDaggerProvider(stringProvider4)); + } + @Override public void injectMembers(MethodInjection instance) { injectNoArgs(instance); @@ -63,7 +71,7 @@ public final class MethodInjection_MembersInjector implements MembersInjector lazyString, - Provider stringProvider) { + javax.inject.Provider stringProvider) { ((MethodInjection) instance).manyArgs(string, lazyString, stringProvider); } } diff --git a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_middleClassNoFieldInjection_DEFAULT_MODE_test.A_MembersInjector b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_middleClassNoFieldInjection_DEFAULT_MODE_test.A_MembersInjector index 6327fc5bdb8..5158593cab1 100644 --- a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_middleClassNoFieldInjection_DEFAULT_MODE_test.A_MembersInjector +++ b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_middleClassNoFieldInjection_DEFAULT_MODE_test.A_MembersInjector @@ -3,9 +3,10 @@ package test; import dagger.MembersInjector; import dagger.internal.DaggerGenerated; import dagger.internal.InjectedFieldSignature; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @QualifierMetadata @DaggerGenerated @@ -37,6 +38,11 @@ public final class A_MembersInjector implements MembersInjector { return new A_MembersInjector(valueCProvider, valueAProvider); } + public static MembersInjector create(javax.inject.Provider valueCProvider, + javax.inject.Provider valueAProvider) { + return new A_MembersInjector(Providers.asDaggerProvider(valueCProvider), Providers.asDaggerProvider(valueAProvider)); + } + @Override public void injectMembers(A instance) { C_MembersInjector.injectValueC(instance, valueCProvider.get()); diff --git a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_middleClassNoFieldInjection_DEFAULT_MODE_test.C_MembersInjector b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_middleClassNoFieldInjection_DEFAULT_MODE_test.C_MembersInjector index c24e8d84fc7..8fc09d03976 100644 --- a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_middleClassNoFieldInjection_DEFAULT_MODE_test.C_MembersInjector +++ b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_middleClassNoFieldInjection_DEFAULT_MODE_test.C_MembersInjector @@ -3,9 +3,10 @@ package test; import dagger.MembersInjector; import dagger.internal.DaggerGenerated; import dagger.internal.InjectedFieldSignature; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @QualifierMetadata @DaggerGenerated @@ -33,6 +34,10 @@ public final class C_MembersInjector implements MembersInjector { return new C_MembersInjector(valueCProvider); } + public static MembersInjector create(javax.inject.Provider valueCProvider) { + return new C_MembersInjector(Providers.asDaggerProvider(valueCProvider)); + } + @Override public void injectMembers(C instance) { injectValueC(instance, valueCProvider.get()); diff --git a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_middleClassNoFieldInjection_FAST_INIT_MODE_test.A_MembersInjector b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_middleClassNoFieldInjection_FAST_INIT_MODE_test.A_MembersInjector index 6327fc5bdb8..5158593cab1 100644 --- a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_middleClassNoFieldInjection_FAST_INIT_MODE_test.A_MembersInjector +++ b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_middleClassNoFieldInjection_FAST_INIT_MODE_test.A_MembersInjector @@ -3,9 +3,10 @@ package test; import dagger.MembersInjector; import dagger.internal.DaggerGenerated; import dagger.internal.InjectedFieldSignature; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @QualifierMetadata @DaggerGenerated @@ -37,6 +38,11 @@ public final class A_MembersInjector implements MembersInjector { return new A_MembersInjector(valueCProvider, valueAProvider); } + public static MembersInjector create(javax.inject.Provider valueCProvider, + javax.inject.Provider valueAProvider) { + return new A_MembersInjector(Providers.asDaggerProvider(valueCProvider), Providers.asDaggerProvider(valueAProvider)); + } + @Override public void injectMembers(A instance) { C_MembersInjector.injectValueC(instance, valueCProvider.get()); diff --git a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_middleClassNoFieldInjection_FAST_INIT_MODE_test.C_MembersInjector b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_middleClassNoFieldInjection_FAST_INIT_MODE_test.C_MembersInjector index c24e8d84fc7..8fc09d03976 100644 --- a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_middleClassNoFieldInjection_FAST_INIT_MODE_test.C_MembersInjector +++ b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_middleClassNoFieldInjection_FAST_INIT_MODE_test.C_MembersInjector @@ -3,9 +3,10 @@ package test; import dagger.MembersInjector; import dagger.internal.DaggerGenerated; import dagger.internal.InjectedFieldSignature; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @QualifierMetadata @DaggerGenerated @@ -33,6 +34,10 @@ public final class C_MembersInjector implements MembersInjector { return new C_MembersInjector(valueCProvider); } + public static MembersInjector create(javax.inject.Provider valueCProvider) { + return new C_MembersInjector(Providers.asDaggerProvider(valueCProvider)); + } + @Override public void injectMembers(C instance) { injectValueC(instance, valueCProvider.get()); diff --git a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_mixedMemberInjection_DEFAULT_MODE_test.MixedMemberInjection_MembersInjector b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_mixedMemberInjection_DEFAULT_MODE_test.MixedMemberInjection_MembersInjector index d4b10aec074..c968dd653f3 100644 --- a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_mixedMemberInjection_DEFAULT_MODE_test.MixedMemberInjection_MembersInjector +++ b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_mixedMemberInjection_DEFAULT_MODE_test.MixedMemberInjection_MembersInjector @@ -3,9 +3,10 @@ package test; import dagger.MembersInjector; import dagger.internal.DaggerGenerated; import dagger.internal.InjectedFieldSignature; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @QualifierMetadata @DaggerGenerated @@ -44,6 +45,12 @@ public final class MixedMemberInjection_MembersInjector implements MembersInject return new MixedMemberInjection_MembersInjector(stringProvider, objectProvider, sProvider, oProvider); } + public static MembersInjector create( + javax.inject.Provider stringProvider, javax.inject.Provider objectProvider, + javax.inject.Provider sProvider, javax.inject.Provider oProvider) { + return new MixedMemberInjection_MembersInjector(Providers.asDaggerProvider(stringProvider), Providers.asDaggerProvider(objectProvider), Providers.asDaggerProvider(sProvider), Providers.asDaggerProvider(oProvider)); + } + @Override public void injectMembers(MixedMemberInjection instance) { injectString(instance, stringProvider.get()); diff --git a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_mixedMemberInjection_FAST_INIT_MODE_test.MixedMemberInjection_MembersInjector b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_mixedMemberInjection_FAST_INIT_MODE_test.MixedMemberInjection_MembersInjector index d4b10aec074..c968dd653f3 100644 --- a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_mixedMemberInjection_FAST_INIT_MODE_test.MixedMemberInjection_MembersInjector +++ b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_mixedMemberInjection_FAST_INIT_MODE_test.MixedMemberInjection_MembersInjector @@ -3,9 +3,10 @@ package test; import dagger.MembersInjector; import dagger.internal.DaggerGenerated; import dagger.internal.InjectedFieldSignature; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @QualifierMetadata @DaggerGenerated @@ -44,6 +45,12 @@ public final class MixedMemberInjection_MembersInjector implements MembersInject return new MixedMemberInjection_MembersInjector(stringProvider, objectProvider, sProvider, oProvider); } + public static MembersInjector create( + javax.inject.Provider stringProvider, javax.inject.Provider objectProvider, + javax.inject.Provider sProvider, javax.inject.Provider oProvider) { + return new MixedMemberInjection_MembersInjector(Providers.asDaggerProvider(stringProvider), Providers.asDaggerProvider(objectProvider), Providers.asDaggerProvider(sProvider), Providers.asDaggerProvider(oProvider)); + } + @Override public void injectMembers(MixedMemberInjection instance) { injectString(instance, stringProvider.get()); diff --git a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_nonTypeUseNullableFieldInjection_DEFAULT_MODE_test.FieldInjection_MembersInjector b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_nonTypeUseNullableFieldInjection_DEFAULT_MODE_test.FieldInjection_MembersInjector index 586243bdf1c..23ab444cde2 100644 --- a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_nonTypeUseNullableFieldInjection_DEFAULT_MODE_test.FieldInjection_MembersInjector +++ b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_nonTypeUseNullableFieldInjection_DEFAULT_MODE_test.FieldInjection_MembersInjector @@ -3,9 +3,10 @@ package test; import dagger.MembersInjector; import dagger.internal.DaggerGenerated; import dagger.internal.InjectedFieldSignature; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @QualifierMetadata @DaggerGenerated @@ -33,6 +34,11 @@ public final class FieldInjection_MembersInjector implements MembersInjector create( + javax.inject.Provider stringProvider) { + return new FieldInjection_MembersInjector(Providers.asDaggerProvider(stringProvider)); + } + @Override public void injectMembers(FieldInjection instance) { injectString(instance, stringProvider.get()); @@ -43,3 +49,4 @@ public final class FieldInjection_MembersInjector implements MembersInjector create( + javax.inject.Provider stringProvider) { + return new FieldInjection_MembersInjector(Providers.asDaggerProvider(stringProvider)); + } + @Override public void injectMembers(FieldInjection instance) { injectString(instance, stringProvider.get()); @@ -43,3 +49,4 @@ public final class FieldInjection_MembersInjector implements MembersInjector create(javax.inject.Provider aProvider) { + return new OuterType_B_MembersInjector(Providers.asDaggerProvider(aProvider)); + } + @Override public void injectMembers(OuterType.B instance) { injectA(instance, aProvider.get()); diff --git a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_simpleComponentWithNesting_FAST_INIT_MODE_test.OuterType_B_MembersInjector b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_simpleComponentWithNesting_FAST_INIT_MODE_test.OuterType_B_MembersInjector index 8b18ba9ebcd..d2b3141ff5b 100644 --- a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_simpleComponentWithNesting_FAST_INIT_MODE_test.OuterType_B_MembersInjector +++ b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_simpleComponentWithNesting_FAST_INIT_MODE_test.OuterType_B_MembersInjector @@ -3,9 +3,10 @@ package test; import dagger.MembersInjector; import dagger.internal.DaggerGenerated; import dagger.internal.InjectedFieldSignature; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @QualifierMetadata @DaggerGenerated @@ -33,6 +34,10 @@ public final class OuterType_B_MembersInjector implements MembersInjector create(javax.inject.Provider aProvider) { + return new OuterType_B_MembersInjector(Providers.asDaggerProvider(aProvider)); + } + @Override public void injectMembers(OuterType.B instance) { injectA(instance, aProvider.get()); diff --git a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_subclassedGenericMembersInjectors_DEFAULT_MODE_test.Child_MembersInjector b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_subclassedGenericMembersInjectors_DEFAULT_MODE_test.Child_MembersInjector index 4920c709d44..e744215b9b2 100644 --- a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_subclassedGenericMembersInjectors_DEFAULT_MODE_test.Child_MembersInjector +++ b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_subclassedGenericMembersInjectors_DEFAULT_MODE_test.Child_MembersInjector @@ -3,9 +3,10 @@ package test; import dagger.MembersInjector; import dagger.internal.DaggerGenerated; import dagger.internal.InjectedFieldSignature; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @QualifierMetadata @DaggerGenerated @@ -47,6 +48,12 @@ public final class Child_MembersInjector implements MembersInjector> return new Child_MembersInjector(xProvider, yProvider, a2Provider, aProvider, tProvider); } + public static MembersInjector> create(javax.inject.Provider xProvider, + javax.inject.Provider yProvider, javax.inject.Provider a2Provider, + javax.inject.Provider aProvider, javax.inject.Provider tProvider) { + return new Child_MembersInjector(Providers.asDaggerProvider(xProvider), Providers.asDaggerProvider(yProvider), Providers.asDaggerProvider(a2Provider), Providers.asDaggerProvider(aProvider), Providers.asDaggerProvider(tProvider)); + } + @Override public void injectMembers(Child instance) { Parent_MembersInjector.injectX(instance, xProvider.get()); diff --git a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_subclassedGenericMembersInjectors_FAST_INIT_MODE_test.Child_MembersInjector b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_subclassedGenericMembersInjectors_FAST_INIT_MODE_test.Child_MembersInjector index 4920c709d44..e744215b9b2 100644 --- a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_subclassedGenericMembersInjectors_FAST_INIT_MODE_test.Child_MembersInjector +++ b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_subclassedGenericMembersInjectors_FAST_INIT_MODE_test.Child_MembersInjector @@ -3,9 +3,10 @@ package test; import dagger.MembersInjector; import dagger.internal.DaggerGenerated; import dagger.internal.InjectedFieldSignature; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @QualifierMetadata @DaggerGenerated @@ -47,6 +48,12 @@ public final class Child_MembersInjector implements MembersInjector> return new Child_MembersInjector(xProvider, yProvider, a2Provider, aProvider, tProvider); } + public static MembersInjector> create(javax.inject.Provider xProvider, + javax.inject.Provider yProvider, javax.inject.Provider a2Provider, + javax.inject.Provider aProvider, javax.inject.Provider tProvider) { + return new Child_MembersInjector(Providers.asDaggerProvider(xProvider), Providers.asDaggerProvider(yProvider), Providers.asDaggerProvider(a2Provider), Providers.asDaggerProvider(aProvider), Providers.asDaggerProvider(tProvider)); + } + @Override public void injectMembers(Child instance) { Parent_MembersInjector.injectX(instance, xProvider.get()); diff --git a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_supertypeMembersInjection_DEFAULT_MODE_test.B_MembersInjector b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_supertypeMembersInjection_DEFAULT_MODE_test.B_MembersInjector index dfb865dbf23..175f9d6c00d 100644 --- a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_supertypeMembersInjection_DEFAULT_MODE_test.B_MembersInjector +++ b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_supertypeMembersInjection_DEFAULT_MODE_test.B_MembersInjector @@ -3,9 +3,10 @@ package test; import dagger.MembersInjector; import dagger.internal.DaggerGenerated; import dagger.internal.InjectedFieldSignature; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @QualifierMetadata @DaggerGenerated @@ -33,6 +34,10 @@ public final class B_MembersInjector implements MembersInjector { return new B_MembersInjector(sProvider); } + public static MembersInjector create(javax.inject.Provider sProvider) { + return new B_MembersInjector(Providers.asDaggerProvider(sProvider)); + } + @Override public void injectMembers(B instance) { injectS(instance, sProvider.get()); diff --git a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_supertypeMembersInjection_FAST_INIT_MODE_test.B_MembersInjector b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_supertypeMembersInjection_FAST_INIT_MODE_test.B_MembersInjector index dfb865dbf23..175f9d6c00d 100644 --- a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_supertypeMembersInjection_FAST_INIT_MODE_test.B_MembersInjector +++ b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_supertypeMembersInjection_FAST_INIT_MODE_test.B_MembersInjector @@ -3,9 +3,10 @@ package test; import dagger.MembersInjector; import dagger.internal.DaggerGenerated; import dagger.internal.InjectedFieldSignature; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @QualifierMetadata @DaggerGenerated @@ -33,6 +34,10 @@ public final class B_MembersInjector implements MembersInjector { return new B_MembersInjector(sProvider); } + public static MembersInjector create(javax.inject.Provider sProvider) { + return new B_MembersInjector(Providers.asDaggerProvider(sProvider)); + } + @Override public void injectMembers(B instance) { injectS(instance, sProvider.get()); diff --git a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_testConstructorInjectedFieldInjection_DEFAULT_MODE_test.A_MembersInjector b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_testConstructorInjectedFieldInjection_DEFAULT_MODE_test.A_MembersInjector index e052d486fec..dafed929d09 100644 --- a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_testConstructorInjectedFieldInjection_DEFAULT_MODE_test.A_MembersInjector +++ b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_testConstructorInjectedFieldInjection_DEFAULT_MODE_test.A_MembersInjector @@ -2,9 +2,10 @@ package test; import dagger.MembersInjector; import dagger.internal.DaggerGenerated; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @QualifierMetadata @DaggerGenerated @@ -32,6 +33,10 @@ public final class A_MembersInjector implements MembersInjector { return new A_MembersInjector(valueBProvider); } + public static MembersInjector create(javax.inject.Provider valueBProvider) { + return new A_MembersInjector(Providers.asDaggerProvider(valueBProvider)); + } + @Override public void injectMembers(A instance) { B_MembersInjector.injectValueB(instance, valueBProvider.get()); diff --git a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_testConstructorInjectedFieldInjection_DEFAULT_MODE_test.B_MembersInjector b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_testConstructorInjectedFieldInjection_DEFAULT_MODE_test.B_MembersInjector index b6b3c83d0ab..e9b28880e09 100644 --- a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_testConstructorInjectedFieldInjection_DEFAULT_MODE_test.B_MembersInjector +++ b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_testConstructorInjectedFieldInjection_DEFAULT_MODE_test.B_MembersInjector @@ -3,9 +3,10 @@ package test; import dagger.MembersInjector; import dagger.internal.DaggerGenerated; import dagger.internal.InjectedFieldSignature; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @QualifierMetadata @DaggerGenerated @@ -33,6 +34,10 @@ public final class B_MembersInjector implements MembersInjector { return new B_MembersInjector(valueBProvider); } + public static MembersInjector create(javax.inject.Provider valueBProvider) { + return new B_MembersInjector(Providers.asDaggerProvider(valueBProvider)); + } + @Override public void injectMembers(B instance) { injectValueB(instance, valueBProvider.get()); diff --git a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_testConstructorInjectedFieldInjection_FAST_INIT_MODE_test.A_MembersInjector b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_testConstructorInjectedFieldInjection_FAST_INIT_MODE_test.A_MembersInjector index e052d486fec..dafed929d09 100644 --- a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_testConstructorInjectedFieldInjection_FAST_INIT_MODE_test.A_MembersInjector +++ b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_testConstructorInjectedFieldInjection_FAST_INIT_MODE_test.A_MembersInjector @@ -2,9 +2,10 @@ package test; import dagger.MembersInjector; import dagger.internal.DaggerGenerated; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @QualifierMetadata @DaggerGenerated @@ -32,6 +33,10 @@ public final class A_MembersInjector implements MembersInjector { return new A_MembersInjector(valueBProvider); } + public static MembersInjector create(javax.inject.Provider valueBProvider) { + return new A_MembersInjector(Providers.asDaggerProvider(valueBProvider)); + } + @Override public void injectMembers(A instance) { B_MembersInjector.injectValueB(instance, valueBProvider.get()); diff --git a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_testConstructorInjectedFieldInjection_FAST_INIT_MODE_test.B_MembersInjector b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_testConstructorInjectedFieldInjection_FAST_INIT_MODE_test.B_MembersInjector index b6b3c83d0ab..e9b28880e09 100644 --- a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_testConstructorInjectedFieldInjection_FAST_INIT_MODE_test.B_MembersInjector +++ b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_testConstructorInjectedFieldInjection_FAST_INIT_MODE_test.B_MembersInjector @@ -3,9 +3,10 @@ package test; import dagger.MembersInjector; import dagger.internal.DaggerGenerated; import dagger.internal.InjectedFieldSignature; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @QualifierMetadata @DaggerGenerated @@ -33,6 +34,10 @@ public final class B_MembersInjector implements MembersInjector { return new B_MembersInjector(valueBProvider); } + public static MembersInjector create(javax.inject.Provider valueBProvider) { + return new B_MembersInjector(Providers.asDaggerProvider(valueBProvider)); + } + @Override public void injectMembers(B instance) { injectValueB(instance, valueBProvider.get()); diff --git a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_typeUseNullableFieldInjection_DEFAULT_MODE_test.FieldInjection_MembersInjector b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_typeUseNullableFieldInjection_DEFAULT_MODE_test.FieldInjection_MembersInjector index 0932204a77a..ff27f6f9824 100644 --- a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_typeUseNullableFieldInjection_DEFAULT_MODE_test.FieldInjection_MembersInjector +++ b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_typeUseNullableFieldInjection_DEFAULT_MODE_test.FieldInjection_MembersInjector @@ -3,9 +3,10 @@ package test; import dagger.MembersInjector; import dagger.internal.DaggerGenerated; import dagger.internal.InjectedFieldSignature; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @QualifierMetadata @DaggerGenerated @@ -33,6 +34,11 @@ public final class FieldInjection_MembersInjector implements MembersInjector create( + javax.inject.Provider stringProvider) { + return new FieldInjection_MembersInjector(Providers.asDaggerProvider(stringProvider)); + } + @Override public void injectMembers(FieldInjection instance) { injectString(instance, stringProvider.get()); @@ -43,3 +49,4 @@ public final class FieldInjection_MembersInjector implements MembersInjector create( + javax.inject.Provider stringProvider) { + return new FieldInjection_MembersInjector(Providers.asDaggerProvider(stringProvider)); + } + @Override public void injectMembers(FieldInjection instance) { injectString(instance, stringProvider.get()); @@ -43,3 +49,4 @@ public final class FieldInjection_MembersInjector implements MembersInjector> ParentModule_ProvideBElementFactory create( + ParentModule module, javax.inject.Provider bProvider) { + return new ParentModule_ProvideBElementFactory(module, Providers.asDaggerProvider(bProvider)); + } + public static > ParentModule_ProvideBElementFactory create( ParentModule module, Provider bProvider) { return new ParentModule_ProvideBElementFactory(module, bProvider); diff --git a/javatests/dagger/internal/codegen/goldens/ModuleFactoryGeneratorTest_genericSubclassedModule_test.ParentModule_ProvideBEntryFactory b/javatests/dagger/internal/codegen/goldens/ModuleFactoryGeneratorTest_genericSubclassedModule_test.ParentModule_ProvideBEntryFactory index 2cb17f0398c..2834c396414 100644 --- a/javatests/dagger/internal/codegen/goldens/ModuleFactoryGeneratorTest_genericSubclassedModule_test.ParentModule_ProvideBEntryFactory +++ b/javatests/dagger/internal/codegen/goldens/ModuleFactoryGeneratorTest_genericSubclassedModule_test.ParentModule_ProvideBEntryFactory @@ -3,10 +3,11 @@ package test; import dagger.internal.DaggerGenerated; import dagger.internal.Factory; import dagger.internal.Preconditions; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import dagger.internal.ScopeMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @ScopeMetadata @QualifierMetadata @@ -39,6 +40,11 @@ public final class ParentModule_ProvideBEntryFactory> ParentModule_ProvideBEntryFactory create( + ParentModule module, javax.inject.Provider bProvider) { + return new ParentModule_ProvideBEntryFactory(module, Providers.asDaggerProvider(bProvider)); + } + public static > ParentModule_ProvideBEntryFactory create( ParentModule module, Provider bProvider) { return new ParentModule_ProvideBEntryFactory(module, bProvider); diff --git a/javatests/dagger/internal/codegen/goldens/ModuleFactoryGeneratorTest_genericSubclassedModule_test.ParentModule_ProvideListBFactory b/javatests/dagger/internal/codegen/goldens/ModuleFactoryGeneratorTest_genericSubclassedModule_test.ParentModule_ProvideListBFactory index b81ccadfdc6..72f948856e4 100644 --- a/javatests/dagger/internal/codegen/goldens/ModuleFactoryGeneratorTest_genericSubclassedModule_test.ParentModule_ProvideListBFactory +++ b/javatests/dagger/internal/codegen/goldens/ModuleFactoryGeneratorTest_genericSubclassedModule_test.ParentModule_ProvideListBFactory @@ -3,11 +3,12 @@ package test; import dagger.internal.DaggerGenerated; import dagger.internal.Factory; import dagger.internal.Preconditions; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import dagger.internal.ScopeMetadata; import java.util.List; import javax.annotation.processing.Generated; -import javax.inject.Provider; @ScopeMetadata @QualifierMetadata @@ -40,6 +41,11 @@ public final class ParentModule_ProvideListBFactory> ParentModule_ProvideListBFactory create( + ParentModule module, javax.inject.Provider bProvider) { + return new ParentModule_ProvideListBFactory(module, Providers.asDaggerProvider(bProvider)); + } + public static > ParentModule_ProvideListBFactory create( ParentModule module, Provider bProvider) { return new ParentModule_ProvideListBFactory(module, bProvider); diff --git a/javatests/dagger/internal/codegen/goldens/ModuleFactoryGeneratorTest_multipleProvidesMethods_test.TestModule_ProvideObjectsFactory b/javatests/dagger/internal/codegen/goldens/ModuleFactoryGeneratorTest_multipleProvidesMethods_test.TestModule_ProvideObjectsFactory index 8404200c18a..a5f7daa8b50 100644 --- a/javatests/dagger/internal/codegen/goldens/ModuleFactoryGeneratorTest_multipleProvidesMethods_test.TestModule_ProvideObjectsFactory +++ b/javatests/dagger/internal/codegen/goldens/ModuleFactoryGeneratorTest_multipleProvidesMethods_test.TestModule_ProvideObjectsFactory @@ -4,11 +4,12 @@ import dagger.MembersInjector; import dagger.internal.DaggerGenerated; import dagger.internal.Factory; import dagger.internal.Preconditions; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import dagger.internal.ScopeMetadata; import java.util.List; import javax.annotation.processing.Generated; -import javax.inject.Provider; @ScopeMetadata @QualifierMetadata({ @@ -51,6 +52,12 @@ public final class TestModule_ProvideObjectsFactory implements Factory aProvider, javax.inject.Provider bProvider, + javax.inject.Provider> xInjectorProvider) { + return new TestModule_ProvideObjectsFactory(module, Providers.asDaggerProvider(aProvider), Providers.asDaggerProvider(bProvider), Providers.asDaggerProvider(xInjectorProvider)); + } + public static TestModule_ProvideObjectsFactory create(TestModule module, Provider aProvider, Provider bProvider, Provider> xInjectorProvider) { diff --git a/javatests/dagger/internal/codegen/goldens/ModuleFactoryGeneratorTest_parameterizedModuleWithStaticProvidesMethodOfGenericType_test.ParameterizedModule_ProvideNonGenericTypeWithDepsFactory b/javatests/dagger/internal/codegen/goldens/ModuleFactoryGeneratorTest_parameterizedModuleWithStaticProvidesMethodOfGenericType_test.ParameterizedModule_ProvideNonGenericTypeWithDepsFactory index d6d19ed6bbe..f0b08735cd1 100644 --- a/javatests/dagger/internal/codegen/goldens/ModuleFactoryGeneratorTest_parameterizedModuleWithStaticProvidesMethodOfGenericType_test.ParameterizedModule_ProvideNonGenericTypeWithDepsFactory +++ b/javatests/dagger/internal/codegen/goldens/ModuleFactoryGeneratorTest_parameterizedModuleWithStaticProvidesMethodOfGenericType_test.ParameterizedModule_ProvideNonGenericTypeWithDepsFactory @@ -3,10 +3,11 @@ package test; import dagger.internal.DaggerGenerated; import dagger.internal.Factory; import dagger.internal.Preconditions; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import dagger.internal.ScopeMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @ScopeMetadata @QualifierMetadata @@ -36,6 +37,11 @@ public final class ParameterizedModule_ProvideNonGenericTypeWithDepsFactory impl return provideNonGenericTypeWithDeps(oProvider.get()); } + public static ParameterizedModule_ProvideNonGenericTypeWithDepsFactory create( + javax.inject.Provider oProvider) { + return new ParameterizedModule_ProvideNonGenericTypeWithDepsFactory(Providers.asDaggerProvider(oProvider)); + } + public static ParameterizedModule_ProvideNonGenericTypeWithDepsFactory create( Provider oProvider) { return new ParameterizedModule_ProvideNonGenericTypeWithDepsFactory(oProvider); diff --git a/javatests/dagger/internal/codegen/goldens/ModuleFactoryGeneratorTest_testQualifierMetadataOnProvides_test.MyModule_ProvideStringFactory b/javatests/dagger/internal/codegen/goldens/ModuleFactoryGeneratorTest_testQualifierMetadataOnProvides_test.MyModule_ProvideStringFactory index df1f86f9604..a7602962afd 100644 --- a/javatests/dagger/internal/codegen/goldens/ModuleFactoryGeneratorTest_testQualifierMetadataOnProvides_test.MyModule_ProvideStringFactory +++ b/javatests/dagger/internal/codegen/goldens/ModuleFactoryGeneratorTest_testQualifierMetadataOnProvides_test.MyModule_ProvideStringFactory @@ -3,10 +3,11 @@ package test; import dagger.internal.DaggerGenerated; import dagger.internal.Factory; import dagger.internal.Preconditions; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.internal.QualifierMetadata; import dagger.internal.ScopeMetadata; import javax.annotation.processing.Generated; -import javax.inject.Provider; @ScopeMetadata @QualifierMetadata({ @@ -39,6 +40,10 @@ public final class MyModule_ProvideStringFactory implements Factory { return provideString(iProvider.get()); } + public static MyModule_ProvideStringFactory create(javax.inject.Provider iProvider) { + return new MyModule_ProvideStringFactory(Providers.asDaggerProvider(iProvider)); + } + public static MyModule_ProvideStringFactory create(Provider iProvider) { return new MyModule_ProvideStringFactory(iProvider); } diff --git a/javatests/dagger/internal/codegen/goldens/ProducerModuleFactoryGeneratorTest_singleProducesMethodNoArgsFutureWithProducerName_test.TestModule_ProduceStringFactory b/javatests/dagger/internal/codegen/goldens/ProducerModuleFactoryGeneratorTest_singleProducesMethodNoArgsFutureWithProducerName_test.TestModule_ProduceStringFactory index f7037e96270..7b625c9bc3b 100644 --- a/javatests/dagger/internal/codegen/goldens/ProducerModuleFactoryGeneratorTest_singleProducesMethodNoArgsFutureWithProducerName_test.TestModule_ProduceStringFactory +++ b/javatests/dagger/internal/codegen/goldens/ProducerModuleFactoryGeneratorTest_singleProducesMethodNoArgsFutureWithProducerName_test.TestModule_ProduceStringFactory @@ -3,12 +3,13 @@ package test; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import dagger.internal.DaggerGenerated; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.producers.internal.AbstractProducesMethodProducer; import dagger.producers.monitoring.ProducerToken; import dagger.producers.monitoring.ProductionComponentMonitor; import java.util.concurrent.Executor; import javax.annotation.processing.Generated; -import javax.inject.Provider; @DaggerGenerated @Generated( @@ -40,6 +41,12 @@ public final class TestModule_ProduceStringFactory extends AbstractProducesMetho return new TestModule_ProduceStringFactory(module, executorProvider, productionComponentMonitorProvider); } + public static TestModule_ProduceStringFactory create(TestModule module, + javax.inject.Provider executorProvider, + javax.inject.Provider productionComponentMonitorProvider) { + return new TestModule_ProduceStringFactory(module, Providers.asDaggerProvider(executorProvider), Providers.asDaggerProvider(productionComponentMonitorProvider)); + } + @Override protected ListenableFuture collectDependencies() { return Futures.immediateFuture(null); diff --git a/javatests/dagger/internal/codegen/goldens/ProducerModuleFactoryGeneratorTest_singleProducesMethodNoArgsFuture_test.TestModule_ProduceStringFactory b/javatests/dagger/internal/codegen/goldens/ProducerModuleFactoryGeneratorTest_singleProducesMethodNoArgsFuture_test.TestModule_ProduceStringFactory index 283fd5363a9..3125538c14d 100644 --- a/javatests/dagger/internal/codegen/goldens/ProducerModuleFactoryGeneratorTest_singleProducesMethodNoArgsFuture_test.TestModule_ProduceStringFactory +++ b/javatests/dagger/internal/codegen/goldens/ProducerModuleFactoryGeneratorTest_singleProducesMethodNoArgsFuture_test.TestModule_ProduceStringFactory @@ -3,12 +3,13 @@ package test; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import dagger.internal.DaggerGenerated; +import dagger.internal.Provider; +import dagger.internal.Providers; import dagger.producers.internal.AbstractProducesMethodProducer; import dagger.producers.monitoring.ProducerToken; import dagger.producers.monitoring.ProductionComponentMonitor; import java.util.concurrent.Executor; import javax.annotation.processing.Generated; -import javax.inject.Provider; @DaggerGenerated @Generated( @@ -40,6 +41,12 @@ public final class TestModule_ProduceStringFactory extends AbstractProducesMetho return new TestModule_ProduceStringFactory(module, executorProvider, productionComponentMonitorProvider); } + public static TestModule_ProduceStringFactory create(TestModule module, + javax.inject.Provider executorProvider, + javax.inject.Provider productionComponentMonitorProvider) { + return new TestModule_ProduceStringFactory(module, Providers.asDaggerProvider(executorProvider), Providers.asDaggerProvider(productionComponentMonitorProvider)); + } + @Override protected ListenableFuture collectDependencies() { return Futures.immediateFuture(null);