Skip to content

Instantly share code, notes, and snippets.

@iansmith
Created October 29, 2011 16:34
Show Gist options
  • Save iansmith/1324737 to your computer and use it in GitHub Desktop.
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 (
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