[concurrency-interest] jcip annotations

Dhanji R. Prasanna dhanji at gmail.com
Thu Dec 20 03:07:07 EST 2007


I find the jcip annotations quite useful and like Kevin Bourrillion
said some time ago wish there was an expanded set for more cases (an
@ThreadConfined springs to mind).

However I find it odd that they have runtime retention policies. This
makes it awkward for me to package libraries that use the jcip
annotations in source code. It also does not seem to jive with the
following stated intent (from package-info):

"These annotations are relatively unintrusive and are beneficial to
both users and maintainers. Users can see immediately whether a class
is thread-safe, and maintainers can see immediately whether
thread-safety guarantees must be preserved. Annotations are also
useful to a third constituency: tools. Static code-analysis tools may
be able to verify that the code complies with the contract indicated
by the annotation, such as verifying that a class annotated with
@Immutable actually is immutable."

I believe source-level retention would be the correct choice (at best,
class-level). I cannot see any value in them being retained at runtime
and in fact a potential nuisance to reflection and debugging...  I
suppose it is trivial for me to recompile the annotations with a
reduced retention but I am curious as to the motivation behind
retaining them at runtime.



More information about the Concurrency-interest mailing list