slachiewicz opened a new pull request, #666:
URL: https://github.com/apache/maven-doxia-sitetools/pull/666

   The only thing in `doxia-sitetools` reaching into `maven-compat` was a test 
stub building a remote repository with `DefaultArtifactRepository`. 
`MavenArtifactRepository` in `maven-artifact` does the same job, so the 
dependency goes.
   
   ### The two are not interchangeable, and the difference is quiet
   
   `DefaultArtifactRepository`'s five-argument constructor **substitutes 
default policies when handed null**. `MavenArtifactRepository` stores the null. 
So this compiles:
   
   ```java
   new MavenArtifactRepository(id, url, layout, null, null)
   ```
   
   and then fails at runtime, but only where something validates the policies:
   
   ```
   Invalid artifact repository: Cannot invoke
   "ArtifactRepositoryPolicy.isEnabled()" because "policy" is null
   ```
   
   The policies passed here are the ones the old class was supplying all along 
— `enabled`, `UPDATE_POLICY_ALWAYS`, `CHECKSUM_POLICY_IGNORE`, confirmed 
against the bytecode of the constructor being replaced — so behaviour is 
unchanged.
   
   Worth flagging for anyone making the same swap elsewhere: whether the null 
form fails depends entirely on the call site. In `maven-release-manager`'s 
`AbstractReleaseTestCase`, the *local* repository has been built with nulls in 
existing code for years and is fine, while the remote repositories a few lines 
later are validated and are not. Same class, same constructor, one safe call 
site and one not. Trying the null form there produced 315 test errors out of 
769.
   
   ### Verification
   
   The whole `doxia-sitetools` reactor builds and passes with the change, 
unchanged from before it.
   
   Part of a wider survey of which Maven projects still declare `maven-compat` 
versus which genuinely use it — several declare it and never touch it, while 
others depend on it in ways that are not trivially removable.
   


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