Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8029100

(reflect) arrays of a lambda proxy class returns wrong name

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • 15
    • 8, 14
    • core-libs
    • None

      Peter wites:

      Speaking of names, the following test:

      package pkg;
        
      public class Test {
           public static void main(String[] args)
           {
               Runnable r = () -> {};
               Class<?> c = r.getClass();
               Class<?> ac = java.lang.reflect.Array.newInstance(c, 0).getClass();
               System.out.println("c: " + c.getName() + " / " + c.getSimpleName());
               System.out.println("ac: " + ac.getName() + " / " + ac.getSimpleName());
            }
      }
       

      Prints:

      c: pkg.Test$$Lambda$1/798154996 / Test$$Lambda$1/798154996
      ac: [Lpkg.Test$$Lambda$1; / Test$$Lambda$1/798154996[]
       
       
      I think the array class name is missing the trailing '/798154996' just before ';'

            mchung Mandy Chung (Inactive)
            jfranck Joel Borggrén-Franck (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: