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.
It would be nice to be able to use Records for
Describableimplementations. Would avoid some boilerplate and give you nicetoString()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 arecordwould by default only havepublic Type xxx().@DataBoundConstructorcan be applied to an explicit constructor without repeating fields, so that is fine. But@DataBoundSettercould not be used, meaning this approach would only be suitable for smallish structs with no optional fields. (Marking members@CheckForNullis not great for JCasC.)Actually opening a form page seems to crash.
jenkins/core/src/main/java/hudson/model/Descriptor.java
Line 930 in 0e852bd
Recordis from the bootstrap class loader.Probably depends on #26077.