Bug 260215 - The alreadyAddedElements is not needed
Summary: The alreadyAddedElements is not needed
Status: RESOLVED FIXED
Alias: None
Product: DLTK
Classification: Technology
Component: Common (show other bugs)
Version: 1.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: dltk.common-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks: 250580
  Show dependency tree
 
Reported: 2009-01-07 02:13 EST by Q.S. Wang CLA
Modified: 2009-04-19 03:30 EDT (History)
3 users (show)

See Also:


Attachments
Patch to remove the set. (2.09 KB, patch)
2009-01-07 02:13 EST, Q.S. Wang CLA
no flags Details | Diff
Change the set to local variable. (2.21 KB, patch)
2009-01-07 22:47 EST, Q.S. Wang CLA
no flags Details | Diff
Patch that fixes duplicate entries (3.36 KB, text/plain)
2009-04-18 14:21 EDT, Michael Spector CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Q.S. Wang CLA 2009-01-07 02:13:01 EST
Build ID: 3.5  I20081211-1908

Steps To Reproduce:
See Bug 250554.

More information:
Looks the alreadyAddedElements fields keeps the status of retrieved children. But I can't see the reason for it. Because of this the addTypeChildren method will ignore the retrieved children, which caused the bug 250554.
Since the getChildren() should return the real time children,I don't know why we need that alreadyAddedElements set.
Patch applied
Comment 1 Q.S. Wang CLA 2009-01-07 02:13:59 EST
Created attachment 121772 [details]
Patch to remove the set.
Comment 2 Michael Spector CLA 2009-01-07 08:57:56 EST
Applied patch into CVS.
Comment 3 Alex Panchenko CLA 2009-01-07 10:08:05 EST
Reopening.
In Ruby class could be defined in multiple files.
This check was needed to prevent multiple occurrences of the same class in the type hierarchy. So this check should not be simply removed, probably it should be moved to other place.
Comment 4 Q.S. Wang CLA 2009-01-07 22:46:22 EST
Thanks Alex for pointing out it.
I guess we don't want to add duplicate Class in the List, but do we need a class field to keep this state? Can we just use a method level variable?
Please review my new patch to see if it's all right, since I don't know how to setup the Ruby case.
Comment 5 Q.S. Wang CLA 2009-01-07 22:47:36 EST
Created attachment 121908 [details]
Change the set to local variable.
Comment 6 Roy Ganor CLA 2009-04-16 03:32:35 EDT
1. adding back the alreadyAddedElements  for Ruby implementation as Alex requested.
2. removing the redundant field alreadyAddedElements  to a local variable

Thanks,
Comment 7 Michael Spector CLA 2009-04-18 14:21:48 EDT
Created attachment 132335 [details]
Patch that fixes duplicate entries

I suggest converting List to Set in order to eliminate duplicate file entries, like in AAA and BBB in following picture:

Object
 file1.rb
 file2.rb
|
+--- AAA
      a.rb
      a.rb
|
+--- BBB
      b.rb
      b.rb
Comment 8 Michael Spector CLA 2009-04-18 14:22:52 EDT
Reopening, since the behavior is still wrong (duplicate file entries)
Comment 9 Michael Spector CLA 2009-04-19 03:30:12 EDT
Fixed in CVS.