From 763c9a4ebfa890391a71d5382684371189d32e0d Mon Sep 17 00:00:00 2001 From: Brad Corso Date: Mon, 23 Oct 2023 15:29:48 -0700 Subject: [PATCH] Removes unused (`@Deprecated`) module setter methods that contain only `static`/`abstract` binding methods. Note that this doesn't remove all of the deprecated setter methods. In particular, this CL removes setter methods only for the case where a module instance is never needed because it contains only `static` and `abstract` methods. However, this CL does not remove the deprecated setter methods in the general case where a module instance is not needed because it is unused in the component. That case is a bit trickier because it depends on the usage of the bindings rather than properties of the module itself. RELNOTES=Potentially breaking change. Dagger no longer generates module setter methods for modules that have only static/abstract methods. These methods were previously marked as deprecated, as the module instances passed in aren't actually used by the Dagger component. PiperOrigin-RevId: 575946317 --- .../processor/internal/root/RootMetadata.java | 28 +--------- .../codegen/binding/ComponentRequirement.java | 2 +- .../ComponentHjarGenerator.java | 9 ++- ...ComponentCreatorImplementationFactory.java | 6 ++ .../basic/ComponentNestedTypeTest.java | 3 +- ...UsedInGraph_DEFAULT_MODE_test.DaggerParent | 10 ---- ...edInGraph_FAST_INIT_MODE_test.DaggerParent | 10 ---- ...Deps_DEFAULT_MODE_test.DaggerTestComponent | 55 ------------------- ...ps_FAST_INIT_MODE_test.DaggerTestComponent | 55 ------------------- ...tComponents_DEFAULT_MODE_test.DaggerParent | 10 ---- ...omponents_FAST_INIT_MODE_test.DaggerParent | 10 ---- ...Type_DEFAULT_MODE_test.DaggerTestComponent | 11 ---- ...pe_FAST_INIT_MODE_test.DaggerTestComponent | 11 ---- ...EFAULT_JAVA7_MODE_test.DaggerTestComponent | 10 ---- ...ings_DEFAULT_MODE_test.DaggerTestComponent | 10 ---- ...T_INIT_JAVA7_MODE_test.DaggerTestComponent | 10 ---- ...gs_FAST_INIT_MODE_test.DaggerTestComponent | 10 ---- ...EFAULT_JAVA7_MODE_test.DaggerTestComponent | 10 ---- ...ture_DEFAULT_MODE_test.DaggerTestComponent | 10 ---- ...T_INIT_JAVA7_MODE_test.DaggerTestComponent | 10 ---- ...re_FAST_INIT_MODE_test.DaggerTestComponent | 10 ---- ...ings_DEFAULT_MODE_test.DaggerTestComponent | 10 ---- ...gs_FAST_INIT_MODE_test.DaggerTestComponent | 10 ---- ...ings_DEFAULT_MODE_test.DaggerTestComponent | 10 ---- ...gs_FAST_INIT_MODE_test.DaggerTestComponent | 10 ---- ...ings_DEFAULT_MODE_test.DaggerTestComponent | 10 ---- ...gs_FAST_INIT_MODE_test.DaggerTestComponent | 10 ---- ...tedBindings_DEFAULT_MODE_test.DaggerParent | 10 ---- ...dBindings_FAST_INIT_MODE_test.DaggerParent | 10 ---- 29 files changed, 18 insertions(+), 362 deletions(-) diff --git a/java/dagger/hilt/processor/internal/root/RootMetadata.java b/java/dagger/hilt/processor/internal/root/RootMetadata.java index 20858d6d8ef..55f6e9c4ee9 100644 --- a/java/dagger/hilt/processor/internal/root/RootMetadata.java +++ b/java/dagger/hilt/processor/internal/root/RootMetadata.java @@ -21,7 +21,6 @@ import static dagger.internal.codegen.extension.DaggerStreams.toImmutableSet; import androidx.room.compiler.processing.XConstructorElement; -import androidx.room.compiler.processing.XMethodElement; import androidx.room.compiler.processing.XProcessingEnv; import androidx.room.compiler.processing.XTypeElement; import com.google.common.base.Supplier; @@ -196,33 +195,10 @@ private ImmutableSetMultimap getScopesByComponentUncached( } private static boolean daggerCanConstruct(XTypeElement type) { - if (type.isKotlinObject()) { - // Treat Kotlin object modules as if Dagger can construct them (it technically can't, but it - // doesn't need to as it can use them since all their provision methods are static). + if (!Processors.requiresModuleInstance(type)) { return true; } - - return !isInnerClass(type) - && !hasNonDaggerAbstractMethod(type) - && (hasOnlyStaticProvides(type) || hasVisibleEmptyConstructor(type)); - } - - private static boolean isInnerClass(XTypeElement type) { - return type.isNested() && !type.isStatic(); - } - - private static boolean hasNonDaggerAbstractMethod(XTypeElement type) { - // TODO(erichang): Actually this isn't really supported b/28989613 - return type.getDeclaredMethods().stream() - .filter(XMethodElement::isAbstract) - .anyMatch(method -> !Processors.hasDaggerAbstractMethodAnnotation(method)); - } - - private static boolean hasOnlyStaticProvides(XTypeElement type) { - // TODO(erichang): Check for @Produces too when we have a producers story - return type.getDeclaredMethods().stream() - .filter(method -> method.hasAnnotation(ClassNames.PROVIDES)) - .allMatch(XMethodElement::isStatic); + return hasVisibleEmptyConstructor(type) && (!type.isNested() || type.isStatic()); } private static boolean hasVisibleEmptyConstructor(XTypeElement type) { diff --git a/java/dagger/internal/codegen/binding/ComponentRequirement.java b/java/dagger/internal/codegen/binding/ComponentRequirement.java index df105773e89..1779ec1d6fb 100644 --- a/java/dagger/internal/codegen/binding/ComponentRequirement.java +++ b/java/dagger/internal/codegen/binding/ComponentRequirement.java @@ -145,7 +145,7 @@ public boolean requiresAPassedInstance() { *

Alternatively, if the module is a Kotlin Object then the binding methods are considered * {@code static}, requiring no module instance. */ - private boolean requiresModuleInstance() { + public boolean requiresModuleInstance() { if (typeElement().isKotlinObject() || typeElement().isCompanionObject()) { return false; } diff --git a/java/dagger/internal/codegen/componentgenerator/ComponentHjarGenerator.java b/java/dagger/internal/codegen/componentgenerator/ComponentHjarGenerator.java index 62f11632e51..4214cbc7239 100644 --- a/java/dagger/internal/codegen/componentgenerator/ComponentHjarGenerator.java +++ b/java/dagger/internal/codegen/componentgenerator/ComponentHjarGenerator.java @@ -192,7 +192,14 @@ private static Stream componentRequirements(ComponentDescr && isElementAccessibleFrom( module.moduleElement(), component.typeElement().getClassName().packageName())) - .map(module -> ComponentRequirement.forModule(module.moduleElement().getType()))); + .map(module -> ComponentRequirement.forModule(module.moduleElement().getType())) + // If the user hasn't defined an explicit creator/builder then we need to prune out the + // module requirements that don't require a module instance to match the non-hjar + // implementation. + .filter( + requirement -> + component.creatorDescriptor().isPresent() + || requirement.requiresModuleInstance())); } private boolean hasBindsInstanceMethods(ComponentDescriptor componentDescriptor) { diff --git a/java/dagger/internal/codegen/writing/ComponentCreatorImplementationFactory.java b/java/dagger/internal/codegen/writing/ComponentCreatorImplementationFactory.java index 88d4d4123c0..f74b50a3692 100644 --- a/java/dagger/internal/codegen/writing/ComponentCreatorImplementationFactory.java +++ b/java/dagger/internal/codegen/writing/ComponentCreatorImplementationFactory.java @@ -202,6 +202,12 @@ private Optional createSetterMethod( case NEEDED: return Optional.of(normalSetterMethod(requirement)); case UNNEEDED: + // If this is a generated Builder, then remove the setter methods for modules that don't + // require an instance. + if (!componentDescriptor().creatorDescriptor().isPresent() + && !requirement.requiresModuleInstance()) { + return Optional.empty(); + } // TODO(bcorso): Don't generate noop setters for any unneeded requirements. // However, since this is a breaking change we can at least avoid trying // to generate noop setters for impossible cases like when the requirement type diff --git a/javatests/dagger/functional/basic/ComponentNestedTypeTest.java b/javatests/dagger/functional/basic/ComponentNestedTypeTest.java index b9e0cf436c8..837228f1650 100644 --- a/javatests/dagger/functional/basic/ComponentNestedTypeTest.java +++ b/javatests/dagger/functional/basic/ComponentNestedTypeTest.java @@ -54,8 +54,7 @@ static dagger.functional.basic.subpackage.NestedType provideSomeType() { @Test public void typeNameWontClashWithNestedTypeName() { - TestComponent component = - DaggerComponentNestedTypeTest_TestComponent.builder().testModule(new TestModule()).build(); + TestComponent component = DaggerComponentNestedTypeTest_TestComponent.create(); assertThat(component.nestedType()).isNotNull(); } } diff --git a/javatests/dagger/internal/codegen/goldens/ComponentProcessorTest_subcomponentNotGeneratedIfNotUsedInGraph_DEFAULT_MODE_test.DaggerParent b/javatests/dagger/internal/codegen/goldens/ComponentProcessorTest_subcomponentNotGeneratedIfNotUsedInGraph_DEFAULT_MODE_test.DaggerParent index 9447a4730ff..80c5d37787b 100644 --- a/javatests/dagger/internal/codegen/goldens/ComponentProcessorTest_subcomponentNotGeneratedIfNotUsedInGraph_DEFAULT_MODE_test.DaggerParent +++ b/javatests/dagger/internal/codegen/goldens/ComponentProcessorTest_subcomponentNotGeneratedIfNotUsedInGraph_DEFAULT_MODE_test.DaggerParent @@ -1,7 +1,6 @@ package test; import dagger.internal.DaggerGenerated; -import dagger.internal.Preconditions; import javax.annotation.processing.Generated; @DaggerGenerated @@ -31,15 +30,6 @@ final class DaggerParent { private Builder() { } - /** - * @deprecated This module is declared, but an instance is not used in the component. This method is a no-op. For more, see https://dagger.dev/unused-modules. - */ - @Deprecated - public Builder parentModule(ParentModule parentModule) { - Preconditions.checkNotNull(parentModule); - return this; - } - public Parent build() { return new ParentImpl(); } diff --git a/javatests/dagger/internal/codegen/goldens/ComponentProcessorTest_subcomponentNotGeneratedIfNotUsedInGraph_FAST_INIT_MODE_test.DaggerParent b/javatests/dagger/internal/codegen/goldens/ComponentProcessorTest_subcomponentNotGeneratedIfNotUsedInGraph_FAST_INIT_MODE_test.DaggerParent index 9447a4730ff..80c5d37787b 100644 --- a/javatests/dagger/internal/codegen/goldens/ComponentProcessorTest_subcomponentNotGeneratedIfNotUsedInGraph_FAST_INIT_MODE_test.DaggerParent +++ b/javatests/dagger/internal/codegen/goldens/ComponentProcessorTest_subcomponentNotGeneratedIfNotUsedInGraph_FAST_INIT_MODE_test.DaggerParent @@ -1,7 +1,6 @@ package test; import dagger.internal.DaggerGenerated; -import dagger.internal.Preconditions; import javax.annotation.processing.Generated; @DaggerGenerated @@ -31,15 +30,6 @@ final class DaggerParent { private Builder() { } - /** - * @deprecated This module is declared, but an instance is not used in the component. This method is a no-op. For more, see https://dagger.dev/unused-modules. - */ - @Deprecated - public Builder parentModule(ParentModule parentModule) { - Preconditions.checkNotNull(parentModule); - return this; - } - public Parent build() { return new ParentImpl(); } diff --git a/javatests/dagger/internal/codegen/goldens/ComponentProcessorTest_transitiveModuleDeps_DEFAULT_MODE_test.DaggerTestComponent b/javatests/dagger/internal/codegen/goldens/ComponentProcessorTest_transitiveModuleDeps_DEFAULT_MODE_test.DaggerTestComponent index ec93b6ca06d..93f8bcc0c99 100644 --- a/javatests/dagger/internal/codegen/goldens/ComponentProcessorTest_transitiveModuleDeps_DEFAULT_MODE_test.DaggerTestComponent +++ b/javatests/dagger/internal/codegen/goldens/ComponentProcessorTest_transitiveModuleDeps_DEFAULT_MODE_test.DaggerTestComponent @@ -1,7 +1,6 @@ package test; import dagger.internal.DaggerGenerated; -import dagger.internal.Preconditions; import javax.annotation.processing.Generated; @DaggerGenerated @@ -31,60 +30,6 @@ final class DaggerTestComponent { private Builder() { } - /** - * @deprecated This module is declared, but an instance is not used in the component. This method is a no-op. For more, see https://dagger.dev/unused-modules. - */ - @Deprecated - public Builder testModule(TestModule testModule) { - Preconditions.checkNotNull(testModule); - return this; - } - - /** - * @deprecated This module is declared, but an instance is not used in the component. This method is a no-op. For more, see https://dagger.dev/unused-modules. - */ - @Deprecated - public Builder parentTestIncluded(ParentTestIncluded parentTestIncluded) { - Preconditions.checkNotNull(parentTestIncluded); - return this; - } - - /** - * @deprecated This module is declared, but an instance is not used in the component. This method is a no-op. For more, see https://dagger.dev/unused-modules. - */ - @Deprecated - public Builder alwaysIncluded(AlwaysIncluded alwaysIncluded) { - Preconditions.checkNotNull(alwaysIncluded); - return this; - } - - /** - * @deprecated This module is declared, but an instance is not used in the component. This method is a no-op. For more, see https://dagger.dev/unused-modules. - */ - @Deprecated - public Builder depModule(DepModule depModule) { - Preconditions.checkNotNull(depModule); - return this; - } - - /** - * @deprecated This module is declared, but an instance is not used in the component. This method is a no-op. For more, see https://dagger.dev/unused-modules. - */ - @Deprecated - public Builder parentDepIncluded(ParentDepIncluded parentDepIncluded) { - Preconditions.checkNotNull(parentDepIncluded); - return this; - } - - /** - * @deprecated This module is declared, but an instance is not used in the component. This method is a no-op. For more, see https://dagger.dev/unused-modules. - */ - @Deprecated - public Builder refByDep(RefByDep refByDep) { - Preconditions.checkNotNull(refByDep); - return this; - } - public TestComponent build() { return new TestComponentImpl(); } diff --git a/javatests/dagger/internal/codegen/goldens/ComponentProcessorTest_transitiveModuleDeps_FAST_INIT_MODE_test.DaggerTestComponent b/javatests/dagger/internal/codegen/goldens/ComponentProcessorTest_transitiveModuleDeps_FAST_INIT_MODE_test.DaggerTestComponent index ec93b6ca06d..93f8bcc0c99 100644 --- a/javatests/dagger/internal/codegen/goldens/ComponentProcessorTest_transitiveModuleDeps_FAST_INIT_MODE_test.DaggerTestComponent +++ b/javatests/dagger/internal/codegen/goldens/ComponentProcessorTest_transitiveModuleDeps_FAST_INIT_MODE_test.DaggerTestComponent @@ -1,7 +1,6 @@ package test; import dagger.internal.DaggerGenerated; -import dagger.internal.Preconditions; import javax.annotation.processing.Generated; @DaggerGenerated @@ -31,60 +30,6 @@ final class DaggerTestComponent { private Builder() { } - /** - * @deprecated This module is declared, but an instance is not used in the component. This method is a no-op. For more, see https://dagger.dev/unused-modules. - */ - @Deprecated - public Builder testModule(TestModule testModule) { - Preconditions.checkNotNull(testModule); - return this; - } - - /** - * @deprecated This module is declared, but an instance is not used in the component. This method is a no-op. For more, see https://dagger.dev/unused-modules. - */ - @Deprecated - public Builder parentTestIncluded(ParentTestIncluded parentTestIncluded) { - Preconditions.checkNotNull(parentTestIncluded); - return this; - } - - /** - * @deprecated This module is declared, but an instance is not used in the component. This method is a no-op. For more, see https://dagger.dev/unused-modules. - */ - @Deprecated - public Builder alwaysIncluded(AlwaysIncluded alwaysIncluded) { - Preconditions.checkNotNull(alwaysIncluded); - return this; - } - - /** - * @deprecated This module is declared, but an instance is not used in the component. This method is a no-op. For more, see https://dagger.dev/unused-modules. - */ - @Deprecated - public Builder depModule(DepModule depModule) { - Preconditions.checkNotNull(depModule); - return this; - } - - /** - * @deprecated This module is declared, but an instance is not used in the component. This method is a no-op. For more, see https://dagger.dev/unused-modules. - */ - @Deprecated - public Builder parentDepIncluded(ParentDepIncluded parentDepIncluded) { - Preconditions.checkNotNull(parentDepIncluded); - return this; - } - - /** - * @deprecated This module is declared, but an instance is not used in the component. This method is a no-op. For more, see https://dagger.dev/unused-modules. - */ - @Deprecated - public Builder refByDep(RefByDep refByDep) { - Preconditions.checkNotNull(refByDep); - return this; - } - public TestComponent build() { return new TestComponentImpl(); } diff --git a/javatests/dagger/internal/codegen/goldens/ComponentProcessorTest_unusedSubcomponents_dontResolveExtraBindingsInParentComponents_DEFAULT_MODE_test.DaggerParent b/javatests/dagger/internal/codegen/goldens/ComponentProcessorTest_unusedSubcomponents_dontResolveExtraBindingsInParentComponents_DEFAULT_MODE_test.DaggerParent index 89764b99a4f..328e3f903f1 100644 --- a/javatests/dagger/internal/codegen/goldens/ComponentProcessorTest_unusedSubcomponents_dontResolveExtraBindingsInParentComponents_DEFAULT_MODE_test.DaggerParent +++ b/javatests/dagger/internal/codegen/goldens/ComponentProcessorTest_unusedSubcomponents_dontResolveExtraBindingsInParentComponents_DEFAULT_MODE_test.DaggerParent @@ -1,7 +1,6 @@ package test; import dagger.internal.DaggerGenerated; -import dagger.internal.Preconditions; import javax.annotation.processing.Generated; @DaggerGenerated @@ -31,15 +30,6 @@ final class DaggerParent { private Builder() { } - /** - * @deprecated This module is declared, but an instance is not used in the component. This method is a no-op. For more, see https://dagger.dev/unused-modules. - */ - @Deprecated - public Builder testModule(TestModule testModule) { - Preconditions.checkNotNull(testModule); - return this; - } - public Parent build() { return new ParentImpl(); } diff --git a/javatests/dagger/internal/codegen/goldens/ComponentProcessorTest_unusedSubcomponents_dontResolveExtraBindingsInParentComponents_FAST_INIT_MODE_test.DaggerParent b/javatests/dagger/internal/codegen/goldens/ComponentProcessorTest_unusedSubcomponents_dontResolveExtraBindingsInParentComponents_FAST_INIT_MODE_test.DaggerParent index 89764b99a4f..328e3f903f1 100644 --- a/javatests/dagger/internal/codegen/goldens/ComponentProcessorTest_unusedSubcomponents_dontResolveExtraBindingsInParentComponents_FAST_INIT_MODE_test.DaggerParent +++ b/javatests/dagger/internal/codegen/goldens/ComponentProcessorTest_unusedSubcomponents_dontResolveExtraBindingsInParentComponents_FAST_INIT_MODE_test.DaggerParent @@ -1,7 +1,6 @@ package test; import dagger.internal.DaggerGenerated; -import dagger.internal.Preconditions; import javax.annotation.processing.Generated; @DaggerGenerated @@ -31,15 +30,6 @@ final class DaggerParent { private Builder() { } - /** - * @deprecated This module is declared, but an instance is not used in the component. This method is a no-op. For more, see https://dagger.dev/unused-modules. - */ - @Deprecated - public Builder testModule(TestModule testModule) { - Preconditions.checkNotNull(testModule); - return this; - } - public Parent build() { return new ParentImpl(); } diff --git a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_accessibleRawType_ofInaccessibleType_DEFAULT_MODE_test.DaggerTestComponent b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_accessibleRawType_ofInaccessibleType_DEFAULT_MODE_test.DaggerTestComponent index 5cb03e8845c..f8228a18188 100644 --- a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_accessibleRawType_ofInaccessibleType_DEFAULT_MODE_test.DaggerTestComponent +++ b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_accessibleRawType_ofInaccessibleType_DEFAULT_MODE_test.DaggerTestComponent @@ -3,11 +3,9 @@ package test; import com.google.errorprone.annotations.CanIgnoreReturnValue; import dagger.internal.DaggerGenerated; import dagger.internal.DoubleCheck; -import dagger.internal.Preconditions; import java.util.List; import javax.annotation.processing.Generated; import javax.inject.Provider; -import other.InaccessiblesModule; import other.InaccessiblesModule_InaccessiblesFactory; import other.UsesInaccessibles; import other.UsesInaccessibles_Factory; @@ -40,15 +38,6 @@ final class DaggerTestComponent { private Builder() { } - /** - * @deprecated This module is declared, but an instance is not used in the component. This method is a no-op. For more, see https://dagger.dev/unused-modules. - */ - @Deprecated - public Builder inaccessiblesModule(InaccessiblesModule inaccessiblesModule) { - Preconditions.checkNotNull(inaccessiblesModule); - return this; - } - public TestComponent build() { return new TestComponentImpl(); } diff --git a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_accessibleRawType_ofInaccessibleType_FAST_INIT_MODE_test.DaggerTestComponent b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_accessibleRawType_ofInaccessibleType_FAST_INIT_MODE_test.DaggerTestComponent index 02230a628b4..fd1c9305011 100644 --- a/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_accessibleRawType_ofInaccessibleType_FAST_INIT_MODE_test.DaggerTestComponent +++ b/javatests/dagger/internal/codegen/goldens/MembersInjectionTest_accessibleRawType_ofInaccessibleType_FAST_INIT_MODE_test.DaggerTestComponent @@ -3,11 +3,9 @@ package test; import com.google.errorprone.annotations.CanIgnoreReturnValue; import dagger.internal.DaggerGenerated; import dagger.internal.DoubleCheck; -import dagger.internal.Preconditions; import java.util.List; import javax.annotation.processing.Generated; import javax.inject.Provider; -import other.InaccessiblesModule; import other.InaccessiblesModule_InaccessiblesFactory; import other.UsesInaccessibles; import other.UsesInaccessibles_Factory; @@ -40,15 +38,6 @@ final class DaggerTestComponent { private Builder() { } - /** - * @deprecated This module is declared, but an instance is not used in the component. This method is a no-op. For more, see https://dagger.dev/unused-modules. - */ - @Deprecated - public Builder inaccessiblesModule(InaccessiblesModule inaccessiblesModule) { - Preconditions.checkNotNull(inaccessiblesModule); - return this; - } - public TestComponent build() { return new TestComponentImpl(); } diff --git a/javatests/dagger/internal/codegen/goldens/OptionalBindingRequestFulfillmentTest_inlinedOptionalBindings_DEFAULT_JAVA7_MODE_test.DaggerTestComponent b/javatests/dagger/internal/codegen/goldens/OptionalBindingRequestFulfillmentTest_inlinedOptionalBindings_DEFAULT_JAVA7_MODE_test.DaggerTestComponent index 3f21b64dbb2..9636b1a623f 100644 --- a/javatests/dagger/internal/codegen/goldens/OptionalBindingRequestFulfillmentTest_inlinedOptionalBindings_DEFAULT_JAVA7_MODE_test.DaggerTestComponent +++ b/javatests/dagger/internal/codegen/goldens/OptionalBindingRequestFulfillmentTest_inlinedOptionalBindings_DEFAULT_JAVA7_MODE_test.DaggerTestComponent @@ -3,7 +3,6 @@ package test; import com.google.common.base.Optional; import dagger.Lazy; import dagger.internal.DaggerGenerated; -import dagger.internal.Preconditions; import dagger.internal.ProviderOfLazy; import javax.annotation.Generated; import javax.inject.Provider; @@ -38,15 +37,6 @@ final class DaggerTestComponent { private Builder() { } - /** - * @deprecated This module is declared, but an instance is not used in the component. This method is a no-op. For more, see https://dagger.dev/unused-modules. - */ - @Deprecated - public Builder maybeModule(Maybe.MaybeModule maybeModule) { - Preconditions.checkNotNull(maybeModule); - return this; - } - public TestComponent build() { return new TestComponentImpl(); } diff --git a/javatests/dagger/internal/codegen/goldens/OptionalBindingRequestFulfillmentTest_inlinedOptionalBindings_DEFAULT_MODE_test.DaggerTestComponent b/javatests/dagger/internal/codegen/goldens/OptionalBindingRequestFulfillmentTest_inlinedOptionalBindings_DEFAULT_MODE_test.DaggerTestComponent index 72d51f34853..441dc48883a 100644 --- a/javatests/dagger/internal/codegen/goldens/OptionalBindingRequestFulfillmentTest_inlinedOptionalBindings_DEFAULT_MODE_test.DaggerTestComponent +++ b/javatests/dagger/internal/codegen/goldens/OptionalBindingRequestFulfillmentTest_inlinedOptionalBindings_DEFAULT_MODE_test.DaggerTestComponent @@ -3,7 +3,6 @@ package test; import com.google.common.base.Optional; import dagger.Lazy; import dagger.internal.DaggerGenerated; -import dagger.internal.Preconditions; import dagger.internal.ProviderOfLazy; import javax.annotation.processing.Generated; import javax.inject.Provider; @@ -38,15 +37,6 @@ final class DaggerTestComponent { private Builder() { } - /** - * @deprecated This module is declared, but an instance is not used in the component. This method is a no-op. For more, see https://dagger.dev/unused-modules. - */ - @Deprecated - public Builder maybeModule(Maybe.MaybeModule maybeModule) { - Preconditions.checkNotNull(maybeModule); - return this; - } - public TestComponent build() { return new TestComponentImpl(); } diff --git a/javatests/dagger/internal/codegen/goldens/OptionalBindingRequestFulfillmentTest_inlinedOptionalBindings_FAST_INIT_JAVA7_MODE_test.DaggerTestComponent b/javatests/dagger/internal/codegen/goldens/OptionalBindingRequestFulfillmentTest_inlinedOptionalBindings_FAST_INIT_JAVA7_MODE_test.DaggerTestComponent index f99b125ccc6..88631be0e04 100644 --- a/javatests/dagger/internal/codegen/goldens/OptionalBindingRequestFulfillmentTest_inlinedOptionalBindings_FAST_INIT_JAVA7_MODE_test.DaggerTestComponent +++ b/javatests/dagger/internal/codegen/goldens/OptionalBindingRequestFulfillmentTest_inlinedOptionalBindings_FAST_INIT_JAVA7_MODE_test.DaggerTestComponent @@ -3,7 +3,6 @@ package test; import com.google.common.base.Optional; import dagger.Lazy; import dagger.internal.DaggerGenerated; -import dagger.internal.Preconditions; import dagger.internal.ProviderOfLazy; import javax.annotation.Generated; import javax.inject.Provider; @@ -38,15 +37,6 @@ final class DaggerTestComponent { private Builder() { } - /** - * @deprecated This module is declared, but an instance is not used in the component. This method is a no-op. For more, see https://dagger.dev/unused-modules. - */ - @Deprecated - public Builder maybeModule(Maybe.MaybeModule maybeModule) { - Preconditions.checkNotNull(maybeModule); - return this; - } - public TestComponent build() { return new TestComponentImpl(); } diff --git a/javatests/dagger/internal/codegen/goldens/OptionalBindingRequestFulfillmentTest_inlinedOptionalBindings_FAST_INIT_MODE_test.DaggerTestComponent b/javatests/dagger/internal/codegen/goldens/OptionalBindingRequestFulfillmentTest_inlinedOptionalBindings_FAST_INIT_MODE_test.DaggerTestComponent index 5d440634456..bc2d8aa7253 100644 --- a/javatests/dagger/internal/codegen/goldens/OptionalBindingRequestFulfillmentTest_inlinedOptionalBindings_FAST_INIT_MODE_test.DaggerTestComponent +++ b/javatests/dagger/internal/codegen/goldens/OptionalBindingRequestFulfillmentTest_inlinedOptionalBindings_FAST_INIT_MODE_test.DaggerTestComponent @@ -3,7 +3,6 @@ package test; import com.google.common.base.Optional; import dagger.Lazy; import dagger.internal.DaggerGenerated; -import dagger.internal.Preconditions; import dagger.internal.ProviderOfLazy; import javax.annotation.processing.Generated; import javax.inject.Provider; @@ -38,15 +37,6 @@ final class DaggerTestComponent { private Builder() { } - /** - * @deprecated This module is declared, but an instance is not used in the component. This method is a no-op. For more, see https://dagger.dev/unused-modules. - */ - @Deprecated - public Builder maybeModule(Maybe.MaybeModule maybeModule) { - Preconditions.checkNotNull(maybeModule); - return this; - } - public TestComponent build() { return new TestComponentImpl(); } diff --git a/javatests/dagger/internal/codegen/goldens/OptionalBindingRequestFulfillmentTest_requestForFuture_DEFAULT_JAVA7_MODE_test.DaggerTestComponent b/javatests/dagger/internal/codegen/goldens/OptionalBindingRequestFulfillmentTest_requestForFuture_DEFAULT_JAVA7_MODE_test.DaggerTestComponent index 7325da92cf8..5aff13e7981 100644 --- a/javatests/dagger/internal/codegen/goldens/OptionalBindingRequestFulfillmentTest_requestForFuture_DEFAULT_JAVA7_MODE_test.DaggerTestComponent +++ b/javatests/dagger/internal/codegen/goldens/OptionalBindingRequestFulfillmentTest_requestForFuture_DEFAULT_JAVA7_MODE_test.DaggerTestComponent @@ -4,7 +4,6 @@ import com.google.common.base.Optional; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import dagger.internal.DaggerGenerated; -import dagger.internal.Preconditions; import dagger.producers.internal.CancellationListener; import javax.annotation.Generated; import other.DefinitelyNot; @@ -38,15 +37,6 @@ final class DaggerTestComponent { private Builder() { } - /** - * @deprecated This module is declared, but an instance is not used in the component. This method is a no-op. For more, see https://dagger.dev/unused-modules. - */ - @Deprecated - public Builder maybeModule(Maybe.MaybeModule maybeModule) { - Preconditions.checkNotNull(maybeModule); - return this; - } - public TestComponent build() { return new TestComponentImpl(); } diff --git a/javatests/dagger/internal/codegen/goldens/OptionalBindingRequestFulfillmentTest_requestForFuture_DEFAULT_MODE_test.DaggerTestComponent b/javatests/dagger/internal/codegen/goldens/OptionalBindingRequestFulfillmentTest_requestForFuture_DEFAULT_MODE_test.DaggerTestComponent index 0e2bb0f6754..cc8c775f1fd 100644 --- a/javatests/dagger/internal/codegen/goldens/OptionalBindingRequestFulfillmentTest_requestForFuture_DEFAULT_MODE_test.DaggerTestComponent +++ b/javatests/dagger/internal/codegen/goldens/OptionalBindingRequestFulfillmentTest_requestForFuture_DEFAULT_MODE_test.DaggerTestComponent @@ -4,7 +4,6 @@ import com.google.common.base.Optional; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import dagger.internal.DaggerGenerated; -import dagger.internal.Preconditions; import dagger.producers.internal.CancellationListener; import javax.annotation.processing.Generated; import other.DefinitelyNot; @@ -38,15 +37,6 @@ final class DaggerTestComponent { private Builder() { } - /** - * @deprecated This module is declared, but an instance is not used in the component. This method is a no-op. For more, see https://dagger.dev/unused-modules. - */ - @Deprecated - public Builder maybeModule(Maybe.MaybeModule maybeModule) { - Preconditions.checkNotNull(maybeModule); - return this; - } - public TestComponent build() { return new TestComponentImpl(); } diff --git a/javatests/dagger/internal/codegen/goldens/OptionalBindingRequestFulfillmentTest_requestForFuture_FAST_INIT_JAVA7_MODE_test.DaggerTestComponent b/javatests/dagger/internal/codegen/goldens/OptionalBindingRequestFulfillmentTest_requestForFuture_FAST_INIT_JAVA7_MODE_test.DaggerTestComponent index 7325da92cf8..5aff13e7981 100644 --- a/javatests/dagger/internal/codegen/goldens/OptionalBindingRequestFulfillmentTest_requestForFuture_FAST_INIT_JAVA7_MODE_test.DaggerTestComponent +++ b/javatests/dagger/internal/codegen/goldens/OptionalBindingRequestFulfillmentTest_requestForFuture_FAST_INIT_JAVA7_MODE_test.DaggerTestComponent @@ -4,7 +4,6 @@ import com.google.common.base.Optional; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import dagger.internal.DaggerGenerated; -import dagger.internal.Preconditions; import dagger.producers.internal.CancellationListener; import javax.annotation.Generated; import other.DefinitelyNot; @@ -38,15 +37,6 @@ final class DaggerTestComponent { private Builder() { } - /** - * @deprecated This module is declared, but an instance is not used in the component. This method is a no-op. For more, see https://dagger.dev/unused-modules. - */ - @Deprecated - public Builder maybeModule(Maybe.MaybeModule maybeModule) { - Preconditions.checkNotNull(maybeModule); - return this; - } - public TestComponent build() { return new TestComponentImpl(); } diff --git a/javatests/dagger/internal/codegen/goldens/OptionalBindingRequestFulfillmentTest_requestForFuture_FAST_INIT_MODE_test.DaggerTestComponent b/javatests/dagger/internal/codegen/goldens/OptionalBindingRequestFulfillmentTest_requestForFuture_FAST_INIT_MODE_test.DaggerTestComponent index 0e2bb0f6754..cc8c775f1fd 100644 --- a/javatests/dagger/internal/codegen/goldens/OptionalBindingRequestFulfillmentTest_requestForFuture_FAST_INIT_MODE_test.DaggerTestComponent +++ b/javatests/dagger/internal/codegen/goldens/OptionalBindingRequestFulfillmentTest_requestForFuture_FAST_INIT_MODE_test.DaggerTestComponent @@ -4,7 +4,6 @@ import com.google.common.base.Optional; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import dagger.internal.DaggerGenerated; -import dagger.internal.Preconditions; import dagger.producers.internal.CancellationListener; import javax.annotation.processing.Generated; import other.DefinitelyNot; @@ -38,15 +37,6 @@ final class DaggerTestComponent { private Builder() { } - /** - * @deprecated This module is declared, but an instance is not used in the component. This method is a no-op. For more, see https://dagger.dev/unused-modules. - */ - @Deprecated - public Builder maybeModule(Maybe.MaybeModule maybeModule) { - Preconditions.checkNotNull(maybeModule); - return this; - } - public TestComponent build() { return new TestComponentImpl(); } diff --git a/javatests/dagger/internal/codegen/goldens/SetBindingRequestFulfillmentTest_setBindings_DEFAULT_MODE_test.DaggerTestComponent b/javatests/dagger/internal/codegen/goldens/SetBindingRequestFulfillmentTest_setBindings_DEFAULT_MODE_test.DaggerTestComponent index 829486b1915..3cdf8db99d8 100644 --- a/javatests/dagger/internal/codegen/goldens/SetBindingRequestFulfillmentTest_setBindings_DEFAULT_MODE_test.DaggerTestComponent +++ b/javatests/dagger/internal/codegen/goldens/SetBindingRequestFulfillmentTest_setBindings_DEFAULT_MODE_test.DaggerTestComponent @@ -1,7 +1,6 @@ package test; import dagger.internal.DaggerGenerated; -import dagger.internal.Preconditions; import dagger.internal.SetBuilder; import java.util.Collections; import java.util.Set; @@ -34,15 +33,6 @@ final class DaggerTestComponent { private Builder() { } - /** - * @deprecated This module is declared, but an instance is not used in the component. This method is a no-op. For more, see https://dagger.dev/unused-modules. - */ - @Deprecated - public Builder setModule(SetModule setModule) { - Preconditions.checkNotNull(setModule); - return this; - } - public TestComponent build() { return new TestComponentImpl(); } diff --git a/javatests/dagger/internal/codegen/goldens/SetBindingRequestFulfillmentTest_setBindings_FAST_INIT_MODE_test.DaggerTestComponent b/javatests/dagger/internal/codegen/goldens/SetBindingRequestFulfillmentTest_setBindings_FAST_INIT_MODE_test.DaggerTestComponent index 829486b1915..3cdf8db99d8 100644 --- a/javatests/dagger/internal/codegen/goldens/SetBindingRequestFulfillmentTest_setBindings_FAST_INIT_MODE_test.DaggerTestComponent +++ b/javatests/dagger/internal/codegen/goldens/SetBindingRequestFulfillmentTest_setBindings_FAST_INIT_MODE_test.DaggerTestComponent @@ -1,7 +1,6 @@ package test; import dagger.internal.DaggerGenerated; -import dagger.internal.Preconditions; import dagger.internal.SetBuilder; import java.util.Collections; import java.util.Set; @@ -34,15 +33,6 @@ final class DaggerTestComponent { private Builder() { } - /** - * @deprecated This module is declared, but an instance is not used in the component. This method is a no-op. For more, see https://dagger.dev/unused-modules. - */ - @Deprecated - public Builder setModule(SetModule setModule) { - Preconditions.checkNotNull(setModule); - return this; - } - public TestComponent build() { return new TestComponentImpl(); } diff --git a/javatests/dagger/internal/codegen/goldens/SetBindingRequestFulfillmentTest_subcomponentOmitsInheritedBindings_DEFAULT_MODE_test.DaggerTestComponent b/javatests/dagger/internal/codegen/goldens/SetBindingRequestFulfillmentTest_subcomponentOmitsInheritedBindings_DEFAULT_MODE_test.DaggerTestComponent index 24b2d569f13..8fe367e4723 100644 --- a/javatests/dagger/internal/codegen/goldens/SetBindingRequestFulfillmentTest_subcomponentOmitsInheritedBindings_DEFAULT_MODE_test.DaggerTestComponent +++ b/javatests/dagger/internal/codegen/goldens/SetBindingRequestFulfillmentTest_subcomponentOmitsInheritedBindings_DEFAULT_MODE_test.DaggerTestComponent @@ -1,7 +1,6 @@ package test; import dagger.internal.DaggerGenerated; -import dagger.internal.Preconditions; import java.util.Collections; import java.util.Set; import javax.annotation.processing.Generated; @@ -33,15 +32,6 @@ final class DaggerParent { private Builder() { } - /** - * @deprecated This module is declared, but an instance is not used in the component. This method is a no-op. For more, see https://dagger.dev/unused-modules. - */ - @Deprecated - public Builder parentModule(ParentModule parentModule) { - Preconditions.checkNotNull(parentModule); - return this; - } - public Parent build() { return new ParentImpl(); } diff --git a/javatests/dagger/internal/codegen/goldens/SetBindingRequestFulfillmentTest_subcomponentOmitsInheritedBindings_FAST_INIT_MODE_test.DaggerTestComponent b/javatests/dagger/internal/codegen/goldens/SetBindingRequestFulfillmentTest_subcomponentOmitsInheritedBindings_FAST_INIT_MODE_test.DaggerTestComponent index 24b2d569f13..8fe367e4723 100644 --- a/javatests/dagger/internal/codegen/goldens/SetBindingRequestFulfillmentTest_subcomponentOmitsInheritedBindings_FAST_INIT_MODE_test.DaggerTestComponent +++ b/javatests/dagger/internal/codegen/goldens/SetBindingRequestFulfillmentTest_subcomponentOmitsInheritedBindings_FAST_INIT_MODE_test.DaggerTestComponent @@ -1,7 +1,6 @@ package test; import dagger.internal.DaggerGenerated; -import dagger.internal.Preconditions; import java.util.Collections; import java.util.Set; import javax.annotation.processing.Generated; @@ -33,15 +32,6 @@ final class DaggerParent { private Builder() { } - /** - * @deprecated This module is declared, but an instance is not used in the component. This method is a no-op. For more, see https://dagger.dev/unused-modules. - */ - @Deprecated - public Builder parentModule(ParentModule parentModule) { - Preconditions.checkNotNull(parentModule); - return this; - } - public Parent build() { return new ParentImpl(); } diff --git a/javatests/dagger/internal/codegen/goldens/SetBindingRequestFulfillmentWithGuavaTest_setBindings_DEFAULT_MODE_test.DaggerTestComponent b/javatests/dagger/internal/codegen/goldens/SetBindingRequestFulfillmentWithGuavaTest_setBindings_DEFAULT_MODE_test.DaggerTestComponent index ef083098204..0d3bab45442 100644 --- a/javatests/dagger/internal/codegen/goldens/SetBindingRequestFulfillmentWithGuavaTest_setBindings_DEFAULT_MODE_test.DaggerTestComponent +++ b/javatests/dagger/internal/codegen/goldens/SetBindingRequestFulfillmentWithGuavaTest_setBindings_DEFAULT_MODE_test.DaggerTestComponent @@ -2,7 +2,6 @@ package test; import com.google.common.collect.ImmutableSet; import dagger.internal.DaggerGenerated; -import dagger.internal.Preconditions; import java.util.Set; import javax.annotation.processing.Generated; @@ -33,15 +32,6 @@ final class DaggerTestComponent { private Builder() { } - /** - * @deprecated This module is declared, but an instance is not used in the component. This method is a no-op. For more, see https://dagger.dev/unused-modules. - */ - @Deprecated - public Builder setModule(SetModule setModule) { - Preconditions.checkNotNull(setModule); - return this; - } - public TestComponent build() { return new TestComponentImpl(); } diff --git a/javatests/dagger/internal/codegen/goldens/SetBindingRequestFulfillmentWithGuavaTest_setBindings_FAST_INIT_MODE_test.DaggerTestComponent b/javatests/dagger/internal/codegen/goldens/SetBindingRequestFulfillmentWithGuavaTest_setBindings_FAST_INIT_MODE_test.DaggerTestComponent index ef083098204..0d3bab45442 100644 --- a/javatests/dagger/internal/codegen/goldens/SetBindingRequestFulfillmentWithGuavaTest_setBindings_FAST_INIT_MODE_test.DaggerTestComponent +++ b/javatests/dagger/internal/codegen/goldens/SetBindingRequestFulfillmentWithGuavaTest_setBindings_FAST_INIT_MODE_test.DaggerTestComponent @@ -2,7 +2,6 @@ package test; import com.google.common.collect.ImmutableSet; import dagger.internal.DaggerGenerated; -import dagger.internal.Preconditions; import java.util.Set; import javax.annotation.processing.Generated; @@ -33,15 +32,6 @@ final class DaggerTestComponent { private Builder() { } - /** - * @deprecated This module is declared, but an instance is not used in the component. This method is a no-op. For more, see https://dagger.dev/unused-modules. - */ - @Deprecated - public Builder setModule(SetModule setModule) { - Preconditions.checkNotNull(setModule); - return this; - } - public TestComponent build() { return new TestComponentImpl(); } diff --git a/javatests/dagger/internal/codegen/goldens/SetBindingRequestFulfillmentWithGuavaTest_subcomponentOmitsInheritedBindings_DEFAULT_MODE_test.DaggerParent b/javatests/dagger/internal/codegen/goldens/SetBindingRequestFulfillmentWithGuavaTest_subcomponentOmitsInheritedBindings_DEFAULT_MODE_test.DaggerParent index 36e87af447e..e4e4642315f 100644 --- a/javatests/dagger/internal/codegen/goldens/SetBindingRequestFulfillmentWithGuavaTest_subcomponentOmitsInheritedBindings_DEFAULT_MODE_test.DaggerParent +++ b/javatests/dagger/internal/codegen/goldens/SetBindingRequestFulfillmentWithGuavaTest_subcomponentOmitsInheritedBindings_DEFAULT_MODE_test.DaggerParent @@ -2,7 +2,6 @@ package test; import com.google.common.collect.ImmutableSet; import dagger.internal.DaggerGenerated; -import dagger.internal.Preconditions; import java.util.Set; import javax.annotation.processing.Generated; @@ -33,15 +32,6 @@ final class DaggerParent { private Builder() { } - /** - * @deprecated This module is declared, but an instance is not used in the component. This method is a no-op. For more, see https://dagger.dev/unused-modules. - */ - @Deprecated - public Builder parentModule(ParentModule parentModule) { - Preconditions.checkNotNull(parentModule); - return this; - } - public Parent build() { return new ParentImpl(); } diff --git a/javatests/dagger/internal/codegen/goldens/SetBindingRequestFulfillmentWithGuavaTest_subcomponentOmitsInheritedBindings_FAST_INIT_MODE_test.DaggerParent b/javatests/dagger/internal/codegen/goldens/SetBindingRequestFulfillmentWithGuavaTest_subcomponentOmitsInheritedBindings_FAST_INIT_MODE_test.DaggerParent index 36e87af447e..e4e4642315f 100644 --- a/javatests/dagger/internal/codegen/goldens/SetBindingRequestFulfillmentWithGuavaTest_subcomponentOmitsInheritedBindings_FAST_INIT_MODE_test.DaggerParent +++ b/javatests/dagger/internal/codegen/goldens/SetBindingRequestFulfillmentWithGuavaTest_subcomponentOmitsInheritedBindings_FAST_INIT_MODE_test.DaggerParent @@ -2,7 +2,6 @@ package test; import com.google.common.collect.ImmutableSet; import dagger.internal.DaggerGenerated; -import dagger.internal.Preconditions; import java.util.Set; import javax.annotation.processing.Generated; @@ -33,15 +32,6 @@ final class DaggerParent { private Builder() { } - /** - * @deprecated This module is declared, but an instance is not used in the component. This method is a no-op. For more, see https://dagger.dev/unused-modules. - */ - @Deprecated - public Builder parentModule(ParentModule parentModule) { - Preconditions.checkNotNull(parentModule); - return this; - } - public Parent build() { return new ParentImpl(); }