title: Compiler change in Java 7
body: <p>In Java 6 I was able to use:</p>
  
  <pre><code>public static &lt;T, UK extends T, US extends T&gt; T getCountrySpecificComponent(UK uk, US us) {
      Country country = CountryContext.getCountry();
      if (country == Country.US) {
          return us;
      } else if (country == Country.UK) {
          return uk;
      } else {
          throw new IllegalStateException("Unhandled country returned: "+country);
      }
  }
  </code></pre>
  
  <p>With these repositories:</p>
  
  <pre><code>public interface Repository{
     List&lt;User&gt; findAll();
  }
  
  public interface RepositoryUS extends Repository{}
  
  public interface RepositoryUK extends Repository{}
  </code></pre>
  
  <p>When using these:</p>
  
  <pre><code>RepositoryUK uk = ...
  RepositoryUS us = ...
  </code></pre>
  
  <p>This line compiles in in Java6 but fails in Java7 (error cannot find symbol - as the compiler looks for findAll() on class Object)</p>
  
  <pre><code>List&lt;User&gt; users = getCountrySpecificComponent(uk, us).findAll();
  </code></pre>
  
  <p>This compiles in Java 7 </p>
  
  <pre><code>List&lt;User&gt; users = ((Repository)getCountrySpecificComponent(uk, us)).findAll();
  </code></pre>
  
  <p>I know this is a rather uncommon use case but is there a reason for this change? Or a way to tell the compiler to be a little "smarter"?</p>