[JSR308] Locations for annotations on types
Michael Ernst
mernst at csail.mit.edu
Sun Feb 25 09:26:46 EST 2007
Neal-
> > They are an implicit mention of a type. For example, the method
> >
> > PrintStream.println(String)
> >
> > has two parameters. Java provides a shorthand that permits one of them to
> > be implicit, but both parameters should be able to be annotated.
>
> Those are (actual) arguments, not (formal) parameters.
There are both two formal parameters and two actual arguments -- the number
of formals and actuals is always the same. I was speaking of the formal
parameters, because annotations apply to parameters, not to arguments.
> In a class, the
> receiver is always the class itself; the receiver is the same type for all
> methods in a class.
You mean to say that "the receiver is the same Java type". The qualified
type may differ. In a qualified type system -- and for other uses as well
-- there may be a need to annotate the receiver. Examples have been given
before, including in my message.
> A few obvious ones you missed, found while glancing through the Java
> grammar:
>
> - method return type (which is not the same thing as the method
> itself)
This one is explicitly discussed in the document and supported.
Some of the others make no sense, but thanks for pointing out that that
wasn't obvious. I'll update the document to so indicate, and raise
discussions on the list where appropriate.
> The draft spec notes that the currently selected syntax is ambiguous in the
> first two cases (variable type and method return type)
Actually, the draft proposal says that the meaning is *unambiguous* in
those cases. (A previous version incorrectly stated that the syntax is
ambiguous.)
The discussion is at the end of section 3.1 in the current draft, for those
who want to read it. (Everyone who contributes to the discussions should
do so, to keep discussions productive.)
-Mike
More information about the JSR308
mailing list