Skip to content

Support records for Describable #26573

@jglick

Description

@jglick

It would be nice to be able to use Records for Describable implementations. Would avoid some boilerplate and give you nice toString() etc. out of the box.

#10426 opens the door.

One problem I have yet to confirm, but likely: Stapler form binding generally assumes JavaBeans conventions like public Type getXxx(), whereas a record would by default only have public Type xxx().

@DataBoundConstructor can be applied to an explicit constructor without repeating fields, so that is fine. But @DataBoundSetter could not be used, meaning this approach would only be suitable for smallish structs with no optional fields. (Marking members @CheckForNull is not great for JCasC.)

Actually opening a form page seems to crash.

if (clazz.getClassLoader().getResource(name) != null)
is not null safe. Here the superclass Record is from the bootstrap class loader.

Probably depends on #26077.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions