Created
April 16, 2015 09:02
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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