[lworld] RFR: 8281073: [lworld] Update MethodHandles::zero, empty, constant APIs for primitive classes

Mandy Chung mchung at openjdk.java.net
Wed Feb 9 20:31:11 UTC 2022


The `MethodHandles::zero` and `MethodHandles::empty` APIs are updated to return a primitive object with the default value if the given type is a primitive value type. These methods return null if the given type is a value class and a primitive reference type.

The MethodHandles::constant method will throw `NullPointerException` if the given type is a primitive value type and the given value is null.   That's the same behavior as the `int` type but such case is missing in the spec.

-------------

Commit messages:
 - Further clean up
 - JDK-8281073: [lworld] Update MethodHandles::zero, empty, constant APIs for value classes

Changes: https://git.openjdk.java.net/valhalla/pull/644/files
 Webrev: https://webrevs.openjdk.java.net/?repo=valhalla&pr=644&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8281073
  Stats: 132 lines in 2 files changed: 126 ins; 0 del; 6 mod
  Patch: https://git.openjdk.java.net/valhalla/pull/644.diff
  Fetch: git fetch https://git.openjdk.java.net/valhalla pull/644/head:pull/644

PR: https://git.openjdk.java.net/valhalla/pull/644



More information about the valhalla-dev mailing list