File: Bug572782.java

package info (click to toggle)
eclipse-jdt-debug 4.30-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 18,876 kB
  • sloc: java: 234,390; xml: 6,367; makefile: 5
file content (57 lines) | stat: -rw-r--r-- 1,176 bytes parent folder | download | duplicates (3)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class Bug572782 {
	static class Generic<T> {
		
	}
	
	static class ExtendedGeneric<T extends Generic<ExtendedGeneric<T>>> {
		public ExtendedGeneric() {
			super();
			System.out.println("created " + this);
		}
	}

	static class SimpleGeneric<T extends Generic<T>> {
		public SimpleGeneric() {
			super();
			System.out.println("created " + this);
		}
	}

	static class NthGeneric<T extends Generic<ExtendedGeneric<T>>> {
		public List<T> items;

		public NthGeneric() {
			super();
			System.out.println("created " + this);
			this.items = new ArrayList<>();
		}
		
		public static void nthGeneric() {
			System.out.println("at nthGeneric");
		}
	}
	
	static <T extends List<String>> void foo(T list) {
		System.out.println("at " + list);
	}

	<T extends Set<String>> void boo(T set) {
		System.out.println("at " + set);
	}

	public static void main(String[] args) {
		new ExtendedGeneric();
		new SimpleGeneric();
		new NthGeneric();
		foo(Arrays.asList("1"));
		NthGeneric.nthGeneric();
		(new Bug572782()).boo(new HashSet<String>());
	}
}