Assertion objects in ADL parser

Hi all,

I have recently detected a small issue when serializing archetypes into ADL with the ADL serializer. The problem is that the serializer relies on that the string expression of Assertion objects (found in includes and excludes of ArchetypeSlot objects) is set, but the ADL parser always sets it to null.

I think it would be good from a maintenance point of view if the ADL serializer could output Assertion objects only by using the string expression, hence relieving it of the tedious job of outputting all the various enumerated operators, expressions etc. I believe the parser could easily set the string expression of the Assertion objects it creates just by reading the lines that adhere to them.

Would it be possible to make this change or is there an explicit need to loop through the expression items in the serializer and output them “manually”?

Regards,

Mattias

Hi Mattias,

Thanks for raising this issue. Please find my comments below.

Hi all,

I have recently detected a small issue when serializing archetypes into ADL with the ADL serializer. The problem is that the serializer relies on that the string expression of Assertion objects (found in includes and excludes of ArchetypeSlot objects) is set, but the ADL parser always sets it to null.

The reason for the paser to send in null value for stringExpression is it’s tricky to get the whole expression string during parsing. Since it’s an optional (0..1) attribute, it is correct implementation according to the spec. The second argument for not having stringExpression value is that the same information can be re-produced by other member attributes (as an improvement of current code, we could remove it from the constructor). I would recommend implementing getStringExpression() by looping through member attributes.

I think it would be good from a maintenance point of view if the ADL serializer could output Assertion objects only by using the string expression, hence relieving it of the tedious job of outputting all the various enumerated operators, expressions etc. I believe the parser could easily set the string expression of the Assertion objects it creates just by reading the lines that adhere to them.

You are welcome to sumbit a patch if you find out how to do it :wink:

Regards,
Rong