|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | ||||||||
@Documented
@Target(value={TYPE,METHOD,CONSTRUCTOR})
public @interface VouchVouches for any inconsistent analysis result within the scope of code that the annotation appears on. This means that any inconsistent result will be changed to a consistent result. Its use is for documentation and to quiet overly conservative analysis results.
This annotation is trusted, i.e., it is not verified by analysis.
The annotation requires a brief programmer explanation for the vouch being made.
init method is used to set state,
perhaps due to an API restriction about using constructors, and then CentralControl instances are safely published. A Vouch is used to
explain that the init method needs to be an exception to the lock
policy.
@Region("private ControlRegion")
@RegionLock("ControlLock is lock protects ControlRegion")
public class CentralControl {
private final Object lock = new Object();
@InRegion("ControlRegion")
private String f_id;
@Vouch("Instances are thread confined until after init(String) is called.")
public void init(String id) {
f_id = id;
}
public String getId() {
synchronized (lock) {
return f_id;
}
}
public void setId(String value) {
synchronized (lock) {
f_id = value;
}
}
}
A Vouch is used to explain that the SmokeTest class is test
code.
@Vouch("Test code that is intentionally inconsistent with models")
public class SmokeTest extends ... {
...
}
@annotate tag.
/**
* @annotate Region("private ControlRegion")
* @annotate RegionLock("ControlLock is lock protects ControlRegion")
*/
public class CentralControl {
private final Object lock = new Object();
/**
* @annotate InRegion("ControlRegion")
*/
private String f_id;
/**
* @annotate Vouch("Instances are thread confined until after init(String) is called.")
*/
public void init(String id) {
f_id = id;
}
...
}
| Required Element Summary | |
|---|---|
String |
value
A brief programmer explanation of why the annotated code should have its inconsistent assurance results suppressed. |
| Element Detail |
|---|
public abstract String value
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | ||||||||