title: Unchecked assignment warning
body: <p>I am using Android Studio 1.1.0.</p>
  
  <p>This causes no warning:</p>
  
  <pre><code>public static class A {
      public Map&lt;Integer, String&gt; getMap() {
          return null;
      }
  }
  
  public static class B {
      public void processA(A a) {
          Map&lt;Integer, String&gt; map = a.getMap();
      }
  }
  </code></pre>
  
  <p>But make <code>A</code> generic:</p>
  
  <pre><code>public static class A&lt;T&gt; {
      public Map&lt;Integer, String&gt; getMap() {
          return null;
      }
  }
  </code></pre>
  
  <p>And this line:</p>
  
  <pre><code>Map&lt;Integer, String&gt; map = a.getMap();
  </code></pre>
  
  <p>gets you a warning now: <code>"Unchecked assignment: 'java.util.Map to java.util.Map&lt;java.lang.Integer, java.lang.String&gt;'</code>.</p>
  
  <p>Even though the signature of <code>getMap</code> is totally independent of <code>T</code>, and the code is unambiguous regarding the types the <code>Map</code> contains.</p>
  
  <p>I know that I can get rid of the warning by reimplementing <code>processA</code> as follows:</p>
  
  <pre><code>public &lt;T&gt; void processA(A&lt;T&gt; a) {
      Map&lt;Integer, String&gt; map = a.getMap();
  }
  </code></pre>
  
  <p>But why would I have to do that? What does <code>T</code> matter here at all?</p>
  
  <p>So, the question is - why does type erasure have to not only affect <code>T</code> (which is understandable - if I'm passing an instance of <code>A</code>, <code>T</code> is an unknown), but also "hardcoded" generic signature like <code>&lt;Integer, String&gt;</code> in this case?</p>