Skip to content

Commit e679774

Browse files
java-team-github-botDagger Team
authored andcommitted
Rollback changelist 640960016.
PiperOrigin-RevId: 641013296
1 parent 9c5d902 commit e679774

File tree

28 files changed

+19
-1474
lines changed

28 files changed

+19
-1474
lines changed

java/dagger/internal/codegen/binding/BindingGraph.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ public abstract class BindingGraph {
7474
public abstract static class TopLevelBindingGraph
7575
extends dagger.internal.codegen.model.BindingGraph {
7676
static TopLevelBindingGraph create(
77-
ImmutableNetwork<Node, Edge> network,
78-
boolean isFullBindingGraph) {
77+
ImmutableNetwork<Node, Edge> network, boolean isFullBindingGraph) {
7978
TopLevelBindingGraph topLevelBindingGraph =
8079
new AutoValue_BindingGraph_TopLevelBindingGraph(network, isFullBindingGraph);
8180

java/dagger/internal/codegen/binding/BindingGraphConverter.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,7 @@ BindingGraph convert(LegacyBindingGraph legacyBindingGraph, boolean isFullBindin
7777
}
7878

7979
TopLevelBindingGraph topLevelBindingGraph =
80-
TopLevelBindingGraph.create(
81-
ImmutableNetwork.copyOf(network),
82-
isFullBindingGraph);
80+
TopLevelBindingGraph.create(ImmutableNetwork.copyOf(network), isFullBindingGraph);
8381
return BindingGraph.create(rootNode, topLevelBindingGraph);
8482
}
8583

@@ -124,7 +122,8 @@ private void visitComponent(LegacyBindingGraph graph) {
124122

125123
network.addNode(graph.componentNode());
126124

127-
for (ComponentMethodDescriptor entryPointMethod : graph.entryPointMethods()) {
125+
for (ComponentMethodDescriptor entryPointMethod :
126+
graph.componentDescriptor().entryPointMethods()) {
128127
addDependencyEdges(graph.componentNode(), entryPointMethod.dependencyRequest().get());
129128
}
130129

java/dagger/internal/codegen/binding/BindingGraphFactory.java

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import static dagger.internal.codegen.base.Util.reentrantComputeIfAbsent;
2323
import static dagger.internal.codegen.binding.AssistedInjectionAnnotations.isAssistedFactoryType;
2424
import static dagger.internal.codegen.binding.SourceFiles.generatedMonitoringModuleName;
25-
import static dagger.internal.codegen.extension.DaggerStreams.toImmutableList;
2625
import static dagger.internal.codegen.model.BindingKind.ASSISTED_INJECTION;
2726
import static dagger.internal.codegen.model.BindingKind.DELEGATE;
2827
import static dagger.internal.codegen.model.BindingKind.INJECTION;
@@ -49,7 +48,6 @@
4948
import dagger.internal.codegen.base.Keys;
5049
import dagger.internal.codegen.base.MapType;
5150
import dagger.internal.codegen.base.OptionalType;
52-
import dagger.internal.codegen.binding.ComponentDescriptor.ComponentMethodDescriptor;
5351
import dagger.internal.codegen.compileroption.CompilerOptions;
5452
import dagger.internal.codegen.javapoet.TypeNames;
5553
import dagger.internal.codegen.model.BindingGraph.ComponentNode;
@@ -214,7 +212,14 @@ private LegacyBindingGraph createLegacyBindingGraph(
214212

215213
componentDescriptor.entryPointMethods().stream()
216214
.map(method -> method.dependencyRequest().get())
217-
.forEach(entryPoint -> resolveEntryPointsHelper(entryPoint, requestResolver));
215+
.forEach(
216+
entryPoint -> {
217+
if (entryPoint.kind().equals(MEMBERS_INJECTION)) {
218+
requestResolver.resolveMembersInjection(entryPoint.key());
219+
} else {
220+
requestResolver.resolve(entryPoint.key());
221+
}
222+
});
218223

219224
if (createFullBindingGraph) {
220225
// Resolve the keys for all bindings in all modules, stripping any multibinding contribution
@@ -244,14 +249,6 @@ private LegacyBindingGraph createLegacyBindingGraph(
244249
return new LegacyBindingGraph(requestResolver, subgraphs.build());
245250
}
246251

247-
private void resolveEntryPointsHelper(DependencyRequest entryPoint, Resolver requestResolver) {
248-
if (entryPoint.kind().equals(MEMBERS_INJECTION)) {
249-
requestResolver.resolveMembersInjection(entryPoint.key());
250-
} else {
251-
requestResolver.resolve(entryPoint.key());
252-
}
253-
}
254-
255252
/**
256253
* Returns all the modules that should be installed in the component. For production components
257254
* and production subcomponents that have a parent that is not a production component or
@@ -299,7 +296,7 @@ static final class LegacyBindingGraph {
299296
private final ImmutableList<LegacyBindingGraph> resolvedSubgraphs;
300297
private final ComponentNode componentNode;
301298

302-
LegacyBindingGraph(Resolver resolver, ImmutableList<LegacyBindingGraph> resolvedSubgraphs) {
299+
LegacyBindingGraph(Resolver resolver, ImmutableList<LegacyBindingGraph> resolvedSubgraphs) {
303300
this.resolver = resolver;
304301
this.resolvedSubgraphs = resolvedSubgraphs;
305302
this.componentNode =
@@ -321,11 +318,6 @@ ComponentDescriptor componentDescriptor() {
321318
return resolver.componentDescriptor;
322319
}
323320

324-
ImmutableList<ComponentMethodDescriptor> entryPointMethods() {
325-
return componentDescriptor().entryPointMethods().stream()
326-
.collect(toImmutableList());
327-
}
328-
329321
/**
330322
* Returns the {@link ResolvedBindings} in this graph or a parent graph that matches the given
331323
* request.

java/dagger/internal/codegen/writing/ComponentImplementation.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
import com.google.common.collect.ListMultimap;
6060
import com.google.common.collect.Lists;
6161
import com.google.common.collect.MultimapBuilder;
62+
import com.google.common.collect.Sets;
6263
import com.squareup.javapoet.ClassName;
6364
import com.squareup.javapoet.CodeBlock;
6465
import com.squareup.javapoet.FieldSpec;
@@ -96,6 +97,7 @@
9697
import java.util.List;
9798
import java.util.Map;
9899
import java.util.Optional;
100+
import java.util.Set;
99101
import javax.inject.Inject;
100102
import javax.inject.Provider;
101103
import javax.lang.model.element.Modifier;
@@ -884,19 +886,14 @@ private void addInterfaceMethods() {
884886
// Each component method may have been declared by several supertypes. We want to implement
885887
// only one method for each distinct signature.
886888
XType componentType = graph.componentTypeElement().getType();
887-
Map<MethodSignature, ComponentMethodDescriptor> methodDescriptors = new LinkedHashMap<>();
889+
Set<MethodSignature> signatures = Sets.newHashSet();
888890
for (ComponentMethodDescriptor method : graph.componentDescriptor().entryPointMethods()) {
889-
MethodSignature signature =
890-
MethodSignature.forComponentMethod(method, componentType, processingEnv);
891-
if (!methodDescriptors.containsKey(signature)) {
892-
methodDescriptors.put(signature, method);
893-
}
894-
}
895-
896-
for (ComponentMethodDescriptor method : methodDescriptors.values()) {
891+
if (signatures.add(
892+
MethodSignature.forComponentMethod(method, componentType, processingEnv))) {
897893
addMethod(
898894
COMPONENT_METHOD,
899895
componentRequestRepresentationsProvider.get().getComponentMethod(method));
896+
}
900897
}
901898
}
902899

javatests/dagger/internal/codegen/goldens/UnusedEntryPointTest_entryPointInUse_implicitBindingIdentifier_generatesEntryPointImplementation_DEFAULT_MODE_test.DaggerMyComponent

Lines changed: 0 additions & 59 deletions
This file was deleted.

javatests/dagger/internal/codegen/goldens/UnusedEntryPointTest_entryPointInUse_implicitBindingIdentifier_generatesEntryPointImplementation_FAST_INIT_MODE_test.DaggerMyComponent

Lines changed: 0 additions & 59 deletions
This file was deleted.

javatests/dagger/internal/codegen/goldens/UnusedEntryPointTest_entryPointInUse_implicitModuleBindingIdentifier_generatesEntryPointImplementation_DEFAULT_MODE_test.DaggerMyComponent

Lines changed: 0 additions & 72 deletions
This file was deleted.

0 commit comments

Comments
 (0)