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

Bug 410796

Summary: Organize imports adds unused import
Product: [Eclipse Project] JDT Reporter: Caspar D. <caspar_d>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: jarthana
Version: 4.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard: stalebug
Attachments:
Description Flags
Java code to reproduce the problem none

Description Caspar D. CLA 2013-06-14 05:41:13 EDT
Created attachment 232375 [details]
Java code to reproduce the problem

See attached Java source code. (Requires EMF to compile.)

The 'organize imports' feature will add an import of java.util.Map.Entry in this source file (see line 2), which is unnecessary. The compiler issues a warning about it.

(I don't know *why* the import is unnecessary, but that's what the compiler says. And sure enough, when I disable the 'organize imports' feature and remove the import, it compiles okay.)
Comment 1 Caspar D. CLA 2013-06-14 05:59:16 EDT
PS. The reason I didn't provide a simpler example (i.e. one without the EMF dependency) that reproduces the behavior , is that I was unable to do so. A simple iteration over the map entries in a main() method, *does* require the import. I don't know what it is about my code that makes the import unnecessary, but as stated that's what the compiler reports.
Comment 2 Jay Arthanareeswaran CLA 2013-06-17 02:04:41 EDT
Reproduced in 4.3 RC4. Will take a look at in 4.4.
Comment 3 Eclipse Genie CLA 2020-05-20 11:59:10 EDT
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.