1 public class PR7482 2 { 3 private interface I { } 4 private static class B { } 5 private static class U extends B implements I { } 6 private static class V extends B implements I { } 7 8 static I field; 9 g1(Object o)10 private static void g1(Object o) 11 { 12 I val; 13 if (o == null) 14 val = new U(); 15 else 16 val = new V(); 17 field = val; 18 } 19 g2(Object o)20 private static I g2(Object o) 21 { 22 I val; 23 if (o == null) 24 val = new U(); 25 else 26 val = new V(); 27 return val; 28 } 29 main(String[] args)30 public static void main(String[] args) 31 { 32 g1(null); 33 g2(null); 34 } 35 } 36