gnodet-bot commented on code in PR #13545:
URL: https://github.com/apache/maven/pull/13545#discussion_r4284973905


##########
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 IllegalStateException if no binding can be provided or bindings 
are ambiguous

Review Comment:
   ⚠️ **Exception type mismatch:** `@throws IllegalStateException` is declared, 
but `InjectorImpl` throws `DIException` (which extends `RuntimeException`, not 
`IllegalStateException`). The new tests confirm this 
(`assertThrows(DIException.class, ...)`). Callers catching 
`IllegalStateException` won't catch it.
   
   Consider:
   ```suggestion
        * @throws RuntimeException 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 IllegalStateException if no binding can be provided or bindings 
are ambiguous

Review Comment:
   ⚠️ **Same exception type mismatch:** same issue as the `getInstance(Class)` 
overload above — `@throws IllegalStateException` but the implementation throws 
`DIException extends RuntimeException`.
   
   Consider:
   ```suggestion
        * @throws RuntimeException 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]

Reply via email to