PR7482.java 560 Bytes
Newer Older
Tom Tromey committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
public class PR7482
{
  private interface I { }
  private static class B { }
  private static class U extends B implements I { }
  private static class V extends B implements I { }

  static I field;

  private static void g1(Object o)
  {
    I val;
    if (o == null)
      val = new U();
    else
      val = new V();
    field = val;
  }

  private static I g2(Object o)
  {
    I val;
    if (o == null)
      val = new U();
    else
      val = new V();
    return val;
  }

  public static void main(String[] args)
  {
    g1(null);
    g2(null);
  }
}