This issue has been created
 
 
XWiki Platform / cid:jira-generated-image-avatar-5a4841ed-af2e-4725-9497-3dbea36a2515 XWIKI-23525 Open

Calling PropertyClass#setNumber might have unattended side effects

 
View issue   ·   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-7cc29ac6-7287-4ba0-b62a-d5bde62ef09a Raphaël Jakse created this issue on 12/Sep/25 12:15
 
Summary: Calling PropertyClass#setNumber might have unattended side effects
Issue Type: cid:jira-generated-image-avatar-5a4841ed-af2e-4725-9497-3dbea36a2515 Bug
Affects Versions: 17.7.0
Assignee: Unassigned
Components: Old Core
Created: 12/Sep/25 12:15
Priority: cid:jira-generated-image-static-major-ffd2a446-20f5-4650-b27e-541abb86ba17 Major
Reporter: Raphaël Jakse
Description:

It might be tempting to call com.xpn.xwiki.objects.classes.PropertyClass#setNumber to reorder properties in a class, but this is likely to create inconsistencies as the fields are stored in a LinkedHashMap which is not reordered when calling this method.
What's more, nothing prevents someone from calling setNumber with the same number for several properties in a class.

This method should probably be updated to allow this usage, or a new api to reorder fields should probably be introduced.