[JSR308] Creating new annotated types.

Niko Matsakis niko at alum.mit.edu
Fri Nov 14 09:04:36 EST 2008


> AnnotatedTypes.deepCopy() returns a deep clone of the annotated  
> type.  I don't know how it is different from AnnotatedTypeCloner.

Hmm, well, I can tell you at least one difference: I didn't know that  
AnnotatedTypes.deepCopy() existed! :) That's good, I'm glad to see  
it's there.  As an aside, sometimes it can be hard to keep track of  
all of the various classes full of helper methods that are floating  
around (Elements, Types, ElementUtils, TypeUtils, InternalUtils,  
AnnotatedTypes, ...).

In any case, the only difference between deepCopy() and  
AnnotatedTypeCloner is that the latter allows the cloning process to  
be customized in any way by a subclass.  Whether that's necessary or  
not is precisely what we've been discussing, I suppose.

> Besides preferring mutability, what are the motivations/rationale of  
> wanting deep cloning.  Your insight would help us documenting  
> aliasing better.

I'm not sure what you mean by preferring mutability; I certainly  
don't.  In fact, I would probably prefer if AnnotatedTypeMirrors were  
completely immutable, though the current mix of "mutable while being  
created then immutable by convention thereafter" seems to work out  
reasonably well.


regards,
Niko Matsakis



More information about the JSR308 mailing list