Details
-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
17.7.0
-
None
-
Unknown
-
Description
When someone removes a field from a class by calling BaseClass#removeField(name), and then adds this field back by calling BaseClass#addField(name, field), the field is added to fieldsToRemove by #removeField but not removed from it by addField, which can lead to issues.
A workaround is to notice this and use getFieldsToRemove and #setFieldsToRemove. Documentation for these methods should probably be added to make it clear how they should be used and what for, including the fact that one can add or remove a field by modifying the returned list (i.e. getFieldsToRemove does not return a (immutable) copy of the list.
By the way, is this list strictly necessary? Should it be indeed public?