[JSR308] Locations for annotations on types
Michael Ernst
mernst at csail.mit.edu
Sun Feb 25 00:32:20 EST 2007
> "Method Receivers" are not a mention of a type
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.
> All methods in a class have that class as the receiver.
True, but they may require different annotations. As just one example,
@ReadOnly could indicate that the method does not mutate its receiver.
> Rather than naming all the places that Type appears in the language grammar,
> why not simply name the Type nonterminal? That can reduce the list to
> approximately one item.
This is not responsive to my question. We already have that short,
one-element list. I am asking what the expansion of it is. That expansion
is useful for testing, for defining the class file format (where
source-level notion like "the Type nonterminal" are not relevant), for
helping people to understand how the annotations can be used, and for other
purposes. So let's try to stick to that topic for now.
Another member of the mailing list provided two specific, helpful examples:
* generic type arguments in a generic method or constructor invocation
* class literals
I have added these to the design document. Other such suggestions are
welcome.
Thanks,
-Mike
More information about the JSR308
mailing list