File: SimplePrims.java

package info (click to toggle)
checker-framework-java 3.2.0%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 23,104 kB
  • sloc: java: 145,916; xml: 839; sh: 518; makefile: 404; perl: 26
file content (50 lines) | stat: -rw-r--r-- 1,143 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
import org.checkerframework.checker.tainting.qual.Untainted;

class SimplePrims {

    void execute(@Untainted int s) {}

    void tainted(int s) {}

    void intLiteral() {
        // :: error: (argument.type.incompatible)
        execute(5);
        tainted(6);
    }

    void intRef(int ref) {
        // :: error: (argument.type.incompatible)
        execute(ref);
        tainted(ref);
    }

    void untaintedRef(@Untainted int ref) {
        execute(ref);
        tainted(ref);
    }

    void concatenation(@Untainted int s1, int s2) {
        execute(s1 + s1);
        execute(s1 += s1);
        // :: error: (argument.type.incompatible)
        execute(s1 + 3);

        // :: error: (argument.type.incompatible)
        execute(s1 + s2);

        // :: error: (argument.type.incompatible)
        execute(s2 + s1);
        // :: error: (argument.type.incompatible)
        execute(s2 + 4);
        // :: error: (argument.type.incompatible)
        execute(s2 + s2);

        tainted(s1 + s1);
        tainted(s1 + 7);
        tainted(s1 + s2);

        tainted(s2 + s1);
        tainted(s2 + 8);
        tainted(s2 + s2);
    }
}