[Jsr308-statements] Re: [JSR308] Block Annotations Suggestion

Eduardo Born nosachamos at gmail.com
Thu Oct 4 16:06:01 EDT 2007


> Maybe in some cases, but it could make code less readable, too. I
> often see fields with large chunks of JavaDoc attached to them, and
> with several fields together, they can span a page or more. If you
> were to surround those fields with an annotated block, then the
> annotation will be far removed from the field declaration. It
> wouldn't be clear that the field even has an annotation.

Couldn't maybe indentation solve this problem?

I agree that the focus at this time should be on adding annotations on
statements and loops, and that suggestion would be a way to improve the way
those annotations are placed on the statements/blocks.

The case of the fields is just one that came in my mind, but when we are
about to apply annotations on any statement, doesn't seem to me like it will
be rare to have methods full of repeated annotations all over the place.
That could make it very polluted and hard to maintain.

Indentation could solve the readability problem, while letting a single
annotation to be applied to a group of statements or field declarations.

Other changes could have some side effects too, but the benefits just make
them worth. For example, I see positional arguments to annotations as
something that reduce readability, but it is being suggested as it would
also reduce verbosity. This is the same, without the readability penalties
(once indentation can be used within the construction).


2007/10/3, Trevor Harmon <trevor at vocaro.com>:
>
> On Oct 3, 2007, at 1:32 PM, Eduardo Born wrote:
>
> > In the case, I feel that makes the code dirtier to have several
> > repetitions of the same annotation to a group of elements, and that
> > makes the code less readable and maintainable too.
>
> Maybe in some cases, but it could make code less readable, too. I
> often see fields with large chunks of JavaDoc attached to them, and
> with several fields together, they can span a page or more. If you
> were to surround those fields with an annotated block, then the
> annotation will be far removed from the field declaration. It
> wouldn't be clear that the field even has an annotation.
>
> > I think that having a way to apply an annotation not only to a
> > single statement, but to a group of them, would make the statement
> > annotations much more usable.
>
> When I said "usable", I meant able to be used, not just maintainable
> or readable. Field annotations are still perfectly usable, even
> without putting annotated blocks around them.
>
> In other cases, such as loops and statements, annotations are simply
> unusable; there's no support for them whatsoever. I think we should
> focus on those kinds of cases because they have a more substantial
> impact on what annotations can be used for.
>
> Trevor
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.csail.mit.edu/pipermail/jsr308-statements/attachments/20071004/c38553dc/attachment.html


More information about the JSR308-statements mailing list