I am having some trouble using Jenkins property.jelly propertyDescriptor field. After doing some research, I found the propertyDescriptor attribute implementation is confusing.
Here is the code:
See this line:
<j:set var="descriptor" value="${attrs.propertyDescriptor ?: app.getDescriptorOrDie(descriptor.getPropertyTypeOrDie(instance,field).clazz)}" />
I assume that ?: is the ternary operator in Jelly? However, it essentially says: if ${attrs.propertyDescriptor} is set, set "descriptor" to nothing, otherwise set "descriptor" to app.getDescriptorOrDie( ... )
Shouldn't it be:
<j:set var="descriptor" value="${attrs.propertyDescriptor ? ${attrs.propertyDescriptor : app.getDescriptorOrDie(descriptor.getPropertyTypeOrDie(instance,field).clazz)}" />
Is this a bug in property.jelly?
I think I have got the answer, it's called Elvis operator