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
|
import org.checkerframework.checker.guieffect.qual.AlwaysSafe;
import org.checkerframework.checker.guieffect.qual.PolyUI;
import org.checkerframework.checker.guieffect.qual.PolyUIType;
import org.checkerframework.checker.guieffect.qual.UI;
public class AssignmentTests {
public static @PolyUIType class P {}
// We must separate these tests, otherwise the flow sensitivity kicks in and confounds the test
// results
public void testBody1(@UI P ui, @AlwaysSafe P safe, @PolyUI P poly) {
ui = safe;
}
public void testBody2(@UI P ui, @AlwaysSafe P safe, @PolyUI P poly) {
ui = ui;
}
public void testBody3(@UI P ui, @AlwaysSafe P safe, @PolyUI P poly) {
ui = poly;
}
public void testBody4(@UI P ui, @AlwaysSafe P safe, @PolyUI P poly) {
safe = safe;
}
public void testBody5(@UI P ui, @AlwaysSafe P safe, @PolyUI P poly) {
// :: error: (assignment.type.incompatible)
safe = ui;
}
public void testBody6(@UI P ui, @AlwaysSafe P safe, @PolyUI P poly) {
// :: error: (assignment.type.incompatible)
safe = poly;
}
public void testBody7(@UI P ui, @AlwaysSafe P safe, @PolyUI P poly) {
poly = safe;
}
public void testBody8(@UI P ui, @AlwaysSafe P safe, @PolyUI P poly) {
poly = poly;
}
public void testBody9(@UI P ui, @AlwaysSafe P safe, @PolyUI P poly) {
// :: error: (assignment.type.incompatible)
poly = ui;
}
}
|