interactions between type annotations and language model APIs.

Alex Buckley alex.buckley at
Fri May 9 22:59:02 UTC 2014

On 5/9/2014 3:38 PM, Joe Darcy wrote:
> Given the desired semantics of the annotations being used in these cases
> are largely extra-lingual, I don't think trying to specify their
> propagation in javax.lang.model is wise.

Clearly, general TypeMirror combinators in jx.l.m.u.Types are not 
expected to be sensitive to the meaning of type annotations. For 
example, isSameType is not expected to compare type annotations within 
its two TypeMirror arguments.

But while the _semantics_ of the annotations are extra-lingual, their 
_existence_ is not. That's why I called out specific TypeMirror 
generators in jx.l.m.u.Types. For example, if I have a TypeMirror that 
represents '@Foo List<String>', and I pass it to the erasure method, 
then I could reasonably expect to get back a TypeMirror that represents 
'@Foo List'. Similarly for getArrayType, getDeclaredType, etc.

All that said, preserving the existence of type annotations in all 
TypeMirror generators is quite complicated.

> For tracking purposes, a JBS bug in core-libs / javax.lang.model would
> be appropriate.

It's not clear to me what the actual behavior of Types' methods is 
today, which is why I proposed to specify that it's not specified 
(inspired by Class#getDeclaredMethods being specified to return methods 
in an unspecified order).

Jon, Eric, would that be OK?


More information about the compiler-dev mailing list