Bug 387925 - No expected types in foreach loop available
Summary: No expected types in foreach loop available
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.2   Edit
Hardware: PC All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-23 14:52 EDT by Marcel Bruch CLA
Modified: 2012-08-24 06:17 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 Marcel Bruch CLA 2012-08-23 14:52:54 EDT
Given the snippet below, I'd expect JavaContentAssistInvocationContext.getExpectedTyoe() to  return "File" but I receive null:


File base = new File("data");
for(File f : base.list$){


As consequence, JDT code completion proposes all proposals and doesn't rank those completions that actually return files on top (listFiles() in this case).
Comment 1 Marcel Bruch CLA 2012-08-24 01:59:29 EDT
One addition: It's not clear which type to propose here but File[] and Iterable<File> seems suitable for me. 


Side question: Since building super-/subtype hierarchies is too slow for code completion, are there any means how to perform super type lookups extremely fast? Is there some index that could do this - or - are there any thoughts on this?