title: Why does this code fail with sourceCompatibility=1.8
body: <p>The following code works when compiled with sourceCompatibility=1.7 or 1.6, but fails after switching to 1.8:</p>
  
  <pre><code>public class Java8Wat {
    interface Parcelable {
    }
  
    static class Bundle implements Parcelable {
      public void put(Parcelable parcelable) {
      }
  
      public void put(Serializable serializable) {
      }
  
      public &lt;T extends Parcelable&gt; T getParcelable() {
        return null;
      }
    }
  
    static {
      Bundle inBundle = new Bundle();
      Bundle outBundle = new Bundle();
  
      outBundle.put(inBundle.getParcelable());
    }
  }
  </code></pre>
  
  <p>Compilation output:</p>
  
  <pre><code>Java8Wat.java:23: error: reference to put is ambiguous
          outBundle.put(inBundle.getParcelable());
               ^
  both method put(Parcelable) in Bundle and method put(Serializable) in Bundle match
  </code></pre>
  
  <p>Here's the repo with failing code: <a href="https://github.com/chalup/java8-wat">https://github.com/chalup/java8-wat</a>. Just invoke <code>./gradlew clean build</code> from project directory.</p>
  
  <p>I skimmed through JLS for Java 8, but I haven't found anything relevant.</p>
  
  <p>Additional observation: the code compiles if I change the <code>getParcelable()</code> signature to:</p>
  
  <pre><code>public Parcelable getParcelable()
  </code></pre>
  
  <p>Why does java compiler considers <code>put(Serializable)</code> to be potentially applicable method for <code>outBundle.put(inBundle.getParcelable())</code> call and what changes should be made to Parcelable/Bundle class? Bonus question: why does this error happens only on Java 8 and not on Java 7?</p>