What is the maximum number of properties (“record components”, technically) defined in a Java record?
I read the specification, JEP 395: Records. No mention of a limit.
Due to the limit on method descriptor length, the maximum number of parameters a method can define is 255. Including the this
, since a record constructor is non-static, that leaves 254.
See Java Virtual Machine Specification, 4.3.3. Method Descriptors
I believe a record must have at least one constructor that takes all properties as individual parameters, so this would effectively limit the number of record components.