Bug 60143 - Warning on import of java.util.Map.Entry
Summary: Warning on import of java.util.Map.Entry
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 minor (vote)
Target Milestone: 3.0 M9   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-04-27 13:03 EDT by Greg Jewell CLA
Modified: 2004-04-27 19:56 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 Greg Jewell CLA 2004-04-27 13:03:16 EDT
Eclipse warns that the import java.util.Map.Entry is not used, when in fact it is.
Comment 1 Philipe Mulet CLA 2004-04-27 17:30:38 EDT
Please provide steps to reproduce, build number etc... then reopen this defect.
Comment 2 Greg Jewell CLA 2004-04-27 17:38:28 EDT
Sample code to reproduce the problem:

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

public class MapEntryWarning
{
    public static void main(String[] args)
    {
        Map testMap = new HashMap();
        testMap.put("1", "1");
        testMap.put("2", "2");
        testMap.put("3", "3");
        
        Set entries = testMap.entrySet();
        Iterator iterator = entries.iterator();
        while(iterator.hasNext())
        {
            Map.Entry entry = (Map.Entry)iterator.next();
            System.out.println((String)entry.getValue());
        }
    }
}
Comment 3 Philipe Mulet CLA 2004-04-27 19:40:34 EDT
I see. Map.Entry is visible through the Map import, as we look for members of 
single type imports (following spec). If you remove it, there should be no 
error.
Comment 4 Greg Jewell CLA 2004-04-27 19:50:43 EDT
OK.  Thanks for the tip -- it worked as you said it would.

However, unless the import of Map.Entry is against specification, I would still
consider this to be a bug.  Obviously, it's a very minor one.
Comment 5 Philipe Mulet CLA 2004-04-27 19:56:44 EDT
Given it is not necessary, it won't be used at all. There could be an ordering 
issue, if you make it stand first, I suspect we will use it then.