For Q1, I'm not sure how data bound constructor works with inherited classes. I think you would need to avoid annotating the base class's constructor and instead annotate the derived class's constructor. Alternatively, if everything is using data bound setters, that would likely work as is. I'm not sure what happens if a parent class and a child class both have data bound constructors (probably a runtime exception of some sort).
For Q2, this has something to do with the Jenkins API for Descriptor/Describable. Typically, you can use a no-arg constructor in your Descriptor class to call Descriptor's default constructor which uses reflection to determine the proper class argument. For more advanced scenarios, you may need to pass an explicit class reference to the constructor, but my guess is that more so affects users changing APIs while remaining backward compatible with particular types. On Wed, May 22, 2019 at 9:26 AM Yufei Zhang <affei...@gmail.com> wrote: > > Hi developers, GSoC mentors and students like me, > > I met some questions reading the codebase of > external-workspace-manager-plugin, and they should appear in other jenkins > plugins as well. So these are quite general and I wonder they might help > students like me understand jenkins better. Hope someone can answer them and > welcome to post your questions under this. The source code is : > https://github.com/jenkinsci/external-workspace-manager-plugin > > supposing we are under working directory : > external-workspace-manager-plugin/src/main/java/org/jenkinsci/plugins/ewm > > > QUESTION 1 : in file ~/definitions/Disk.java > > The Disk class is a concrete class, but now I want to change it to a base > class so I there can be more disk types with specific targets. What should I > do to turn it into a base class properly ? for example : should I keep the > @DataBoundConstructor annotations on the constructor ? Should I move the > nested static descriptor class outside the origin class(since we declared a > final attribute, which make it non-abstract) ? > > > QUESTION 2 : in file ~/DiskInfoProviderDescriptor.java line 23 > > How to analyze this line : public DiskInfoProviderDescriptor(Class<? extends > DiskInfoProvider> clazz) {super(clazz);} > This is a more Java language problem. Why would we need derived class' > metadata passed to the Descriptor<DiskInfoProvider> (or when is this > constructor called) ? > > Thanks ! > Yufei Zhang > > -- > You received this message because you are subscribed to the Google Groups > "Jenkins Developers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to jenkinsci-dev+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jenkinsci-dev/8c78d8ff-7bbb-4e39-be8f-98b632fdbd4b%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- Matt Sicker Senior Software Engineer, CloudBees -- You received this message because you are subscribed to the Google Groups "Jenkins Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CAEot4oy%2BAtT%3DitnGvOtBQpuBDNBysC%3D5bKhegq7JV6t%3DBa_nPQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.