RFR: JDK-8374395 : Improve MemoryUsage.toString() and constructor error messages for better clarity [v2]
Eunbin Son
duke at openjdk.org
Wed Dec 31 09:38:10 UTC 2025
> ### Summary
> MemoryUsage.toString() now displays "N/A" for undefined init and max values (-1) instead of "-1(-1K)".
>
> This addresses the first of three issues in JDK-8374395.
>
> ### Description
> When init or max is -1 (undefined), toString() outputs "-1(-1K)". The Javadoc states that -1 means undefined, but the output does not clearly indicate this.
>
> toString() checks if init or max equals -1 and outputs "init = N/A" or "max = N/A" respectively. Output format for valid values remains unchanged.
>
> Added test cases to the existing jtreg test file. All tests pass.
>
> ### Bug-ID : JDK-8374395
> https://bugs.java.com/bugdatabase/view_bug?bug_id=JDK-8374395
Eunbin Son has updated the pull request incrementally with one additional commit since the last revision:
8374395: Add JUnit test for MemoryUsage.toString() undefined values
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/29009/files
- new: https://git.openjdk.org/jdk/pull/29009/files/479857d0..413e3c12
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=29009&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=29009&range=00-01
Stats: 175 lines in 2 files changed: 87 ins; 88 del; 0 mod
Patch: https://git.openjdk.org/jdk/pull/29009.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/29009/head:pull/29009
PR: https://git.openjdk.org/jdk/pull/29009
More information about the core-libs-dev
mailing list