Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 408020

Summary: [content assist][templates] "foreach" doesn't properly import iterable's element type
Product: [Eclipse Project] JDT Reporter: Maxence Raoux <maxence.raoux>
Component: TextAssignee: JDT-Text-Inbox <jdt-text-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: minor    
Priority: P3 CC: apupier, jarthana, markus.kell.r, maxence.raoux
Version: 3.7.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard: stalebug

Description Maxence Raoux CLA 2013-05-14 10:22:07 EDT
Variable 
Set<Map.Entry<String, Object>> entry;

Enter "foreach" ans press enter. 

The generated methode is 
for (Entry<String, JSONObject> entry : entrySet) {}

It will be : 
for (Map.Entry<String, JSONObject> entry : entrySet) {}
Comment 1 Jay Arthanareeswaran CLA 2013-05-14 10:56:00 EDT
I see the reported behavior with Kepler I20130502-0800. Not sure what's going on. Will take a look at it.
Comment 2 Markus Keller CLA 2013-05-14 12:40:54 EDT
This is a bug in JDT Text.

CompilationUnitCompletion$Variable.getMemberTypeNames() line: 302 drops the qualifier without adding an import.

JavaContext#addImport(String) should be used, but I don't think we currently have the infrastructure to make this work properly if there are multiple choices for the member type name.
Comment 3 Eclipse Genie CLA 2020-01-25 15:26:40 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.