rootvector2 commented on PR #704:
URL: 
https://github.com/apache/commons-collections/pull/704#issuecomment-4893884140

   checked all 18 `getXxxValue` methods against their declared return type. 
this `getIntValue(Map, K, Function)` narrowing to `.byteValue()` is the only 
mismatch, everything else (`byte`/`short`/`long`/`float`/`double` function 
overloads, plus every `defaultValue` overload) narrows to its own type. so no 
other copy-paste like COLLECTIONS-874 is lurking.
   
   on tests: the `Function` overloads were the blind spot. `getIntValue` was 
only driven with `key -> 0`, which survives the truncation, so the bug stayed 
invisible. `getLongValue` already covers `Long.MIN/MAX_VALUE` through the 
function variant. `getShortValue` had the same weak spot, its function overload 
was only exercised with `10` (fits in a byte), while the `MIN/MAX` assertions 
go through the `short` overload instead. pushed a one-liner there driving `key 
-> (short) 1000` so a future `.byteValue()` slip would be caught. 
`byte`/`double`/`float` can't narrow past their own source type, so nothing to 
add there.


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