Adding support section/segment separating comments
Jonathan Gibbons
jonathan.gibbons at oracle.com
Thu Dec 13 07:42:29 PST 2012
Also note that some IDEs, like NetBeans, already provide the feature you
are looking for, via "editor-fold" comments.
-- Jon
On 12/12/2012 11:55 PM, Remi Forax wrote:
> Hi Behrang,
> Jon Gibbons has recenly pushed a new API that allow to extract javadoc
> comment easily,
> so I think with this API you should be able to write your own Doclet
> to verify that the right section contains the right information.
>
> I'm not a big fan of this way to segment a class because developers
> tend to try to fill section like properties with fields that should
> not be publicly exposed or worst with code never used and never tested.
>
> Anyway, it's note something that should go in the jdk but more a
> policy that can be enforced with tools at company level.
>
> cheers,
> Rémi
>
> On 12/13/2012 01:44 AM, Behrang Saeedzadeh wrote:
>> I remember I had seen in the past in another language, but the point is
>> giving users some pointers about what methods in a section are doing in
>> general. For example:
>>
>> public class Foo {
>>
>> // @section properties
>>
>> public int getBar() { ... }
>> public void setBar(int bar) { ... }
>>
>> // @section event handling
>>
>> public void addActionListener(...) { ... }
>>
>> // @section rendering
>>
>> public void draw(Graphics g) { ... }
>> }
>>
>> This can motivate new users to add methods to the right section in
>> the code
>> to keep it consistent over time.
>>
>> Also IDEs can use this information to categories methods based on the
>> section they belong to (or they purpose).
>>
>> Cheers,
>> Behrang Saeedzadeh
>> http://www.behrang.org
>
More information about the jdk8-dev
mailing list