Debian Codegraph @

framework/tests/all-systems/AnonymousClasses.java

raw
1 import java.util.Comparator;
2 import java.util.Date;
3
4 // Checkers may issue type checking errors for this class, but they should not crash
5 @SuppressWarnings("")
6 public class AnonymousClasses {
7 // test anonymous classes
8 private void testAnonymous() {
9 Foo x = new Foo() {};
10 new Object() {
11 public boolean equals(Object o) {
12 return true;
13 }
14 }.equals(null);
15
16 Date d = new Date() {};
17 }
18
19 private <T extends Comparator<T>> void testGenericAnonymous() {
20 Gen<T> g = new Gen<T>() {};
21 GenInter<T> gi = new GenInter<T>() {};
22 }
23
24 class Gen<F extends Object> {
25 public Gen() {}
26 }
27
28 interface GenInter<E> {}
29
30 interface Foo {}
31 }