type Map does not take parameters ?

  • Thread starter Burkhard Hassel
  • Start date
B

Burkhard Hassel

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.
 
J

jagonzal

Burkhard said:
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.
 
M

Mike Schilling

Burkhard Hassel said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top