title: How to solve this Java type safety warning?
body: <pre><code>Map session = ActionContext.getContext().getSession();
  session.put("user", user);
  </code></pre>
  
  <p>This code generates a warning: <i>Type safety: The method put(Object, Object) belongs to the raw type Map. References to generic type Map&lt;K,V> should be parameterized</i>.</p>
  
  <pre><code>Map&lt;String, Serializable&gt; session = (Map&lt;String, Serializable&gt;)ActionContext.getContext().getSession();
  session.put("user", user);
  </code></pre>
  
  <p>This code generates a warning: <i>Type safety: Unchecked cast from Map to Map&lt;String,Serializable></i>.</p>
  
  <p>The <b>getSession</b> method belongs to Struts2 so I can't modify it. I would like to avoid using @SuppressWarnings because other warnings can be useful.</p>
  
  <p>I guess all Struts2 users in the world faced the same problem... is there an elegant solution?</p>