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

need code example for getting canonical constructor of a Record

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 17
    • None
    • core-libs
    • b21

      There's no utility method for getting a Record's canonical constructor reflectively. However, it's fairly simple to do given the array of record components. This message suggests this is sufficient if there is an example in the javadoc:

      https://mail.openjdk.java.net/pipermail/amber-spec-experts/2019-September/001607.html

      However, there is no such example. One needs to be added.

      Adding the example to Class::getRecordComponents seems reasonable. It might be useful to add a link to it from the java.lang.Record class specification, where it defines the record component concept.

            tvaleev Tagir Valeev
            smarks Stuart Marks
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: