gnodet commented on PR #13605: URL: https://github.com/apache/maven/pull/13605#issuecomment-6270583461
Good question! The behaviour is intentional and mirrors the 3.10.x fix ([835209bb04](https://github.com/apache/maven/commit/835209bb04)) which was already released. The concern about a detached `PluginManagement` being silently discarded is a valid edge case in theory, but in practice the callers that invoke `getPluginManagement()` only *read* from it (they iterate plugins to resolve configurations) — none of them add plugins to the returned object. The use case for mutation via this getter doesn't really exist in the Maven codebase. The contract is: **never returns null**, so callers can safely iterate its plugin list without null-guarding. If the model has no plugin management defined, the returned empty `PluginManagement` is a safe, read-only sentinel value. That said, your Javadoc suggestion is appreciated. The current one-liner `never {@code null}` captures the essential guarantee. We could expand it to mention the sentinel behaviour but that's optional cleanup scope. -- 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]
