Skip to content

Commit

Permalink
Improve error message when the TypeElement of a Hilt dependency canno…
Browse files Browse the repository at this point in the history
…t be found.

Issue #3513.

RELNOTES=n/a
PiperOrigin-RevId: 468071610
  • Loading branch information
Chang-Eric authored and Dagger Team committed Aug 17, 2022
1 parent 4048f51 commit 8330385
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,17 @@ private static TypeElement getDependency(
checkNotNull(entryPointsValue);
checkNotNull(componentEntryPointsValue);

return elements.getTypeElement(
String dependencyName =
AnnotationValues.getString(
getOnlyElement(
ImmutableSet.<AnnotationValue>builder()
.addAll(AnnotationValues.getAnnotationValues(modulesValue))
.addAll(AnnotationValues.getAnnotationValues(entryPointsValue))
.addAll(AnnotationValues.getAnnotationValues(componentEntryPointsValue))
.build())));
.build()));
TypeElement dependency = elements.getTypeElement(dependencyName);
checkNotNull(dependency, "Could not get element for %s", dependencyName);
return dependency;
}

private static ImmutableSet<TypeElement> getReplacedDependencies(
Expand Down

0 comments on commit 8330385

Please sign in to comment.