On Tue, 16 Jan 2024 01:47:51 GMT, David Holmes <dhol...@openjdk.org> wrote:
>> My suggestion is to be used in combination with this change: >> >> >> _filename("filename", "Name of the map file", "STRING", false, >> DEFAULT_PERFMAP_FILENAME) >> >> >> So the help message will be printed as: >> >> >> *filename*: (Optional) The name of the map file (STRING /tmp/perf-<pid>.map) > > But that only works if `init_value` is never called, else `is_set` will be > true. This seems a rather fragile way to have the "default string" available > for the help command, but avoiding actually using it as a default value. > > That said, after having a much deeper look at how this all hangs together, it > may be this will have to suffice, at least for now. Really we need a way to > express that the default-string is only intended for providing the help > information it is not actually intended to be parsed to "generate" the > default value. But I will also note that part of the problem here is that the > DCmd help needs to report the default filename, but the DCmd is not actually > responsible for establishing what that default is - we have to hard-wire into > the DCMd help knowledge of what the underlying API does. For the dcmd help output, we could take a dynamic approach and have the dcmd call an API (which does not currently exist) which is responsible for generating the default file name. For CDS, this would have to be an upcall to java since that is where the default filename is currently generated. ...or we could just punt on this for now and continue with not actually specifying the default in the help output or the man page. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/17359#discussion_r1452862140