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

Class.getSimpleName() returns non-empty for lambda and method

    XMLWordPrintable

Details

    • b14
    • x86_64
    • windows_10
    • Verified

    Description

      A DESCRIPTION OF THE PROBLEM :
      The documentation for `java.lang.Class.getSimpleName()` says:
      > Returns the simple name of the underlying class as given in the source code.

      Lambdas and method references do not exist as class in the source code, so they have no name. Yet for both `getSimpleName()` returns a non-empty string.


      ---------- BEGIN SOURCE ----------
      Runnable r = () -> {}
      assert r.getClass().getSimpleName().isEmpty();

      Runnable r2 = r::run;
      assert r2.getClass().getSimpleName().isEmpty();
      ---------- END SOURCE ----------

      Attachments

        Issue Links

          Activity

            People

              darcy Joe Darcy
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: