On 18/03/2009, Mike Dillon <[email protected]> wrote: > begin sebb quotation: > > > I've done most (perhaps all) of the HttpClient immutable classes, and > > a few of the ones that are thread-safe (e.g. because access to mutable > > objects is synchronized).
Only just committed them - I'd not noticed that the previous attempt failed with a clash... > > [Findbugs seems to work reasonably well with @Immutable, but AFAIK it > > does not process @GuardedBy (yet).] > > > > Ideally, each class should have one of @Immutable, @ThreadSafe or > > @NotThreadSafe eventually. > > > > The class annotations are themselves tagged as @Documented, so they > > appear in the class Javadoc, which is very useful. > > > > @GuardedBy is not tagged as @Documented, but is mainly for internal use. > > > The Annotations section of the Findbugs Manual lists @GuardedBy. Are you > sure it doesn't work? > > http://findbugs.sourceforge.net/manual/annotations.html It didn't work when I tried it last. Admittedly that was a few months ago, and there has just been a new release. But I just tried again with the following code: import net.jcip.annotations.GuardedBy; public class GuardedByTest { @GuardedBy("this") public int count; public synchronized void incCount(){ count++; } public int getCount(){ return count; } } Which I would have expected to report some problems. I even tried @GuardedBy("that") which IMO should also have triggered a warning. This was using the Eclipse plugin, 1.3.8.20090315. But perhaps I've missed something. > -md > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
