Community
Participate
Working Groups
Eclipse warns that the import java.util.Map.Entry is not used, when in fact it is.
Please provide steps to reproduce, build number etc... then reopen this defect.
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()); } } }
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.
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.
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.