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

need code example for getting canonical constructor of a Record

    XMLWordPrintable

Details

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

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: