Bug 22894 - Improperly formed ICompilationUnit?
Summary: Improperly formed ICompilationUnit?
Status: RESOLVED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.1 M2   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-08-27 11:46 EDT by Justin Berstler CLA
Modified: 2002-10-03 09:25 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.