diff --git a/java/dagger/internal/codegen/binding/LegacyBindingGraphFactory.java b/java/dagger/internal/codegen/binding/LegacyBindingGraphFactory.java index 91b2fad78a0..4e95c2e5059 100644 --- a/java/dagger/internal/codegen/binding/LegacyBindingGraphFactory.java +++ b/java/dagger/internal/codegen/binding/LegacyBindingGraphFactory.java @@ -70,7 +70,7 @@ public final class LegacyBindingGraphFactory { static boolean useLegacyBindingGraphFactory( CompilerOptions compilerOptions, ComponentDescriptor componentDescriptor) { - return compilerOptions.useLegacyBindingGraphFactory(); + return !compilerOptions.useBindingGraphFix(); } static boolean hasStrictMultibindingsExemption( diff --git a/java/dagger/internal/codegen/compileroption/CompilerOptions.java b/java/dagger/internal/codegen/compileroption/CompilerOptions.java index aa3756f33e2..0fb36351f33 100644 --- a/java/dagger/internal/codegen/compileroption/CompilerOptions.java +++ b/java/dagger/internal/codegen/compileroption/CompilerOptions.java @@ -119,24 +119,14 @@ public final boolean doCheckForNulls() { public abstract boolean generatedClassExtendsComponent(); /** - * Returns {@code true} if Dagger should use the legacy binding graph factory. + * Returns {@code true} if Dagger should turn on the binding graph fix. * - *
Note: This flag is only intended to give users time to migrate to the new binding graph - * factory. New users should not enable this flag. This flag will be removed in a future release. + *
Note: This flag is only intended to give users time to migrate. This flag will be removed in + * a future release. * - *
The legacy binding graph factory contains a number of bugs which can lead to an incorrect - * binding graph (e.g. missing multibindings), can be difficult to debug, and are often dependent - * on the ordering of bindings/dependency requests in the user's code. - * - *
The new binding graph factory fixes many of these issues by switching to a well known graph - * data structure and algorithms to avoid many of the subtle bugs that plagued the legacy binding - * graph factory. However, note that the new binding graph factory also has a behavior change that - * could cause issues for some users. Specifically, a module binding is no longer allowed to float - * from its installed component into one of its subcomponents in order to satisfy a missing - * dependency. Thus, any (transitive) dependencies of the module binding that are missing from the - * installed component will now be reported as an error. + *
See https://dagger.dev/dev-guide/compiler-options#useBindingGraphFix for more details.
*/
- public abstract boolean useLegacyBindingGraphFactory();
+ public abstract boolean useBindingGraphFix();
/**
* Returns {@code true} if the key for map multibinding contributions contain a framework type.
diff --git a/java/dagger/internal/codegen/compileroption/ProcessingEnvironmentCompilerOptions.java b/java/dagger/internal/codegen/compileroption/ProcessingEnvironmentCompilerOptions.java
index 89a0a91fd8a..b94f8dedb3a 100644
--- a/java/dagger/internal/codegen/compileroption/ProcessingEnvironmentCompilerOptions.java
+++ b/java/dagger/internal/codegen/compileroption/ProcessingEnvironmentCompilerOptions.java
@@ -34,8 +34,8 @@
import static dagger.internal.codegen.compileroption.ProcessingEnvironmentCompilerOptions.Feature.PLUGINS_VISIT_FULL_BINDING_GRAPHS;
import static dagger.internal.codegen.compileroption.ProcessingEnvironmentCompilerOptions.Feature.STRICT_MULTIBINDING_VALIDATION;
import static dagger.internal.codegen.compileroption.ProcessingEnvironmentCompilerOptions.Feature.STRICT_SUPERFICIAL_VALIDATION;
+import static dagger.internal.codegen.compileroption.ProcessingEnvironmentCompilerOptions.Feature.USE_BINDING_GRAPH_FIX;
import static dagger.internal.codegen.compileroption.ProcessingEnvironmentCompilerOptions.Feature.USE_FRAMEWORK_TYPE_IN_MAP_MULTIBINDING_CONTRIBUTION_KEY;
-import static dagger.internal.codegen.compileroption.ProcessingEnvironmentCompilerOptions.Feature.USE_LEGACY_BINDING_GRAPH_FACTORY;
import static dagger.internal.codegen.compileroption.ProcessingEnvironmentCompilerOptions.Feature.VALIDATE_TRANSITIVE_COMPONENT_DEPENDENCIES;
import static dagger.internal.codegen.compileroption.ProcessingEnvironmentCompilerOptions.Feature.WARN_IF_INJECTION_FACTORY_NOT_GENERATED_UPSTREAM;
import static dagger.internal.codegen.compileroption.ProcessingEnvironmentCompilerOptions.Feature.WRITE_PRODUCER_NAME_IN_TOKEN;
@@ -205,8 +205,8 @@ public boolean generatedClassExtendsComponent() {
}
@Override
- public boolean useLegacyBindingGraphFactory() {
- return isEnabled(USE_LEGACY_BINDING_GRAPH_FACTORY);
+ public boolean useBindingGraphFix() {
+ return isEnabled(USE_BINDING_GRAPH_FIX);
}
@Override
@@ -342,7 +342,7 @@ enum Feature implements EnumOption