projectlombok / lombok

Very spicy additions to the Java programming language.
https://projectlombok.org/
Other
12.94k stars 2.4k forks source link

Feature request: please make @Delegate non-experimental #1176

Open arnonmoscona opened 8 years ago

arnonmoscona commented 8 years ago

@Delegate was experimental for a long time, and the Lombok page actually slates it for deprecation, partly on the rationale that it is not commonly used. The delegate pattern is very mainstream, and associated concepts like mixins and traits are increasingly becomeing integral to programmin languages. Scala, Kotlin, Groovy, are just a few examples. It is an indespensible annotation if you want to use composition frequently (for instance if you want to to a lot of COP/DCI style coding)

People cannot use @Delegate in any situation where you want confidence that it won't be removed. So "not many using it" is a self fulfilling prophecy.

If the implementation team feels that some of the functionality of the existing @Delegate annotation is unsafe or cannot be made stable, then maybe you can create another annotation that only includes the safe/stable parts. You might call it @Mixin, @DelegateTo or some such name that would preserve compatibility for existing code that uses @Delegate

arnonmoscona commented 8 years ago

Note: there are two @Delegate pages. The one you get to through the normal site navigation is under the experimental and has a negative disposition: https://projectlombok.org/features/experimental/Delegate.html

There is another, different page, that does not mention and experimental stuff. So if that is the correct one, then there's no issue other than a broken Lombok site. See here: https://projectlombok.org/features/Delegate.html

Maaartinus commented 8 years ago

To me it looks like the non-experimental stuff is there for backwards compatibility only. In any case,

I agree that it's a cool feature. As I can't recall any recent related issues, the authors could rethink their decision. Otherwise, please add something like "state 2016-08-18" to the page so that we know the decision is still up to date.

spifd commented 7 years ago

+1

I've recently used it with the popular Visitor pattern (https://en.wikipedia.org/wiki/Visitor_pattern) so that a Visitor can be easily composed of multiple sub-Visitor delegate implementations. This is very convenient to avoid writing tons of annoying visit delegation code and it does the job well for my "simple" use case.