Fixed!
The problem was that it was not possible to delete a RequireVersion Attribute
from a saved model. One could argue that this is good, since the RequireVersion
attribute is a precondition for the operation of the model. However, software
that tries to be too smart is annoying, and the reason that RequireVersion
could not be deleted is because of a bug, not because of intentional design.
The reason is because VersionAttribute.equals() matches on the version
expression. Thus, if we had a VersionAttribute that had the value 8.0.beta
and a RequireVersion that had the value 8.0.beta, then they were seen as being equal.
What happens is that when we read the model in, we have
VersionAttribute - which is in every model
RequireVersion - which is added by the user
When we delete RequireVersion, the equals() finds first VersionAttribute
at the top and probably deletes it.
The reason this only fails in a saved .xml file is that upon writing the
model is when the VersionAttribute is added.
The fix/workaround is to add equals(Object) and hashCode() to RequireVersion.