RFR (M): JDK-8020614: [TESTBUG] OutputAnalyzer.shouldHaveExitValue() should print stdout/stderr output

David Holmes david.holmes at oracle.com
Mon Jul 29 20:16:46 PDT 2013


On 30/07/2013 2:12 AM, Mikhailo Seledtsov wrote:
> Hi David,
>
>   Thank you for the review and a style advice. I have updated my code
> changes to use StringBuilder for string concatenation that occurs inside
> a loop.

Thanks. One minor nit (no need for re-review)

.append(" ")

is better as

.append(' ')

Cheers,
David

> I assume that string concatenations that are not inside a loop can
> continue using '+' operand, as they did before my changes, since Java
> compiler will optimize them to use StringBuilder. Please let me know if
> you would like me to change them to use StringBuiler as well.
>
> The updated webrev is posted at:
> http://cr.openjdk.java.net/~mseledtsov/8020614/webrev.01/
> <http://cr.openjdk.java.net/%7Emseledtsov/8020614/webrev.01/>
>
>
> Thank you,
> Misha
>
> On 7/29/2013 1:34 AM, David Holmes wrote:
>> Hi Mikhailo,
>>
>> On 27/07/2013 12:04 AM, Mikhailo Seledtsov wrote:
>>>
>>> This change adds reporting functionality to the JTREG test library. If
>>> error occurs during test run, the diagnostic summary will be printed
>>> consisting of a standard output, standard error and an exit code. The
>>> command line will be printed all the time, regardless of error
>>> encounter.
>>>
>>> Webrev:
>>> http://cr.openjdk.java.net/~mseledtsov/8020614/webrev.00/
>>> <http://cr.openjdk.java.net/%7Emseledtsov/8020614/webrev.00/>
>>
>> Style nit:
>>
>> Using string concatenation with string references is really poor style
>> as you create numerous unnecessary Strings (potential JIT
>> optimizations aside). If you are concatenating Strings then use a
>> StringBuilder instead:
>>
>>  118     List<String> args = runtime.getInputArguments();
>>  119     String result = new String();
>>  120     for (String arg : args)
>>  121         result += (arg + " ");
>>  122
>>  123     return result;
>>
>> becomes
>>
>>      List<String> args = runtime.getInputArguments();
>>      StringBuilder result = new StringBuilder();
>>      for (String arg : args)
>>          result.apped(arg).append(' ');
>>      return result.toString();
>>
>> and similarly elsewhere.
>>
>> Thanks,
>> David
>>
>>> Bug:
>>> https://jbs.oracle.com/bugs/browse/JDK-8020614
>>>
>>> Thank you,
>>> Misha
>


More information about the hotspot-runtime-dev mailing list