TC will play funny with Generics
--------------------------------

                 Key: CDV-516
                 URL: https://jira.terracotta.org/jira//browse/CDV-516
             Project: Community Development
          Issue Type: Bug
            Reporter: Taylor Gautier
            Assignee: Issue Review Board


Imagine this code:

public class Main<T>
 {
    private final HashMap<String, T> root = new HashMap<String, T>();
 
    public void test()
    {
      T foo = root.get("bar");
    }
 
    public static void main(String[] args)
    {
      new Main<Main>();
    }
 }

Now imagine running this in one node like using Main<Main> and another node 
with Main<String>.  This would allow you to put objects of type "Main" into the 
datastructure held by the root.  Code on the other node assuming the 
datastructure is Main<String> would assume that the cast cast will succeed 
because of the compiler constraints, but doing a get will then result in a 
String -> Main conversion, causing a runtime class cast.

Not nice.



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://jira.terracotta.org/jira//secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
tc-dev mailing list
[email protected]
http://lists.terracotta.org/mailman/listinfo/tc-dev

Reply via email to