Webrev for making parts of TypeAnnotationPosition immutable

Eric McCorkle eric.mccorkle at oracle.com
Thu Feb 6 12:05:31 PST 2014


On 02/06/14 14:08, Werner Dietl wrote:
>>> 1. In the type-annotations repository, I added
>>>
>>> com.sun.tools.javac.code.TypeAnnotationPosition.copy(TypeAnnotationPosition)
>>>
>>> This makes it a lot easier to create a new type annotation position
>>> from an existing one. I previously had this in a Checker Framework
>>> utility class, but can't implement it there without constructor
>>> access.
>>
>> That's probably a worthwhile addition.  I will probably add it in a
>> later patch (see comments on 2)
> 
> I looked at where I use my new "copy" method and they all follow this pattern:
> 
>   TypeAnnotationPosition newpos = TypeAnnotationPosition.copy(tapos);
>   newpos.location = tapos.location.append(new
>       TypePathEntry(TypePathEntryKind.TYPE_ARGUMENT, arg));
> 
> That is, I only want a copy to modify the location array.
> This update won't work once "location" is final.
> So instead of the copy method, for our use case, it would be enough to
> have a method "appendLocation":
> 
>   TypeAnnotationPosition newpos = tapos.appendLocation(new
>       TypePathEntry(TypePathEntryKind.TYPE_ARGUMENT, arg));
> 
> that creates a new TAP with the path entry appended.

I would eventually like to make all of TypeAnnotationPosition immutable,
and I would also like to make position in Attribute.(Type?)Compound
immutable as well.

But it looks like that may be a more incremental process than I'd hoped for.

> 
> 
>> We discussed this amongst the javac team, actually.  It's probably best
>> to wait until the end of the roadmap before importing any changes and
>> running Checkers.  The reason is that I am trying to make these changes
>> as incremental as possible, but in reality they are all steps in a
>> rather significant change, and I think there would be a lot of needless
>> effort to try to keep checkers in sync with all the intermediate states.
> 
> What timeframe are we talking about here? Is it several days or months?
> I like to keep jsr308-langtools somewhat in sync with jdk9/dev.

Not months, but not days either.  I am tenatively aiming to be wrapping
up by mid Feb, but it may be late Feb due to other issues.

> 
> cu, WMD.
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: eric_mccorkle.vcf
Type: text/x-vcard
Size: 303 bytes
Desc: not available
Url : http://mail.openjdk.java.net/pipermail/type-annotations-dev/attachments/20140206/bad8a6c8/eric_mccorkle.vcf 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
Url : http://mail.openjdk.java.net/pipermail/type-annotations-dev/attachments/20140206/bad8a6c8/signature.asc 


More information about the type-annotations-dev mailing list