Debian Codegraph @

framework/tests/all-systems/Issue1003.java

raw
1 // Test case for Issue 1003
2 // https://github.com/typetools/checker-framework/issues/1003
3
4 // The fact that M extends Issue1003 is unimportant,
5 // I'm just doing this to wrap it up into a single class example:
6 class Issue1003<M extends Issue1003> {
7 public int field = 0;
8
9 public M getFoo() {
10 throw new RuntimeException();
11 }
12
13 public static void methodMemberAccess() {
14 // Use of raw generics:
15 Issue1003 m = new Issue1003();
16 // This version causes error but not exception:
17 // Issue1003<Issue1003> m = new Issue1003<>();
18 // Exception caused by this line:
19 int x = m.getFoo().field;
20 }
21 }