On Wed, 13 Apr 2022 22:20:14 GMT, XenoAmess <d...@openjdk.java.net> wrote:

>> 8186958: Need method to create pre-sized HashMap
>
> XenoAmess has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   update LastModified

src/java.base/unix/classes/java/lang/ProcessEnvironment.java line 102:

> 100:     /* Only for use by Runtime.exec(...String[]envp...) */
> 101:     static Map<String,String> emptyEnvironment(int capacity) {
> 102:         return new StringEnvironment(HashMap.newHashMap(capacity));

This change is correct, since this is called with the length of an array that's 
used to populate the environment. It really should be named `size` instead of 
`capacity`. However the windows version of this code simply calls 
`super(capacity)` as it's a subclass of `HashMap`, which is wrong. Well, 
probably not worth changing this now. We may need to revisit this later to do 
some cleaning up. (And also the strange computation in the static initializer 
at line 71.)

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

PR: https://git.openjdk.java.net/jdk/pull/7928

Reply via email to