gnodet-bot commented on code in PR #13545:
URL: https://github.com/apache/maven/pull/13545#discussion_r4283310970
##########
impl/maven-di/src/main/java/org/apache/maven/di/Injector.java:
##########
@@ -157,7 +166,7 @@ static Injector create() {
* @param key the class representing the type to retrieve
* @return an instance of the requested type
* @throws NullPointerException if key is null
- * @throws IllegalStateException if the type cannot be provided
+ * @throws RuntimeException if no binding can be provided or bindings are
ambiguous
Review Comment:
💡 **Suggestion:** `@throws RuntimeException` is broad. The actual thrown
type is `DIException` (thrown in `InjectorImpl`). Using the concrete type makes
the contract clearer for callers:
```suggestion
* @throws DIException if no binding can be provided or bindings are
ambiguous
```
##########
impl/maven-di/src/main/java/org/apache/maven/di/Injector.java:
##########
@@ -172,7 +181,7 @@ static Injector create() {
* @param key the key identifying the instance to retrieve
* @return an instance matching the requested key
* @throws NullPointerException if key is null
- * @throws IllegalStateException if the type cannot be provided
+ * @throws RuntimeException if no binding can be provided or bindings are
ambiguous
Review Comment:
💡 **Suggestion:** Same as above — `@throws RuntimeException` should be
`@throws DIException` to match the actual exception thrown by the
implementation:
```suggestion
* @throws DIException if no binding can be provided or bindings are
ambiguous
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]