# Fix #629: Incorrect method reference results when return value requires boxing - #630
# Fix #629: Incorrect method reference results when return value requires boxing#630alwaysalearner1234 wants to merge 2 commits into
Conversation
|
On my Mac laptop with OpenJDK 11.0.32, 20 unit tests fail. |
|
Thanks for taking the time to test this and verify the behavior on your end! I investigated the test failures locally and compared the PR branch against a clean checkout of The failures seem to be environment-specific, particularly given the difference between the macOS/OpenJDK 11.0.32 and Windows/OpenJDK 11.0.31 environments. For this PR, I focused on the method-reference boxing issue described in #629 and verified that the relevant regression cases behave correctly after the change. I'll keep the PR focused on #629 and leave the pre-existing test failures as a separate issue. |
Description
Fixes #629.
Method references that return a primitive value were returning incorrect values when the functional interface expected an object.
For example:
The primitive
intresult was not being boxed before being returned as an object.Fix
valueOf()method.Example
Before:
After:
Testing
Tested with method references including:
String::lengthString::isEmptyInteger::parseIntToIntFunction<String>to ensure existing behavior still works