Variable names can't have upper case letter within their second place with databoundsetter annotation?

Hi,

I made some refactoring moving tens of my plugin variables out of the constructor for a databoundsetter annotation.

Eventfully I have left with Jenkins keep complaining about 3 of them with the “Missing required parameter” error during pipeline script.

After some hours of trail and error, I finally noticed that the only thing different with them (2 Strings, one Boolean) is that unlike the rest of the variables - they contain an upper case letter within their second place:

vMGRBuildArchive
vSIFName
vSIFInputFile

Respectively, their databoundsetter will looks like:

@DataBoundSetter
public void setVMGRBuildArchive(boolean vMGRBuildArchive) {
     this.vMGRBuildArchive = vMGRBuildArchive;
}

I did another try and changed vMGRBuildArchive to vmGRBuildArchive (and all getters & setters respectively), and that solved the issue.

Are there any restrictions for variable names having upper case letter within their second place?

Plugin Code Before Any Change

Thanks,

Tal.

It’s been a while since I did java dev but it’s either pojo or java beans standard notation. So it’s supposed to match the variable casing (except first letter after set)

Yes, this is a limitation in our data binding.

When using @DataBoundSetter I would recommend to not use Hungarian notation at all (actually I would not use it anywhere :smiley:).

So a user will prefer something like

step.setBuildArchive("archive")

and not the ugly version

step. setVMGRBuildArchive("archive")

Thanks Ulli, but I didn’t understand the proposal. Is there a way I can move forward without breaking backwards compatibility?

Yes, simply introduce the new setters and getters. Map all old getters and properties to the new ones.

But we have users who call from within the pipeline script with vMGRBuildArchive: true
How do I keep supporting them when I remove vMGRBuildArchive from the DataBoundConstructor?

I’m not sure, if multiple constructors are supported (one with the old signature, and one empty). But I assume that this is not possible.

Then you either need to fix the Stapler bug, introduce a new step, or stay with the existing names.

Thanks, then I will leave 3 names within the BoundConstractors