RFR: 8178966: Don't swallow early bootstrap exceptions in Boolean.getBoolean, Integer.getInteger and Long.getLong

Eirik Bjørsnøs eirbjo at openjdk.org
Mon Nov 18 15:46:02 UTC 2024


On Mon, 18 Nov 2024 15:30:15 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

> Circumventing and duplicating the checks in System.getProperty isn't good coding technique and is not necessary for performance improvement or code size.

My understanding of JDK-8178966 is that the motivation was correctness rather than performance. 

`Boolean::getBoolean` and friends are not specified to throw `IAE` or `NPE`, but to return false `if the specified name is empty or {@code null}`. So the implementation must either check for null and emptiness, or it must catch the exceptions and hope they came from `System::checkKey` and nothing else.

I'm not sure what your alternative solution is here? Drop the PR / issue?

We can't simply drop the null and emptiness checks, since that could throw unspecified IAE/NPE.

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

PR Comment: https://git.openjdk.org/jdk/pull/22183#issuecomment-2483416370


More information about the core-libs-dev mailing list