@Documented @Retention(value=RUNTIME) @Target(value=TYPE) public @interface PolicyLocks
PolicyLock annotations on a type.
It is a modeling error for a class to have both a PolicyLocks and a
PolicyLock annotation.
PolicyLock annotations without imposing
any further constraint on the program's implementation.
OutsideDoorLock is an
intrinsic lock and the JailLock is a
java.util.concurrent.locks.Lock.
@PolicyLocks( {
@PolicyLock("OutsideDoorLock is outsideDoorLock"),
@PolicyLock("JailLock is jailLock")
})
public class Station {
private final Object outsideDoorLock = new Object();
private final Lock jailLock = new ReentrantLock();
void m1() {
synchronized (outsideDoorLock) {
// work with the door
}
jailLock.lock();
try {
// work with the jail
} finally {
jailLock.unlock();
}
}
...
}
@annotate tags of the same type (see the example below).
Javadoc annotation can be useful for Java 1.4 code which does not include
language support for annotations.
/**
* @annotate PolicyLock("OutsideDoorLock is outsideDoorLock")
* @annotate PolicyLock("JailLock is jailLock")
*/
public class Station {
...
}
PolicyLock| Modifier and Type | Required Element and Description |
|---|---|
PolicyLock[] |
value
The
PolicyLock annotations to apply to the class. |
public abstract PolicyLock[] value
PolicyLock annotations to apply to the class.Copyright © 2012 Surelogic, Inc.. All Rights Reserved.