Created
October 29, 2011 16:34
-
-
Save iansmith/1324737 to your computer and use it in GitHub Desktop.
example in java that shows the same case as the go one that does not work (
This file contains 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
package example; | |
// see https://gist.github.com/1324357 for go version | |
public class TypeSurprise { | |
public static interface Fooer { | |
} | |
public static interface Barer extends Fooer{ | |
} | |
public void f1(Fooer f) { | |
} | |
public void f2(Fooer[] f) { | |
} | |
class X implements Barer { | |
} | |
public void example() { | |
Barer[] b = new X[10]; | |
f2(b); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment