JDK 9 RFR of JDK-8161500: Use getTypeName and StringJoiner in core reflection toString methods

joe darcy joe.darcy at oracle.com
Mon Jul 18 17:25:16 UTC 2016


Hi Claes,


On 7/15/2016 4:55 PM, Claes Redestad wrote:
> Looks OK, although I find:
>
> StringJoiner sj = StringJoiner(delimiter, before, after);
> ...
> sb.append(sj.toString());
>
> to be a messier read than:
>
> sb.append(before);
> StringJoiner sj = new StringJoiner(delimiter);
> ...
> sb.append(sj.toString())
>   .append(after);

For the usagse in Executable.java where the "(" and ")" are always 
issued, I switched back to appending those characters directly to the 
string builder.

>
> Any of these are ever used in a performance sensitive manner? I assume 
> no, but still curious. :-)

I would be shocked if these were used in a performance sensitive context :-)

Thanks for the review,

-Joe

>
> /Claes
>
> On 2016-07-16 01:17, Joseph D. Darcy wrote:
>> Hello,
>>
>> Please review this straightforward cleanup of some of the core
>> reflection implementation classes:
>>
>>      JDK-8161500: Use getTypeName and StringJoiner in core reflection
>> toString methods
>>      http://cr.openjdk.java.net/~darcy/8161500.1/
>>
>> All java/lang/Class and java/lang/reflect regression tests pass with
>> this patch.
>>
>> (If the fix for JDK-8054213: "Class name repeated in output of
>> Type.toString()" is pushed before this fix, a simple merge will be 
>> needed.)
>>
>> Thanks,
>>
>> -Joe



More information about the core-libs-dev mailing list