You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Paul Bjorkstrand <pa...@gmail.com> on 2021/12/23 21:46:36 UTC

Introducing Lombok to Sling?

I am not a huge fan of boilerplate code, and getters/setters are my biggest
pet peeve. I searched the dev archives and found nothing that referenced
Lombok. Is there a reason it has not yet been introduced that I am not
aware of? If not, what is everyone's opinion around using Lombok within
Sling? I looked at the license, and it seems to be near-identical to HPND
[1] and HPND is one of ASF's Category A licenses [2]. It uses/includes ASM
[3] which uses a 3-clause BSD license [4], also one of the Category A
licenses.

While I wouldn't recommend allowing _everything_ from Lombok to be used, I
think it would be fair to allow the use of a subset of the features. I
would recommend the following approach:

These stabe features of Lombok [5] can be used without restriction:
- @Getter/@Setter
- @ToString
- @EqualsAndHashCode
- @NoArgsConstructor/@RequiredArgsConstructor/@AllArgsConstructor
- @Data/@Value (at least until we can use records [6], introduced in JDK
14, finalized in JDK 16)
- @Builder
- @Slf4j

All other stable features would be evaluated on a per-use basis. All
experimental features would not be allowed to be used.

These seem, to me, to be reasonable guidelines, and align with the usages I
have seen in other places (including my own projects).

[1]: https://opensource.org/licenses/HPND
[2]: https://www.apache.org/legal/resolved.html#category-a
[3]: https://asm.ow2.io/index.html
[4]: https://opensource.org/licenses/BSD-3-Clause
[5]: https://projectlombok.org/features/all
[6]: https://docs.oracle.com/en/java/javase/14/language/records.html


-Paul

Re: Introducing Lombok to Sling?

Posted by Roy Teeuwen <ro...@teeuwen.be>.
+1 also not a fan of Lombok, have already Delomboked a few projects because it just adds extra complexity / less debuggability

