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

Lambda Spec: Clarify the return type of a reference to method getClass

XMLWordPrintable

    • Verified

      Object.getClass is unique in that the type of an invocation depends on the type of the receiver expression -- it is declared to return a Class<?>, but actually returns a Class<? extends T>.

      This is mentioned in JLS 4.3.2, but it is difficult to connect the dots from a method reference expression (4.3.2 only mentions a "method invocation expression").

      For clarity, the return type of 'getClass' should be made explicit in 15.12.2.6.

            dlsmith Dan Smith
            dlsmith Dan Smith
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: