class Bug { static A test(A[] as) { for (B b : as) { return b; } return null; } static class A {} static class B {} }