4
我有以下代码:FindBugs应该期待什么样的并发警告?
import net.jcip.annotations.GuardedBy;
import net.jcip.annotations.ThreadSafe;
@ThreadSafe
public class Aoeu {
@GuardedBy("this")
private long aoeu;
public long getAoeu() {
return aoeu;
}
public void setAoeu(long aoeu) {
this.aoeu = aoeu;
}
}
从我读过,FindBugs的理解JCiP注释(事实上,1.3.9船舶与他们),但我没有得到从上面的代码的任何警告。据,我希望看到:
IS: Field not guarded against concurrent access (IS_FIELD_NOT_GUARDED)
This field is annotated with net.jcip.annotations.GuardedBy, but can be accessed in a way that seems to violate the annotation.
没错,你应该看到警告。据我所知,GuardedBy只是为了这个“”这个论点而实施的,但是因为这就是你正在做的...... +1的问题。 –