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

LambdaMetafactory: validate inputs and improve documentation

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P4
    • Resolution: Approved
    • Fix Version/s: 13
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Compatibility Kind:
      behavioral
    • Compatibility Risk:
      minimal
    • Compatibility Risk Description:
      Clients who provide invalid arguments may see new or different exceptions.
    • Interface Kind:
      Java API
    • Scope:
      SE

      Description

      Summary

      Document and enforce the conditions under which invalid arguments will cause a RuntimeException to be thrown by the LambdaMetafactory methods.

      Problem

      The LambdaMetafactory methods fail to validate their inputs. When invoked directly (as opposed to standard usage by javac), invalid arguments lead to unspecified, ad hoc RuntimeExceptions or other surprising behavior.

      Solution

      Specify four exceptions that can be thrown: LambdaConversionException, NullPointerException, IllegalArgumentException, and SecurityException. Describe the conditions under which they will be thrown.

      This is a behavioral change: certain nonstandard usages of LambdaMetafactory will result in new or different exceptions.

      Also make some clarifying revisions to specification, such as more accurately naming parameters to reflect their behavior rather than the specific way javac uses them.

      Specification

      Webrev diff of LambdaMetafactory.java is attached.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dlsmith Dan Smith
                Reporter:
                dlsmith Dan Smith
                Reviewed By:
                Brian Goetz
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: