(2.1.3)
I noticed a bunch of weirdness with @GuardedBy: mostly it works as expected, but in quite a few cases that Error Prone should complain, it doesn't.
Altering this test slightly:
class Test {
final Object mu = new Object();
@GuardedBy("mu") int y;
@GuardedBy("mu") void y() {}
}
class Main {
void m(Test t) {
t.y++; // Barfs, as expected
t.y(); // No complaints
}
}
Some more oddities:
class Main {
void m(Test t) {
// ErrorProne complains, as expected
thisLock();
t.classLock();
// ErrorProne is fine with these?
this.thisLock();
t.testLock();
}
@GuardedBy("this") void thisLock() {}
}
class Test {
@GuardedBy("Test.class") void classLock () {}
@GuardedBy("this") void testLock() {}
}