New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for non-public record declarations #27437
Comments
@ModelBinding
in Spring MVC@ModelAttribute
in Spring MVC
This is a visibility issue because |
It turns out that this is indeed a visibility issue since the Java compiler generates the implicit record constructor as package-visible if the record type itself is also package-visible. We do not insist on the type itself being public, just on the constructor being public; a custom package-visible data class with a public constructor works fine already. Since constructor visibility is not specifically declared by the user in case of a record, this is a rather unpleasant case. I've revisited our I'll repurpose this issue accordingly. Our general advice remains that record types should be declared public, but anyway, we'll leniently handle such non-public scenarios as of 5.3.11 - for record types as well as custom data classes with a single non-public constructor. That said, method visibility still follows JavaBean setter/getter rules; we're not going to bend those for 5.3.x at all. |
@ModelAttribute
in Spring MVC@ModelAttribute
in Spring MVC
@ModelAttribute
in Spring MVC
Addressing this at |
This might be possible, and I just couldn't find the documentation or make it work, but in essence it feels like it should be possible to bind form payloads to a Java 14 record via the constructor
Thanks for your consideration, and I apologize if this has already been solved.
The text was updated successfully, but these errors were encountered: