[JSR308] Annotations in comments

Florin Bratu kreathorex at gmail.com
Tue Oct 28 11:44:38 EDT 2008


Sorry, I wrote the messages in a hurry and I forgot to forward the
discussion to the mailing list.

I've looked over the specification, and found the relevant paragraph on
annotations in comments in section E:
"
To ease the transition from standard Java SE 6 code to code with the
extended annotations, the reference implementation recognizes the extended
annotations when surrounded by comment markers:

  List</*@Readonly*/ Object> myList;

This permits use of both standard Java SE 6 tools and the new annotations
even before Java SE 7 is released. However, it is not part of the proposal,
and the final Java SE 7 implementation will not recognize the new
annotations when embedded in comments.
"

First of all, I note that "annotations in comments" is not put inside
section D "Other possible extensions to Java annotations". Does this mean
that the feature does not fit in the same category as, for instance,
annotations on statements?

Second, it is noted that "annotations in comments" is not part of the
proposal. Why is that? As you said, there are compelling arguments to add
this into the next JDK release. Do you think that it is too out of the scope
of JSR 308? Should it be part of another JSR?

I do not know if there was any previous discussion on this topic on the
mailing list - I subscribed to it yesterday -  and I am sorry if I ask for
information already discussed.

On Tue, Oct 28, 2008 at 3:58 PM, Michael Ernst <mernst at csail.mit.edu> wrote:

> Florin-
>
> > > > It may or may not continue to be supported by the javac compiler." Is
> > > > this the official position of Sun?
> > >
> > > Sun doesn't have an official position on this, so far as I know.
> >
> > But do you/the JSR308 community have a position on this? Do you think
> there
> > are reasons and motivation to make it part of JSR308?
>
> Personally, I favor support in the compiler.
>
> javac support for the comment syntax may help to transition users gently to
> the new Java 7 features.  Java programmers delayed adopting Java 5 (e.g.,
> generics), primarily because of backward compatibility issues:  e.g., their
> coworkers/boss/customers didn't want to use Java 5.  But if we could give
> programmers the benefits of type annotations while not affecting backward
> compatibility, that might help more people adopt Java 7 sooner, thus
> increasing its momentum.
>
> I don't think the issue is on Sun's radar screen, and so no one could give
> a definitive answer so far from the release date.
>
> > > If you need a compiler that supports commented annotations, and if
> Sun's
> > > javac doesn't support them, then you could make a small patch to the
> > > OpenJDK that supports the commented annotations.
> >
> > You are right, but it would be much easier for the users to just be able
> to
> > use the features out of the box with JDK 7,
>
> You are correct, of course, and I agree.
>
>                    -Mike
>


Florin.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.csail.mit.edu/pipermail/jsr308/attachments/20081028/c4e59051/attachment.htm 


More information about the JSR308 mailing list