problem with all type annotations on method parameters

Jonathan Gibbons jonathan.gibbons at oracle.com
Mon Jan 14 15:26:28 PST 2013


On 01/07/2013 07:45 PM, Werner Dietl wrote:
> Jon,
>
> after what phase do we want the type annotation positions to be valid?

Sometime after Attr, I would think -- I assume no-one needs the 
positions any sooner.  How does the determination of type positions 
interact with tree rewriting in Lowe and TransTypes?

>
> I currently separate declaration and type annotations for expression
> locations at the end of Attr, which is too late for some semantic
> checks that happen earlier in Attr.
> I want to split up the organizeTypeAnnotations methods back into two
> methods: one to separate declaration and type annotations and one to
> determine type annotation positions.

That sounds right/good to me. By the time anno processing begins
(i.e. after Enter+MemberEnter+Annotate, before Attr) both the
internal javac model and the external javax.lang.model model should
be able to correctly report both type annos and decl annos on signatures.

>
> After MemberEnter, I would say we just need the separation of
> declaration and type annotations.
> During Attr we also only need the separation.
>
> Only once Attr is finished with a class do we set the type annotation
> positions. Or should we do this even later?

Don't do today what you can put off till tomorrow ;-)  Attr and Flow
are primarily about analyzing a program for correctness.  The latter
phases (Lower, TransTypes, Gen) are about preparing a class to be
written to a class file.  So, it seems to me that type anno positions are
part of the info needed for a class file and should therefore be done
more like at Gen time, unless there is a need to do it earlier.

>
> Comments?
>
> cu, WMD.



More information about the type-annotations-dev mailing list