[Task Architecture] Infinite recursion when deriving type sizes
Deriving the message sizes for Structure
s in org.fortiss.af3.platform.utils.PlatformArchitectureUtils.getDataTypeSizeBits(ITypeDefinition, Collection<TypeSize>)
causes an infinite recursion.
Description
The method calculates the size of a Structure
by summing up the type size of its members.
For some reason, the code loops over the members, making a recursive method call passing member.getStructure()
as argument. However, the getStructure()
method implemented in org.fortiss.af3.expression.model.definitions.impl.StructureMemberStaticImpl.getStructure(StructureMember)
returns again the Structure
containing the member. The parent calling the method on the child and the child, in turn, calling it on the parent again causes the infinite loop.
Note
At fist glance, removing the loop seems to solve the problem while retaining the correct calculation of type sizes.