[Checkers] Annotations on new

Artemus Harper subanark at gmail.com
Sat Aug 30 20:05:31 EDT 2008


Is this change going to mean that the annotations on the anonymous type will
be on the type or its declared subtypes?

E.g.

If you have:
new @Anno Rectangle() { ... }

class <anonymous> extends @Anno Rectangle { ... }
or
class @Anno <anonymous> extends Rectangle { ...  }
or
class @Anno <anonymous> extends @Anno Rectangle { ... }

JCTree.JCClassDecl seems to indicate that is does the first one, but
AnnotatedDeclaredType.directSuperTypes() only seems to add annotations on
the declared type of the subtypes, rather than those present in the
implements and extends clause (see
AnnotatedTypeMirror.AnnotatedDeclaredType.SuperTypeFinder.supertypesFromElement(TypeElement)
)

On Sat, Aug 30, 2008 at 3:42 PM, Mahmood Ali <mahmood at mit.edu> wrote:

> Hi Artemus,
>
>  When I'm annotating an anonymous class element in annotateImplicit I'm not
>> seeing any of the annotations present on its deceleration (in the new).
>>
> Thanks for noticing this bug.  I will fix it hopefully before the following
> release.
>
>  I'm not entirely sure what the purpose of the annotation on new instances
>> is
>>
> They are necessary for declaring the type being constructed.  'new
> @Immutable Date()' constructs an immutable date, while 'new @Mutable Date()'
> constructs a mutable date.
>
> Regards,
> Mahmood
>
>


-- 
Artemus Harper
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.csail.mit.edu/mailman/private/checkers/attachments/20080830/423f3c65/attachment.htm 


More information about the checkers mailing list