Extra remove line in generated composition code when the delete operation should do this already #976

Open
TimLethbridge opened this Issue Jan 26, 2017 · 0 comments

Projects

None yet

2 participants

@TimLethbridge
Member

In the following Umple code:

class A {
  1 -- * B;
  1 <@>- * C;
}
class B {
}
class C {
}

The resulting generated code is

238. public void delete()
239. {
240.   for(int i=bs.size(); i > 0; i--)
241.   {
242.     B aB = bs.get(i - 1);
243.     aB.delete();
244.   }
245.   while (cs.size() > 0)
246.   {
247.     C aC = cs.get(cs.size() - 1);
248.     aC.delete();
249.     cs.remove(aC);
250.   }
251.
252. }

Line 249 seems unnecessary as the 'delete' ought to result in the removal already.

This code is for composition in which when the whole is removed, the parts are also removed.

The remove is needed in ordinary associations, however.

@vahdat-ab vahdat-ab added the ucosp label Jan 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment