aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs150/pr108104.aj
blob: e4929c6d1228fd680c623887da177a382874bfb6 (plain)
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
class Bug_Provider {
  public void enable_bug(Object argument) {}
}

class Bug_Checker<T> extends Bug_Provider {
  public T is_bug_enabled() {
    return (T) new Boolean(true);
  }
}

public class pr108104 {
  public static void main(String[] args) throws InterruptedException {
    final Bug_Checker<Boolean> first = new Bug_Checker<Boolean>() {
      @Override // compiler agrees, this is an override
      public Boolean is_bug_enabled() {
        return new Boolean(false);
      }
    };
    System.out.println("is bug enabled? " + first.is_bug_enabled()); // false

    first.enable_bug(null);
 
    final Bug_Checker<Boolean> second = new Bug_Checker<Boolean>() {
      @Override 
      public Boolean is_bug_enabled() {
        return new Boolean(false);
      }
    };
    System.out.println("is bug enabled? " +second.is_bug_enabled()); // true!
  }
}