Bug 76761 - [model] ImportContainer.hasChildren() should not return true
Summary: [model] ImportContainer.hasChildren() should not return true
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M5   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-10-21 13:31 EDT by Rodrigo Peretti CLA
Modified: 2005-02-15 07:15 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rodrigo Peretti CLA 2004-10-21 13:31:46 EDT
Eclipse 3.0

The current implementation of ImportContainer.hasChildren() is:

/**
 * Import containers only exist if they have children.
 * @see IParent
 */
public boolean hasChildren() {
	return true;
}

So the implementation should be:

/**
 * Import containers only exist if they have children.
 * @see IParent
 */
public boolean hasChildren() {
	return exists();
}

It took me sometime to figure out why getChildren() was throwing an exception 
and hasChildren() was returning true. That is why I'm suggesting the change.
Comment 1 Jerome Lanneluc CLA 2005-01-06 10:37:18 EST
Removed implementation of ImportContainer#hasChildren() so that the super
implementation is used. This now follows the spec that says that a
JavaModelException must ne thrown if the element does not exist. An import
container exists only if it has at least one children.

Added regression test CompilationUnitTests#testImportContainerHasChildren()
Comment 2 David Audel CLA 2005-02-15 07:15:54 EST
Verified in I20050214-0927