Summary: | createPackageDeclaration on ICompilationUnit | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Pascal Rapicault <pascal> |
Component: | Core | Assignee: | Olivier Thomann <Olivier_Thomann> |
Status: | RESOLVED INVALID | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | ||
Version: | 2.1 | ||
Target Milestone: | 2.1 RC3 | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Whiteboard: |
Description
Pascal Rapicault
2003-03-08 21:03:38 EST
What would you expect ? This is a bogus situation... Do you get a JavaModelException? I think this is perfectly normal according to the specs. I would expect it to return the default package. There is no reason to create a package declaration for the default package, because the default package means that you DON'T have a package declaration. The API states that you need to provide a valid package name and "" is not a valid package name. For me the problem comes from the getPackageDeclaration(String) method. This method returns the default package declaration when called with an empty string. getPackageDeclarations() returns an empty list in case the compilation unit is in the default package. getPackageDeclaration(String) should throw a JavaModelException in case it is called with a name which is not a valid package name. This is not a bug. We follow the specs. "" is not a valid package name and therefore should not be used by createPackageDeclaration(...). |