gnodet commented on code in PR #11818:
URL: https://github.com/apache/maven/pull/11818#discussion_r3646572057


##########
api/maven-api-core/src/main/java/org/apache/maven/api/services/ModelBuilderRequest.java:
##########
@@ -88,7 +88,7 @@ enum RepositoryMerging {
         REQUEST_DOMINANT,
     }
 
-    @Nonnull
+    @Nullable

Review Comment:
   This was `@Nonnull` and is now `@Nullable`, but multiple call sites in 
`DefaultModelBuilder.java` dereference `getSource()` without null checks:
   - Line 784: `request.getSource().getPath()`
   - Line 1119: `request.getSource().resolve(...)`
   - Line 1128: `request.getSource().resolve(...)`
   
   The `build()` method does not call `requireNonNull(source)`, so `null` can 
reach the getter.
   
   The PR description states "no @Nonnull annotations were changed to 
@Nullable" — this contradicts the diff.
   
   Consider either adding `requireNonNull(source, "source cannot be null")` in 
the builder's `build()` method (preserving the @Nonnull contract), or adding 
null guards at all call sites.



-- 
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