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);
}
}
|