type Map does not take parameters ?  
Author Message
Burkhard Hassel





PostPosted: 2006-8-10 1:58:00 Top

java-programmer, type Map does not take parameters ? Hi all,

I got a strange error message from the java 1.5.0 compiler:
"type Map does not take parameters" which Map certainly does.

The complete code was this mini class:
import java.util.*;
class AAA {
public static void main(String[] args) {
Map<Integer, String> map = new HashMap<Integer,String>();
System.out.println(map);
}
}

NB, it does not compile with the original compiler, but compiles happily
within an Eclipse 3.1 environment.
And it does also compile with the original compiler when I change the
reference type from Map to HashMap.

How can this be?

Yours,
Bu.
 
jagonzal





PostPosted: 2006-8-10 2:31:00 Top

java-programmer >> type Map does not take parameters ? Burkhard Hassel wrote:
> How can this be?

Are you sure you are you are using the compiler you think you are
using? (I mean, maybe a path variable or something like that is
pointing you to another compiler in your computer).

I tried your source code and it compiled OK, javac 1.5.0_06 on linux.

 
Mike Schilling





PostPosted: 2006-8-10 8:57:00 Top

java-programmer >> type Map does not take parameters ?
"Burkhard Hassel" <email***@***.com> wrote in message
news:44da2207$0$475$email***@***.com...
> Hi all,
>
> I got a strange error message from the java 1.5.0 compiler:
> "type Map does not take parameters" which Map certainly does.
>
> The complete code was this mini class:
> import java.util.*;
> class AAA {
> public static void main(String[] args) {
> Map<Integer, String> map = new HashMap<Integer,String>();
> System.out.println(map);
> }
> }
>
> NB, it does not compile with the original compiler, but compiles happily
> within an Eclipse 3.1 environment.
> And it does also compile with the original compiler when I change the
> reference type from Map to HashMap.
>
> How can this be?

Wild guess, but is there another class Map in the same package as AAA, one
that isn't generic? If so, it would be used instead of java.util.Map.