I think the @Immutable anno in *Java Concurrency and Practice* is a class
annotation—not a field one.

Looking at that PR, it looks like this @Immutable anno is usable both on a
type (class) and on a field.

Is that an oversight? If not, then what does it mean? Does @Immutable on a
field mean both:

• the field is final
• the object referenced by the field is immutable

?

Looks like in the current PR @MakeImmutable applies only to fields—not
classes. I imagine that's an oversight.

My quick thought is that these two annotations, in the spirit of *JCP*,
should be type/class-level and not field-level,

Immutable
MakeImmutable

and that perhaps we could have some field-level annos like:

MakeNonStatic
MakeFinal
MakeReferentImmutable - change the type referenced by this field to be an
immutable one

In this way your MakeImmutable field anno is teased apart into two:
MakeFinal, MakeReferentImmutable. The possible benefit is that the two
annos can be used either separately or together to cover 3 situations
instead of just one.

Reply via email to