Skip to content

Instantly share code, notes, and snippets.

@chalup
Created April 16, 2015 09:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chalup/d7776e4f9a1c281a725e to your computer and use it in GitHub Desktop.
Save chalup/d7776e4f9a1c281a725e to your computer and use it in GitHub Desktop.
This code compiles on JDK6, but fails on JDK8 with Error:(23, 14) java: reference to put is ambiguous both method put(Java8Wat.Parcelable) in Java8Wat.Bundle and method put(java.io.Serializable) in Java8Wat.Bundle match
import java.io.Serializable;
public class Java8Wat {
interface Parcelable {
}
static class Bundle implements Parcelable {
public void put(Parcelable parcelable) {
}
public void put(Serializable serializable) {
}
public <T extends Parcelable> T getParcelable() {
return null;
}
}
static {
Bundle inBundle = new Bundle();
Bundle outBundle = new Bundle();
outBundle.put(inBundle.getParcelable());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment