jungm opened a new pull request, #1112:
URL: https://github.com/apache/myfaces/pull/1112

   https://issues.apache.org/jira/browse/MYFACES-4770
   
   ## Summary
   
   `ViewScopeCDIMap.put()` returned the previous internal 
`ContextualInstanceInfo` wrapper instead of the previous value, breaking the 
`java.util.Map#put` contract that `UIViewRoot#getViewMap()` exposes. It now 
unwraps the result the same way `get()` and `remove()` already do:
   
   ```diff
    ContextualInstanceInfo info = new ContextualInstanceInfo();
    info.setContextualInstance(value);
   -return getCreationalContextInstances().put(beanKey, info);
   +ContextualInstanceInfo previous = 
getCreationalContextInstances().put(beanKey, info);
   +return previous == null ? null : previous.getContextualInstance();
   ```
   
   ## Evidence
   
   New `ViewScopeCDIMapTest` (CDI request test case, so the view map is backed 
by `ViewScopeCDIMap`):
   
   ```text
   viewMap.put("key", "first")   -> null
   viewMap.put("key", "second")  -> "first"
   viewMap.get("key")            -> "second"
   ```
   
   - **Before:** `AssertionFailedError: expected: <first> but was: 
<org.apache.myfaces.cdi.util.ContextualInstanceInfo@42273aa0>`
     **After:** passes; `impl` 1710 tests, 0 failures, 0 errors (JDK 17)
   
   ## Merge Danger
   
   **Door:** two-way
   
   **Blast Radius:** small
   
   Only callers that use the return value of `getViewMap().put(...)` with CDI 
enabled see a difference, and they now get the value the `Map` contract 
promises instead of a MyFaces-internal object. Nothing inside MyFaces reads 
that return value.
   


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