ObjectMethods.bootstrap missing getter validation

XMLWordPrintable

    • Type: CSR
    • Resolution: Approved
    • Priority: P4
    • 27
    • Component/s: core-libs
    • None
    • behavioral
    • low
    • Exceptions changed, but users are not expected to programmatically handle such exceptions, and most calls to this method are generated correctly by compilers like javac.
    • Java API
    • Implementation

      Summary

      Add missing validation to java.lang.runtime.ObjectMethods::bootstrap for its getters argument.

      Problem

      bootstrap specifies if any argument is invalid or inconsistent, it throws IllegalArgumentException. However, when a method handle in getters misbehave in one of the three ways:

      1. Returns void
      2. Not exactly one receiver argument
      3. Receiver argument is not of the recordClass type

      This method proceeds without initial checks and throws generic exceptions from method handle infrastructures later, making the exceptions confusing.

      Solution

      Add checks for these 3 conditions so such getter method handles are rejected early on with an IllegalArgumentException.

      Specification

      None. This is purely a behavioral change.

            Assignee:
            Chen Liang
            Reporter:
            Chen Liang
            Jorn Vernee
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: