latest changes in java.lang.Class

Joseph D. Darcy joe.darcy at oracle.com
Fri Jan 11 02:31:06 UTC 2019


Hello,

That does seem to be a bug in the changes I made for

     JDK-6304578: (reflect) toGenericString fails to print bounds of 
type variables on generic methods

The logic in methodToString is used to build messages for exceptions and 
the omission of the argument information is a likely cause for

     JDK-8213299: 
runtime/appcds/jigsaw/classpathtests/EmptyClassInBootClassPath.java 
failed with java.lang.NoSuchMethodException

I'll verify and send out a review for a corrected methodToString if that 
is the case.

Thanks,

-Joe

On 12/29/2018 11:23 PM, Сергей Цыпанов wrote:
> Hi,
>
> looking into Class::methodToString I've found some changes done into it recently in JDK 11 repository.
>
> Currently the method looks like this:
>
> private String methodToString(String name, Class<?>[] argTypes) {
>      StringBuilder sb = new StringBuilder();
>      sb.append(getName() + "." + name + "(");
>      if (argTypes != null) {
>          Stream.of(argTypes).map(c -> {return (c == null) ? "null" : c.getName();}).
>              collect(Collectors.joining(","));
>      }
>      sb.append(")");
>      return sb.toString();
> }
>
> Here result of Stream.collect() is ignored, i. e. even when condition argTypes != null is true nothing is appended to sb.
> It seems in this case we either don’t need this `if` branch or need to append to sb.
>
> Am I missing something?
>
> Kind regards,
> Sergey Tsypanov



More information about the core-libs-dev mailing list