Repository navigation
Expand file tree
/
Copy pathErrorStateSetNames.java
More file actions
45 lines (35 loc) · 1.93 KB
/
Copy pathErrorStateSetNames.java
File metadata and controls
45 lines (35 loc) · 1.93 KB
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
package testSuite;
import liquidjava.specification.ExternalRefinementsFor;
import liquidjava.specification.Ghost;
import liquidjava.specification.RefinementPredicate;
import liquidjava.specification.StateSet;
// A state set name must be a lowercase identifier that no state, ghost or other state set of the class uses, and
// not one of the names given to state sets without a name. A name that is also a method of the class is only a
// warning (#514): undo(x) == undoable reads like a call to undo()
@StateSet(name = "Door", value = {"closed", "opened"}) // Expect: Error
public class ErrorStateSetNames {}
@StateSet(name = "locked", value = {"closed", "opened"}) // Expect: Error
@StateSet({"unlocked", "locked"})
class ErrorStateSetNameOfAState {}
@StateSet(name = "lock", value = {"closed", "opened"}) // Expect: Error
@Ghost("int lock")
class ErrorStateSetNameOfAGhost {}
@StateSet(name = "door", value = {"closed", "opened"}) // Expect: Error
@StateSet(name = "door", value = {"unlocked", "locked"})
class ErrorStateSetNameOfAnotherSet {}
@StateSet(name = "size", value = {"empty", "full"}) // Expect: Error
@RefinementPredicate("int size(ErrorStateSetNameOfARefinementPredicate b)")
class ErrorStateSetNameOfARefinementPredicate {}
@StateSet(name = "state2", value = {"closed", "opened"}) // Expect: Error
class ErrorStateSetNameOfAGeneratedName {}
@StateSet(name = "undo", value = {"undoable", "notUndoable"}) // Expect: Warning
class ErrorStateSetNameOfAMethod {
void undo() {}
private void reset() {}
}
@StateSet(name = "undo", value = {"undoable", "notUndoable"}) // Expect: Warning
@StateSet(name = "reset", value = {"fresh", "used"}) // no warning: reset() is private to the superclass
class ErrorStateSetNameOfAnInheritedMethod extends ErrorStateSetNameOfAMethod {}
@ExternalRefinementsFor("java.util.ArrayList")
@StateSet(name = "clear", value = {"empty", "nonEmpty"}) // Expect: Warning
interface ErrorStateSetNameOfAMethodOfTheTarget {}