Skip to content
Success

Changes

Summary

  1. Core: - Altered the task so that not only the order of direct super types (as given by the user) is being respected but also the implicated order of all classes at same inheritance tree stages. The following example model shows which problem has been solved: de : group = [ fhdw : group = [ parts : group = [ # represents a component which can be either a material or a product # A : class = { (); }; B : class = A +{ ()=A(); }; C : class = A + { ()=A(); }; X : class = { (); }; Y : class = X + { ()=X(); }; Z : class = X + { ()=X(); }; H : class = Z + Y + C + B + { ()=X()+A()+Z()+Y()+C()+B(); }; ]; ]; ]; when analyzing the inheritance tree of class H the resulting super constructor call order should be {X,Z,Y,A,C,B}. Before the change made in this commit the (wrong) result would have been as following: {A,X,Z,Y,C,B}. This is wrong because when iterating through the steps of the inheritance tree from left to right when respecting the order of direct super types as given by the user one will iterate over X first because its subclass Z occurs before any subclass of A. Additionally (and a much more important reason) with the wrong result the This-pointer of X and not the pointer of A would be available for the classes C and B. C and B however need the This pointer of A and should not see the this pointer of X. Moreover the new algorithm is much simpler compared to the old solution because the old solution needed to iterate over a map in a very complicated fashion whereas the new algorithm profits from the fact that the instaces of the inner class InheritanceTree run through the whole tree in the right order. Thus instead of comparing inheritance-tree-paths in the order from 'left' to 'right' to a copied collection of the same paths from 'left' to 'right' the comparison is now made with the paths from 'left' to 'right' with the reversed copy of paths (thus from 'right' to left).
Revision 4196 by hfi413te:
Core: - Altered the task so that not only the order of direct super types (as given by the user) is being respected but also the implicated order of all classes at same inheritance tree stages.
The following example model shows which problem has been solved:

de : group = [ fhdw : group = [ parts : group = [ # represents a component which can be either a material or a product # A : class = { (); }; B : class = A +{ ()=A(); }; C : class = A + { ()=A(); }; X : class = { (); }; Y : class = X + { ()=X(); }; Z : class = X + { ()=X(); }; H : class = Z + Y + C + B + { ()=X()+A()+Z()+Y()+C()+B(); }; ]; ]; ];

when analyzing the inheritance tree of class H the resulting super constructor call order should be
{X,Z,Y,A,C,B}.
Before the change made in this commit the (wrong) result would have been as following:
{A,X,Z,Y,C,B}.
This is wrong because when iterating through the steps of the inheritance tree from left to right when respecting the order of direct super types as given by the user one will iterate over X first because its subclass Z occurs before any subclass of A.
Additionally (and a much more important reason) with the wrong result the This-pointer of X and not the pointer of A would be available for the classes C and B. C and B however need the This pointer of A and should not see the this pointer of X.

Moreover the new algorithm is much simpler compared to the old solution because the old solution needed to iterate over a map in a very complicated fashion whereas the new algorithm profits from the fact that the instaces of the inner class InheritanceTree run through the whole tree in the right order. Thus instead of comparing inheritance-tree-paths in the order from 'left' to 'right' to a copied collection of the same paths from 'left' to 'right' the comparison is now made with the paths from 'left' to 'right' with the reversed copy of paths (thus from 'right' to left).
Change TypePath in RepositoryPath in Workspace
The file was modified/trunk/Workspace/Core/src/main/java/de/fhdw/wtf/walker/tasks/AnalyzeInheritanceTreesTask.javaCore/src/main/java/de/fhdw/wtf/walker/tasks/AnalyzeInheritanceTreesTask.java