On Fri, 8 May 2026 16:06:27 GMT, Kevin Walls <[email protected]> wrote:
>> Do you agree that `provider.attachVirtualMachine(id, Map.of())` and >> `provider.attachVirtualMachine(id)` should be equivalent? >> >> (This goes to the question as to whether an empty map should invoke the >> 1-arg method rather than throw UOE) > > Currently core file attach needs the method that takes the Map env. > > An empty Map is fine, the settings in there are optional, not always required > (i.e. library/JVM location can be located at path in core file, cache can be > written). > > It might be a tiny bit simpler to understand if they are equivalent, but it > may leave a trap: I like having the two methods NOT equivalent, as this > makes the tool author know that for core files, the env is required > sometimes, and if you don't facilitate passing it then there will be problems > for some tool users. > > JCmd.java is the only tool in question right now and with this change that > uses attach(String id, Map<String, ?> env). > > Happy to hear any thoughts either way 8-) If the id parses as an integer and the map is empty then you should be able to make them equivalent. That would be the least surprising way for the overload to work. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/31011#discussion_r3209910333
