Skip to content

Commit

Permalink
[Cleanup] Remove unnecessary switch on BindingType in `SourceFiles#…
Browse files Browse the repository at this point in the history
…generatedClassNameForBinding()

RELNOTES=N/A
PiperOrigin-RevId: 663442605
  • Loading branch information
bcorso authored and Dagger Team committed Aug 15, 2024
1 parent f1acd72 commit 3b1c84e
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions java/dagger/internal/codegen/binding/SourceFiles.java
Original file line number Diff line number Diff line change
Expand Up @@ -149,29 +149,20 @@ public ImmutableMap<DependencyRequest, CodeBlock> frameworkFieldUsages(

/** Returns the generated factory or members injector name for a binding. */
public static ClassName generatedClassNameForBinding(Binding binding) {
switch (binding.bindingType()) {
switch (binding.kind()) {
case ASSISTED_INJECTION:
case INJECTION:
case PROVISION:
case PRODUCTION:
ContributionBinding contribution = (ContributionBinding) binding;
switch (contribution.kind()) {
case ASSISTED_INJECTION:
case INJECTION:
case PROVISION:
case PRODUCTION:
return factoryNameForElement(asExecutable(binding.bindingElement().get()));

case ASSISTED_FACTORY:
return siblingClassName(asTypeElement(binding.bindingElement().get()), "_Impl");

default:
throw new AssertionError();
}

return factoryNameForElement(asExecutable(binding.bindingElement().get()));
case ASSISTED_FACTORY:
return siblingClassName(asTypeElement(binding.bindingElement().get()), "_Impl");
case MEMBERS_INJECTION:
return membersInjectorNameForType(
((MembersInjectionBinding) binding).membersInjectedType());
default:
throw new AssertionError();
}
throw new AssertionError();
}

/**
Expand Down

0 comments on commit 3b1c84e

Please sign in to comment.