Review request for 7034570 - java.lang.Runtime.exec(String[] cmd, String[] env) can not work properly if SystemRoot not inherited

Ulf Zibis Ulf.Zibis at gmx.de
Sun Apr 17 17:27:23 UTC 2011


Am 16.04.2011 16:45, schrieb David Schlosnagle:
> One minor nit in ProcessEnvironment.java
>
>   336     private static void addToEnv(StringBuilder sb, String name,
> String val) {
>   337         sb.append(name+"="+val+'\u0000');
>   338     }
>
> I think it should be as follows to avoid implicitly constructing
> another StringBuilder and the extra copying overhead;
>
>   336     private static void addToEnv(StringBuilder sb, String name,
> String val) {
>   337         sb.append(name).append('=').append(val).append('\u0000');
>   338     }
>

Because this suggestion was from me, I must admit, that I didn't prove, if javac actually uses the 
existing StringBuilder sb, or forces another StringBuilder to instantiate. I just assumed, javac 
would use the existing one. So to be done:
- examine the byte code
- if not yet optimized: then new RFE for javac

Sorry, if I was wrong.

-Ulf




More information about the core-libs-dev mailing list