> On May 7, 2020, at 3:02 PM, Alex Buckley <alex.buck...@oracle.com> wrote:
> 
> Speaking of "generic", I would be grateful if you can clarify (maybe here, in 
> the first instance, then later in the draft) :
> 
> - A generic class or interface declaration begets a generic class or 
> interface. (1.1 "Class and interface declarations may be generic" + 8 
> "Classes may be generic ...")
> 
> - A generic class or interface begets many parameterized class or interface 
> types.
> 
> - A generic method declaration begets a generic method, which undergoes 
> generic method invocation.

Yes, I think all of these are appropriate statements. (I don't know how much 
the parameterized type/generic method invocation analogy holds—maybe there's 
something useful there, maybe it falls apart real quick. But what you've said 
is true.)

Is there a particular part of JLS that you think should be rephrased to reflect 
these assertions?

> It would be good to enhance the introduction of the draft to acknowledge the 
> common terms "static type" (perhaps in connection with "A class type or an 
> interface type is [a] variable or expression type") and "dynamic type".

In general, I'm keeping types at arm's length here, just enough to be able to 
say "classes and interfaces are not the same thing as types".

Perhaps this is all you're after? "A class type or an interface type is the 
static type of an expression that is known to produce instances of a class or 
interface; these terms should be avoided when talking about the declaration."

> I confess to similar twitchings as Remi in relation to "annotation 
> interfaces". (Not "enum classes", or "record classes" -- all good there.) My 
> concern is that 99% of conversations around metadata in Java programs are 
> interested in the `@Foo` annotations appearing around their source code, not 
> about the Foo annotation interface defined far away by someone else. That is, 
> "annotation" usually means "an instance, providing literal values for the 
> elements of the annotation interface", and not "a declaration of an 
> annotation interface"

Yeah, I noticed that is why JLS 3 got trapped into saying "annotation type" 
instead of just "annotation". I agree that bare "annotation" should be readily 
interpreted as the use-site construct.

>  ... yet the draft has "annotation" as "a declaration":
> 
>  An annotation declaration specifies a new annotation interface,
>  a special kind of interface.
> 
> What you're saying here is:  Just like a class declaration introduces a class 
> Foo, which `new` turns into an object (an instance of class Foo), an 
> annotation declaration introduces an annotation Foo, which `@` turns into an 
> object (an instance of annotation Foo).  I always thought of the annotation 
> as being `@Foo`, not `Foo`, though I concede that people will _say_ "Look at 
> the annotation Foo here, it means ..." while pointing to the character 
> sequence `@Foo`.

I went with "annotation declaration" rather than "annotation interface 
declaration" just to try to be concise. Similarly, it's "enum declaration" and 
"record declaration", not "enum class declaration" and "record class 
declaration".

But I can see how the overloading of the term "annotation" makes this 
confusing. It is *not* my intent to suggest that an annotation [interface] 
declaration introduces an entity called an "annotation". No, it's always an 
"annotation interface".

Maybe we're better off with "annotation interface declaration"?

Reply via email to