Bug 76761

Summary: [model] ImportContainer.hasChildren() should not return true
Product: [Eclipse Project] JDT Reporter: Rodrigo Peretti <rodrigo>
Component: CoreAssignee: Jerome Lanneluc <jerome_lanneluc>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.1   
Target Milestone: 3.1 M5   
Hardware: PC   
OS: Windows XP   
Whiteboard:

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