On Wed, 31 Dec 2025 09:38:10 GMT, Eunbin Son <[email protected]> wrote:
>> ### 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 > When `init` or `max` is `-1` (undefined), `MemoryUsage.toString()` outputs > `"-1(-1K)"`, which is confusing. While Javadoc states that `-1` means > undefined, the output does not clearly indicate this, making it difficult for > users to distinguish undefined values from actual negative values. Hi. When does this happen? When is a MemoryUsage created with init or max as -1 ? When is it then printed using toString() for a user to understand, and when would the user then have to distinguish between the -1 which suggests a problem, and "actual negative values"? ------------- PR Review: https://git.openjdk.org/jdk/pull/29009#pullrequestreview-3630703891
