You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@groovy.apache.org by Paul King <pa...@asert.com.au> on 2018/01/12 00:57:03 UTC

Interest in a @UtilityClass AST transform

Hi all,

Would there be interest in a @UtilityClass annotation - similar to lombok's:

https://projectlombok.org/features/experimental/UtilityClass

It is similar to @Category in some ways but with some useful differences.

What do folks think?

Cheers, Paul.

Re: Interest in a @UtilityClass AST transform

Posted by MG <mg...@arscreat.com>.
I think the name is good.

I feel @Static would be a natural choice to be extended to support 
typical METHODS or FIELDS paramters, to only make these static, which 
does not make sense for an utility class, which by definition is 
static-only.


On 12.01.2018 02:44, David Clark wrote:
> I vote yes.
>
> Is @UtilityClass the expected name? Something like @AllStatic or just 
> @Static makes more sense to me, but if @UtilityClass is in widespread 
> use, then keep the name.
>
>
> On 01/11/2018 06:57 PM, Paul King wrote:
>>
>> Hi all,
>>
>> Would there be interest in a @UtilityClass annotation - similar to 
>> lombok's:
>>
>> https://projectlombok.org/features/experimental/UtilityClass
>>
>> It is similar to @Category in some ways but with some useful 
>> differences.
>>
>> What do folks think?
>>
>> Cheers, Paul.
>
>


Re: Interest in a @UtilityClass AST transform

Posted by David Clark <pl...@gmail.com>.
I vote yes.

Is @UtilityClass the expected name? Something like @AllStatic or just 
@Static makes more sense to me, but if @UtilityClass is in widespread 
use, then keep the name.


On 01/11/2018 06:57 PM, Paul King wrote:
>
> Hi all,
>
> Would there be interest in a @UtilityClass annotation - similar to 
> lombok's:
>
> https://projectlombok.org/features/experimental/UtilityClass
>
> It is similar to @Category in some ways but with some useful differences.
>
> What do folks think?
>
> Cheers, Paul.


Re: Interest in a @UtilityClass AST transform

Posted by MG <mg...@arscreat.com>.
I feel that this would register only on the ok-to-have level for me, for 
the simple reason, that

 1. You do not typically have a lot of utility-classes (or
    function-classes) in a project
 2. Afaiks all you save is the static keyword before every method,
    because if you incorrectly instantiate the class, you basically get
    an Object, and no harm is done

I would much rather see features such as final variables without an 
explicit type not being of type Object but of the type assigned to them 
- or proper named parameters (though I understand that this is alas a 
much bigger feature to implement), to get Groovy up to speed in this regard.

Cheers,
mg


On 12.01.2018 01:57, Paul King wrote:
>
> Hi all,
>
> Would there be interest in a @UtilityClass annotation - similar to 
> lombok's:
>
> https://projectlombok.org/features/experimental/UtilityClass
>
> It is similar to @Category in some ways but with some useful differences.
>
> What do folks think?
>
> Cheers, Paul.