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


##########
impl/maven-impl/src/main/java/org/apache/maven/impl/cache/CacheConfigurationResolver.java:
##########
@@ -48,13 +48,18 @@ public class CacheConfigurationResolver {
      * @param session the session containing user properties
      * @return the resolved cache configuration
      */
-    public static CacheConfig resolveConfig(Request<?> req, Session session) {
-        // First check if request implements CacheMetadata for backward 
compatibility
+    public static CacheConfig resolveConfig(Request<?> req, ProtoSession 
session) {
+        // Read the request's declared retention before applying user-defined 
selectors.
         CacheRetention legacyRetention = null;
         if (req instanceof CacheMetadata metadata) {

Review Comment:
   With `Request` now extending `CacheMetadata`, this `instanceof` guard is 
always true — `req` is `Request<?>` and `Request` now implements 
`CacheMetadata`. The `null` initialization on the previous line and this guard 
are now dead code (the else branch is unreachable). The behavior is correct — 
the check always succeeds and assigns `getCacheRetention()` — but a follow-up 
cleanup could replace lines 53–56 with:
   ```java
   CacheRetention legacyRetention = req.getCacheRetention();
   ```



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