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

j.l.Record need to mention that canonical constructor may not be public

    Details

    • Subcomponent:
    • Resolved In Build:
      b27

      Description

      With JEP 384 intergated the specification for j.l.Record still says:
      "A record class has the following mandated members: a public canonical constructor, whose descriptor is the same as the record descriptor"

      However as experiments show, canonical constructor may not be public.
      The following code since JDK15 b24

      public class Test {
          public static void main(String[] args) {
              System.err.println( R.class.getConstructors().length);
              System.err.println( PubR.class.getConstructors().length);
          }
          record R(int i) { }
          public record PubR(int i) {}
      }


      started to print

      0
      1

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                vromero Vicente Arturo Romero Zaldivar
                Reporter:
                dbessono Dmitry Bessonov
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: