Bug 306477

Summary: Indexer(?) fails to recognise enum as a type
Product: [Eclipse Project] JDT Reporter: Chris West (Faux) <eclipse>
Component: CoreAssignee: Frederic Fusier <frederic_fusier>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: P3 CC: jarthana, Olivier_Thomann, satyam.kandula
Version: 3.6   
Target Milestone: 3.6 M7   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Sample project (opfail)
none
Screenshot showing problem
none
Proposed patch none

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