[JSR308] array-valued annotations

Pavel Krupets pavel.krupets at db.com
Mon Jan 29 03:38:30 EST 2007


Hello,

IMHO

Yep. The main point is that array itself is an object (no matter whether
it's n-dimensional or array of arrays with different lengths {which I
think is a side effect :=)}) and it contains objects with the specified
type. So we have two entities to which annotations can be applied.

I think if one needs 'strange' array (array of arrays with different
dimensions and annotations) one can always use:

@Readonly List<@Readonly @NonNull List<@Readonly @NonNull Document>> docs
= ...

This will keep ordinary arrays simple.

P.S. "In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away." (c)
RFC1925

With regards,
Pavel Krupets
www.x-markets.db.com
Deutsche Bank [/]
+7 (495) 783-03-30

> -----Original Message-----
> From: Ted Neward [mailto:ted at tedneward.com]
> Sent: Sunday, January 28, 2007 6:10 AM
> To: 'Gary T. Leavens'; Pavel Krupets
> Cc: jsr308 at lists.csail.mit.edu
> Subject: RE: [JSR308] array-valued annotations
> 
> I think I see Pavel's point, though; the declaration "doc" implicitly
> suggests that all of the dimensions to the "jagged" array behind the
> reference are of the same type (Document). I can't declare the different
> dimensions to be of different types, a la:
> 
> Document[Object[]] doc = ...
> 
> Meaning, a single dimenion of Document objects each of which in turn are
> also references to Object arrays. (Makes no sense!)
> 
> If annotations are to be considered part of the type's signature (which
is
> WAAAAY beyond what we designed or had in mind), then Pavel's right, a
> multidimensional array has to contain all the same type, regardless of
the
> number of dimensions.
> 
> Ted Neward
> Java, .NET, XML Services
> Consulting, Teaching, Speaking, Writing
> http://www.tedneward.com
> 
> 
> > -----Original Message-----
> > From: jsr308-bounces at lists.csail.mit.edu [mailto:jsr308-
> > bounces at lists.csail.mit.edu] On Behalf Of Gary T. Leavens
> > Sent: Thursday, January 25, 2007 9:48 AM
> > To: Pavel Krupets
> > Cc: jsr308 at lists.csail.mit.edu
> > Subject: Re: [JSR308] array-valued annotations
> >
> > Hi Pavel and all,
> >
> > On Thu, 25 Jan 2007, Pavel Krupets wrote:
> >
> > > Hello,
> > >
> > > I don't think it's appropriate to use annotations like:
> > > "Document[][@Readonly]". What I mean is that there is no much sense
in
> > > specifying different annotations for different dimensions of the
> array.
> > If
> > > such behavior is needed other types can be used (like List<...>,
etc).
> I
> > > think annotations should be used only with:
> > >
> > > - array as an object (like: @NonNull @Readonly Document[][] doc =
...)
> > > - objects which are stored inside arrays (like: Document @NonNull
> > > @Readonly [][] doc = ...)
> > >
> > > The reason behind this is that array (one or multi-dimensional) is
an
> > > 'atomic' type which has type of stored object and dimensions. Just
> want
> > to
> > > keep things simple.
> >
> > I agree that keeping things simple is good when possible.  But
> > semantically, each array declared is itself a location which holds a
> > collection of locations.  Thus, to simplify to one dimension:
> >
> >     Document[] docs;
> >
> > could look like
> >
> >                        0  1  2  3
> >     docs [ *-]------> [  |  |  |  ]
> >
> > and the location named doc can be null or readonly independent of the
> > locations doc[0]..doc[3].  The same holds for readonly.
> >
> > You would lose expressiveness if you can't independently talk about
> > these different locations.
> >
> >          Gary T. Leavens
> >          Department of Computer Science, Iowa State University
> >          229 Atanasoff Hall, Ames, Iowa 50011-1041 USA
> >          http://www.cs.iastate.edu/~leavens  phone: +1-515-294-1580
> >
> >
> > _______________________________________________
> > JSR308 mailing list
> > JSR308 at lists.csail.mit.edu
> > https://lists.csail.mit.edu/mailman/listinfo/jsr308
> >
> > --
> > No virus found in this incoming message.
> > Checked by AVG Free Edition.
> > Version: 7.5.432 / Virus Database: 268.17.11/652 - Release Date:
> 1/25/2007
> > 3:32 PM
> >
> 
> --
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.5.432 / Virus Database: 268.17.12/653 - Release Date:
1/26/2007
> 11:11 AM
> 


---

This e-mail may contain confidential and/or privileged information. If you 
are not the intended recipient (or have received this e-mail in error) 
please notify the sender immediately and destroy this e-mail. Any 
unauthorized copying, disclosure or distribution of the material in this 
e-mail is strictly forbidden.



More information about the JSR308 mailing list