• Bug
  • Status: Closed
  • 2 Major
  • Resolution: Won't Fix
  • teck
  • Reporter: tgautier
  • November 13, 2007
  • 0
  • Watchers: 1
  • July 27, 2012
  • May 14, 2008

Description

Imagine this code:

public class Main \{ // tc root private final HashMap<String, T> root = new HashMap<String, T>();

public void put(T t)
{
  Main<Main> main = new Main<Main>();
  main.put("foo", main);       
}
 
public String get() 
{
    Main<String> main = new Main<String>();
     return main.get("foo");
}  \}

Now imagine running this in one node calling put. This would allow you to put objects of type “Main” into the datastructure held by the root. Calling “get” on the other node will result in a runtime class cast exception.

Not nice.

Comments

Tim Eck 2007-11-13

Do you have a proposal of how this should be fixed? It’s a little late for us to influence sun’s decision to use erasure

Fiona OShea 2007-11-14

Create a related doc issue to add to gotcha’s

Fiona OShea 2008-02-04

Is there a workaround? What is the proper description of the issue for documentation purposes:?

Fiona OShea 2008-04-22

can you add doc info? thanks

Fiona OShea 2008-05-14

This will be documented.