> On 24 Dec 2021, at 10:20, Konrad Windszus <kw...@apache.org> wrote:
> 
> Hi, 
> to be honest I am rather opposed to that idea as Lombok has the following disadvantages from my PoV:
> 
> - Incremental builds in Eclipse require a dedicated plugin
> - You need to know Lombok before you can understand the code in some cases
> - Another third party library
> - Refactoring support of IDEs
> 
> IMHO we don't have that much getters/setters in Sling code.
> For the long term we should rather use records (https://docs.oracle.com/en/java/javase/15/language/records.html <https://docs.oracle.com/en/java/javase/15/language/records.html>) instead of Lombok to reduce boilerplate code.
> 
> Is there a particular Sling module where there is a lot of boilerplate code we should get rid of?
> Regards,
> Konrad
> 
>> On 23. Dec 2021, at 22:46, Paul Bjorkstrand <pa...@gmail.com> wrote:
>> 
>> I am not a huge fan of boilerplate code, and getters/setters are my biggest
>> pet peeve. I searched the dev archives and found nothing that referenced
>> Lombok. Is there a reason it has not yet been introduced that I am not
>> aware of? If not, what is everyone's opinion around using Lombok within
>> Sling? I looked at the license, and it seems to be near-identical to HPND
>> [1] and HPND is one of ASF's Category A licenses [2]. It uses/includes ASM
>> [3] which uses a 3-clause BSD license [4], also one of the Category A
>> licenses.
>> 
>> While I wouldn't recommend allowing _everything_ from Lombok to be used, I
>> think it would be fair to allow the use of a subset of the features. I
>> would recommend the following approach:
>> 
>> These stabe features of Lombok [5] can be used without restriction:
>> - @Getter/@Setter
>> - @ToString
>> - @EqualsAndHashCode
>> - @NoArgsConstructor/@RequiredArgsConstructor/@AllArgsConstructor
>> - @Data/@Value (at least until we can use records [6], introduced in JDK
>> 14, finalized in JDK 16)
>> - @Builder
>> - @Slf4j
>> 
>> All other stable features would be evaluated on a per-use basis. All
>> experimental features would not be allowed to be used.
>> 
>> These seem, to me, to be reasonable guidelines, and align with the usages I
>> have seen in other places (including my own projects).
>> 
>> [1]: https://opensource.org/licenses/HPND
>> [2]: https://www.apache.org/legal/resolved.html#category-a
>> [3]: https://asm.ow2.io/index.html
>> [4]: https://opensource.org/licenses/BSD-3-Clause
>> [5]: https://projectlombok.org/features/all
>> [6]: https://docs.oracle.com/en/java/javase/14/language/records.html
>> 
>> 
>> -Paul
> 


Re: Introducing Lombok to Sling?

Posted by Konrad Windszus <kw...@apache.org>.
Hi, 
to be honest I am rather opposed to that idea as Lombok has the following disadvantages from my PoV:

- Incremental builds in Eclipse require a dedicated plugin
- You need to know Lombok before you can understand the code in some cases
- Another third party library
- Refactoring support of IDEs

IMHO we don't have that much getters/setters in Sling code.
For the long term we should rather use records (https://docs.oracle.com/en/java/javase/15/language/records.html <https://docs.oracle.com/en/java/javase/15/language/records.html>) instead of Lombok to reduce boilerplate code.

Is there a particular Sling module where there is a lot of boilerplate code we should get rid of?
Regards,
Konrad

> On 23. Dec 2021, at 22:46, Paul Bjorkstrand <pa...@gmail.com> wrote:
> 
> I am not a huge fan of boilerplate code, and getters/setters are my biggest
> pet peeve. I searched the dev archives and found nothing that referenced
> Lombok. Is there a reason it has not yet been introduced that I am not
> aware of? If not, what is everyone's opinion around using Lombok within
> Sling? I looked at the license, and it seems to be near-identical to HPND
> [1] and HPND is one of ASF's Category A licenses [2]. It uses/includes ASM
> [3] which uses a 3-clause BSD license [4], also one of the Category A
> licenses.
> 
> While I wouldn't recommend allowing _everything_ from Lombok to be used, I
> think it would be fair to allow the use of a subset of the features. I
> would recommend the following approach:
> 
> These stabe features of Lombok [5] can be used without restriction:
> - @Getter/@Setter
> - @ToString
> - @EqualsAndHashCode
> - @NoArgsConstructor/@RequiredArgsConstructor/@AllArgsConstructor
> - @Data/@Value (at least until we can use records [6], introduced in JDK
> 14, finalized in JDK 16)
> - @Builder
> - @Slf4j
> 
> All other stable features would be evaluated on a per-use basis. All
> experimental features would not be allowed to be used.
> 
> These seem, to me, to be reasonable guidelines, and align with the usages I
> have seen in other places (including my own projects).
> 
> [1]: https://opensource.org/licenses/HPND
> [2]: https://www.apache.org/legal/resolved.html#category-a
> [3]: https://asm.ow2.io/index.html
> [4]: https://opensource.org/licenses/BSD-3-Clause
> [5]: https://projectlombok.org/features/all
> [6]: https://docs.oracle.com/en/java/javase/14/language/records.html
> 
> 
> -Paul


Re: Introducing Lombok to Sling?

Posted by Paul Bjorkstrand <pa...@gmail.com>.
Sorry for the delayed reply, I sent that and went on a LONG staycation
where I (near literally) unplugged from anything remotely related to work.
To answer Konrad's question first: I don't have any particular module in
mind, just a question that popped in my head. Don't take my verbosity for
passion, though. I just wanted to provide more context/a start to the
conversation, rather than a "y u no lombok".

I am a fan of lombok, but for some projects it just doesn't make sense, and
Sling may just be one - per Konrad's point that it doesn't have a lot of
"data" carrier classes with getters/setters.

I totally agree with records (I even mentioned it in footnote [6] in the
first email). I am extremely eager to use newer Java features (switch
expressions, records, text blocks, pattern matching... , to name a few),
but am unfortunately constrained by the realities of how the corporate
world works.

Thanks for your inputs!

-Paul


On Mon, Jan 3, 2022 at 5:24 AM Stefan Seifert
<St...@diva-e.com.invalid> wrote:

> i would also favor to *not* add Lombok to any sling modules.
>
> stefan
>
> >-----Original Message-----
> >From: Paul Bjorkstrand <pa...@gmail.com>
> >Sent: Thursday, December 23, 2021 10:47 PM
> >To: dev@sling.apache.org
> >Subject: Introducing Lombok to Sling?
> >
> >I am not a huge fan of boilerplate code, and getters/setters are my
> biggest
> >pet peeve. I searched the dev archives and found nothing that referenced
> >Lombok. Is there a reason it has not yet been introduced that I am not
> >aware of? If not, what is everyone's opinion around using Lombok within
> >Sling? I looked at the license, and it seems to be near-identical to HPND
> >[1] and HPND is one of ASF's Category A licenses [2]. It uses/includes ASM
> >[3] which uses a 3-clause BSD license [4], also one of the Category A
> >licenses.
> >
> >While I wouldn't recommend allowing _everything_ from Lombok to be used, I
> >think it would be fair to allow the use of a subset of the features. I
> >would recommend the following approach:
> >
> >These stabe features of Lombok [5] can be used without restriction:
> >- @Getter/@Setter
> >- @ToString
> >- @EqualsAndHashCode
> >- @NoArgsConstructor/@RequiredArgsConstructor/@AllArgsConstructor
> >- @Data/@Value (at least until we can use records [6], introduced in JDK
> >14, finalized in JDK 16)
> >- @Builder
> >- @Slf4j
> >
> >All other stable features would be evaluated on a per-use basis. All
> >experimental features would not be allowed to be used.
> >
> >These seem, to me, to be reasonable guidelines, and align with the usages
> I
> >have seen in other places (including my own projects).
> >
> >[1]: https://opensource.org/licenses/HPND
> >[2]: https://www.apache.org/legal/resolved.html#category-a
> >[3]: https://asm.ow2.io/index.html
> >[4]: https://opensource.org/licenses/BSD-3-Clause
> >[5]: https://projectlombok.org/features/all
> >[6]: https://docs.oracle.com/en/java/javase/14/language/records.html
> >
> >
> >-Paul
>

RE: Introducing Lombok to Sling?

Posted by Stefan Seifert <St...@diva-e.com.INVALID>.
i would also favor to *not* add Lombok to any sling modules.

stefan

>-----Original Message-----
>From: Paul Bjorkstrand <pa...@gmail.com>
>Sent: Thursday, December 23, 2021 10:47 PM
>To: dev@sling.apache.org
>Subject: Introducing Lombok to Sling?
>
>I am not a huge fan of boilerplate code, and getters/setters are my biggest
>pet peeve. I searched the dev archives and found nothing that referenced
>Lombok. Is there a reason it has not yet been introduced that I am not
>aware of? If not, what is everyone's opinion around using Lombok within
>Sling? I looked at the license, and it seems to be near-identical to HPND
>[1] and HPND is one of ASF's Category A licenses [2]. It uses/includes ASM
>[3] which uses a 3-clause BSD license [4], also one of the Category A
>licenses.
>
>While I wouldn't recommend allowing _everything_ from Lombok to be used, I
>think it would be fair to allow the use of a subset of the features. I
>would recommend the following approach:
>
>These stabe features of Lombok [5] can be used without restriction:
>- @Getter/@Setter
>- @ToString
>- @EqualsAndHashCode
>- @NoArgsConstructor/@RequiredArgsConstructor/@AllArgsConstructor
>- @Data/@Value (at least until we can use records [6], introduced in JDK
>14, finalized in JDK 16)
>- @Builder
>- @Slf4j
>
>All other stable features would be evaluated on a per-use basis. All
>experimental features would not be allowed to be used.
>
>These seem, to me, to be reasonable guidelines, and align with the usages I
>have seen in other places (including my own projects).
>
>[1]: https://opensource.org/licenses/HPND
>[2]: https://www.apache.org/legal/resolved.html#category-a
>[3]: https://asm.ow2.io/index.html
>[4]: https://opensource.org/licenses/BSD-3-Clause
>[5]: https://projectlombok.org/features/all
>[6]: https://docs.oracle.com/en/java/javase/14/language/records.html
>
>
>-Paul