Skip to content

Commit

Permalink
Improve AbstractProviderBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanQed committed Feb 21, 2024
1 parent a498262 commit 445ed0e
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ public <T> ServiceProviderBuilder addService(Artifact artifact,
Objects.requireNonNull(artifact);
Objects.requireNonNull(implementation);
Objects.requireNonNull(wrapper);
strong.remove(artifact);
// Check if the implementation is a child class of an artifact type
var parent = artifact.getType();
if (!parent.isAssignableFrom(implementation)) {
throw new IllegalArgumentException("The implementation is not a child class of the artifact type");
}
strong.remove(artifact);
any.put(artifact, Entry.of(implementation, wrapper));
return this;
}
Expand Down

0 comments on commit 445ed0e

Please sign in to comment.