Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jdt-core-dev] Problem with generics, Map.Entry

The problem you have is the same as 
https://bugs.eclipse.org/bugs/show_bug.cgi?id=72644

We are working on it and hope to get a decent solution soon.




David Hovemeyer <daveho@xxxxxxxxxx> 
Sent by: jdt-core-dev-admin@xxxxxxxxxxx
09/16/2004 10:43 AM
Please respond to
jdt-core-dev


To
jdt-core-dev@xxxxxxxxxxx
cc

Subject
[jdt-core-dev] Problem with generics, Map.Entry






Howdy,

Please accept my apologies if this is the wrong mailing list,
or if this is a known problem.

I'm using Eclipse 3.0 with the org.eclipse.jdt.core and
org.eclipse.jdt.ui plugins upgraded to HEAD, and the
org.eclipse.jdt.debug plugin upgraded to JDK_1_5.  (I built these
yesterday.)  My hope is to be able to use Eclipse to work on a
fairly large project that uses generics, but no other 1.5 language
features.

Almost all of the project built fine within Eclipse (!).  However,
I'm getting compile errors in places where entrySet().iterator()
is called on a Map with type parameters.  The following
code (which compiles fine using 1.5 beta2 javac) demonstrates the
problem:

package edu.umd.cs.daveho;

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

public class CheetahBug {
                 public static void main(String[] args) {
                                 Map<String, String> map = new 
HashMap<String, String>();
 
                                 map.put("foo", "bar");
 
                                 // Error reported on the following line
                                 Iterator<Map.Entry<String,String>> i = 
map.entrySet().iterator();
                                 while (i.hasNext()) {
                                                 Map.Entry<String, String> 
entry = i.next();
 System.out.println(entry.getKey() + ", " + entry.getValue());
                                 }
                 }
}

There are a few other places where Eclipse flags errors on things
that compile fine in 1.5.  I'll try to distill these as small test
cases.

-Dave
_______________________________________________
jdt-core-dev mailing list
jdt-core-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/jdt-core-dev




Back to the top