interactions between type annotations and language model APIs.

Jonathan Gibbons jonathan.gibbons at oracle.com
Thu May 8 22:16:27 UTC 2014


On 05/08/2014 03:10 PM, Werner Dietl wrote:
> In this message:
>
> http://mail.openjdk.java.net/pipermail/compiler-dev/2014-May/008758.html
>
> Alex raises the issue of "generator" methods and how  "the "correct"
> thing to do would be to inspect the TypeMirror argument and thread its
> type annotations into the TypeMirror result."
>
> I agree that better support for type annotations in these methods
> would be great.
> It would also be awesome if subtyping, type inference, and other type
> operations were aware of type annotations.

Type annotations exist outside the Java type system, and outside the 
JLS, so it is not clear to me how subtyping, inference, etc could be 
aware of type annotations beyond just noting their existence. The only 
place these annotations have any meaning attached is in the processors 
that manipulate them, and so that is where to model the interactions 
between type operations and type annotations.

-- Jon


>
> In the Checker Framework we need to go to great effort to re-calculate
> some computations that the compiler already performed, just to add the
> right type annotations. This is error prone and we might produce
> incorrect results.
>
> However, one complication is that to correctly "thread" type
> annotations through such computations, it is not enough to take the
> annotations from one side or the other or to append the lists of type
> annotations. For uses in type systems, you want to perform an
> operation like building the least upper bound or greatest lower bound
> of the two sets of type annotations.
> These operations depend on the particular interpretation of type
> annotations and I don't see how the compiler could independently
> perform the right operation.
>
> It would be awesome if there were a way for outside tool-builders to
> adapt the behavior of the compiler in such situations.
> Is this something you are considering when planning these changes?
>
> Cheers,
> cu, WMD.
>



More information about the type-annotations-dev mailing list