Bug 306477 - Indexer(?) fails to recognise enum as a type
Summary: Indexer(?) fails to recognise enum as a type
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.6   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: 3.6 M7   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-19 02:47 EDT by Chris West (Faux) CLA
Modified: 2010-04-26 08:58 EDT (History)
3 users (show)

See Also:


Attachments
Sample project (opfail) (2.07 KB, application/x-zip-compressed)
2010-03-19 02:48 EDT, Chris West (Faux) CLA
no flags Details
Screenshot showing problem (56.23 KB, image/png)
2010-03-19 02:49 EDT, Chris West (Faux) CLA
no flags Details
Proposed patch (3.93 KB, patch)
2010-03-19 08:43 EDT, Frederic Fusier CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris West (Faux) CLA 2010-03-19 02:47:35 EDT
Build Identifier: I20100312-1448

Described is the testcase.  This actually happens more frequently than just directly after start in the source project (http://git.goeswhere.com/?p=catchlogger.git , with Expression and Op being the affected classes), but far less reproducibly.  I hope it's the same bug.

Attached project contains two files:
Alice.java: class Alice { Object j = Bob.CHARLIE; }
Misc.java: enum Bob { CHARLIE; }

If only Alice.java is open when Eclipse is starting up, the editor thinks that "Bob cannot be resolved to a variable".  This is /not/ reported in the Problems view.

Go to definition / any other completion etc. does not work on Bob inside Alice.java.

Starting Eclipse with Misc.java open, however, makes this problem Go Away; Alice.java presents fine in the editor and Bob's completion etc. works fine.

Sometimes saving Alice.java / Misc.java make the problem go away, too; not entirely sure on the combinations.

(I'm wildly guessing that the indexer indexes the open files before the others, and reindexes in an unpredictable order)

The attached screenshot shows only Alice.java open in an editor directly after Eclipse has started.  Brand new workspace / project.

Reproducible: Always

Steps to Reproduce:
Thorough steps:
1. Start Eclipse with a clean workspace.
2. Import -> Existing projects into workspace.
3. Give it the directory containing the extracted attached sample project.
4. Open Alice.java (and /only/ Alice.java) in an editor (you may see the problem here).
5. Restart Eclipse with this workspace.
6. Alice.java should be open, and Bob should be redunderlined in the current view.
Comment 1 Chris West (Faux) CLA 2010-03-19 02:48:25 EDT
Created attachment 162494 [details]
Sample project (opfail)
Comment 2 Chris West (Faux) CLA 2010-03-19 02:49:49 EDT
Created attachment 162495 [details]
Screenshot showing problem

Eclipse Win64 on Vista (obviously) on Sun 1.6u18.
Comment 3 Frederic Fusier CLA 2010-03-19 06:01:52 EDT
That comes to an invalid indexing enum which are declared as secondary types...

This is not a regression and I guess exists since day 1.
Comment 4 Frederic Fusier CLA 2010-03-19 08:43:21 EDT
Created attachment 162515 [details]
Proposed patch

The secondary flag was set on the enum constant instead of the enum declaration...
Comment 5 Frederic Fusier CLA 2010-03-19 08:45:46 EDT
(In reply to comment #4)
> Created an attachment (id=162515) [details]
> Proposed patch
> 
Released for 3.6 M7 in HEAD stream.
Comment 6 Satyam Kandula CLA 2010-04-26 05:13:04 EDT
Verified for 3.6M7 using build I20100424-2000