File: Issue681.java

package info (click to toggle)
checker-framework-java 3.2.0%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 22,840 kB
  • sloc: java: 145,910; xml: 839; sh: 518; makefile: 401; perl: 26
file content (51 lines) | stat: -rw-r--r-- 1,296 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
// Test case for Issue 681:
// https://github.com/typetools/checker-framework/issues/681

import testchecker.quals.H1S2;

// TODO: Issue is fixed, but test needs to be re-written in
// a way that actually checks the behavior.

/**
 * This class shows that non-explicitly written annotations on
 * Inner types are not inserted correctly.
 *
 * The TestAnnotatedTypeFactory adds @H1S2 to the type of any variable
 * whose name contains "addH1S2".
 *
 * <pre>
 * javacheck -cp tests/build/ -processor testchecker.TestChecker tests/testchecker/Issue681.java
 * javap -verbose Issue681\$Inner.class
 * <pre>
 *
 * Outputs:
 * ...
 * <pre>
 * Issue681$Inner addH1S2;
 * descriptor: LIssue681$Inner;
 * flags:
 * RuntimeVisibleTypeAnnotations:
 * 0: #10(): FIELD
 * 1: #11(): FIELD
 *
 * Issue681$Inner explicitH1S2;
 * descriptor: LIssue681$Inner;
 * flags:
 * RuntimeVisibleTypeAnnotations:
 * 0: #11(): FIELD, location=[INNER_TYPE]
 * 1: #10(): FIELD
 * 2: #11(): FIELD
 * </pre>
 */
class Issue681 {
    class Inner {
        @H1S2 Inner explicitH1S2;
        Issue681.@H1S2 Inner explicitNestedH1S2;
        @H1S2 Issue681.Inner explicitOneOuterH1S2;
        Inner addH1S2;

        @H1S2 Inner method(@H1S2 Inner paramExplicit, Inner nonAnno) {
            return paramExplicit;
        }
    }
}