Bug 22894

Summary: Improperly formed ICompilationUnit?
Product: [Eclipse Project] JDT Reporter: Justin Berstler <berstler>
Component: CoreAssignee: Jerome Lanneluc <jerome_lanneluc>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: P3    
Version: 2.0   
Target Milestone: 2.1 M2   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Justin Berstler CLA 2002-08-27 11:46:05 EDT
I am running into a problem with an ICompilationUnit from a Java file which has
a comment section and several blank lines before the package declaration.  The
getElement method (which I expect to return an IJavaElement) is returning null.
 However (and this is the really strange part), if I remove the comments and
blank lines to place the package delcaration on the first line of the Java file,
then the getElement method of this ICompilationUnit properly returns the
IJavaElement I expect.

I found this problem in a view which implements ISelectionListener.  The
selectionChanged method checks to see if the current selection in the Navigator
is an instanceof ICompilationUnit and if so gets the IJavaElement.
Comment 1 Philipe Mulet CLA 2002-09-19 08:38:43 EDT
Could you provide the exact test case ? 
Comment 2 Jerome Lanneluc CLA 2002-10-03 09:25:19 EDT
Please reopen if you have a test case.