RFR: JDK-8255544: Create a checked cast

Andrew Haley aph at openjdk.java.net
Wed Oct 28 15:56:56 UTC 2020


In many places we've added C-style casts to silence compiler warnings, for example when truncating a size_t to an int when we know the size_t is a small struct. Such casts are inherently risky, because they effectively disable useful compiler warnings. We should add a form of cast that checks at runtime that a truncation does not overflow.

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

Commit messages:
 - JDK-8255544: Create a checked cast

Changes: https://git.openjdk.java.net/jdk/pull/904/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=904&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8255544
  Stats: 15 lines in 1 file changed: 15 ins; 0 del; 0 mod
  Patch: https://git.openjdk.java.net/jdk/pull/904.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/904/head:pull/904

PR: https://git.openjdk.java.net/jdk/pull/904


More information about the hotspot-dev mailing list