Should we bring onMethod back?

19 views
Skip to first unread message

rjee

unread,
Nov 7, 2011, 4:07:43 PM11/7/11
to Project Lombok

Just a few months ago we had to conclude that we could no longer
sustain onMethod, a feature introduced in 0.10.0 betas which let you
specify annotations on @Getter and @Setter and such, which would be
moved to the generated methods. The reason for why we dropped this
feature had to do with javac7, and is explained here:

http://groups.google.com/group/project-lombok/browse_thread/thread/dd566ff0691ba111/


In short, Java7 would simply abort without even calling lombok, and
thus we had no way of fixing the bug before compilation.

But... Reinier and I just discovered a way to re-introduce onMethod!
While hacking out a syntax for a new feature, we discovered that
annotation processors would run, as long as the field that we used
within an annotation was not valid. @Getter(onMethod=@Deprecated) will
not work, but @Getter(randomNoise=@Deprecated) will work. So, as long
as we make the situation *worse* we can make annotation processors
(i.e. lombok) run and we can do our magic.

Taking this, the fix for onMethod is pretty simple: We add the
functionality, but we never actually add the field to the @Getter and
@Setter annotations. This does have a big downside, as you will *not*
get as-you-type completion on 'onMethod', but you will get completion
on the actual annotations itself, fortunately.

So, should we re-introduce this slightly less nice onMethod
construction? We'll definitely mark it as a 'beta' feature because we
don't know if javac updates will break this hack again; it's
definitely more hacky than the usual things we do with lombok.

love to hear your opinion!

Fabrizio Giudici

unread,
Nov 7, 2011, 4:14:43 PM11/7/11
to Project Lombok, rjee
On Mon, 07 Nov 2011 22:07:43 +0100, rjee <groo...@gmail.com> wrote:


> So, should we re-introduce this slightly less nice onMethod
> construction? We'll definitely mark it as a 'beta' feature because we
> don't know if javac updates will break this hack again; it's
> definitely more hacky than the usual things we do with lombok.
>
> love to hear your opinion!

Too hacky. It's too probable that a new javac change breaks it again,
forcing people to change their code. And degrading the reputation of
Lombok as being "too tricky".

Can't be just talk to javac people and have something that is reliable? :-)


--
Fabrizio Giudici - Java Architect, Project Manager
Tidalwave s.a.s. - "We make Java work. Everywhere."
fabrizio...@tidalwave.it
http://tidalwave.it - http://fabriziogiudici.it

Joseph Ottinger

unread,
Nov 7, 2011, 7:15:21 PM11/7/11
to project...@googlegroups.com, rjee
I kinda like the idea, myself.
> --
> You received this message because you are subscribed to the Google
> Groups group for http://projectlombok.org/
>
> To post to this group, send email to project...@googlegroups.com
> To unsubscribe from this group, send email to
> project-lombo...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/project-lombok?hl=en

--
Joseph B. Ottinger
http://enigmastation.com
Ça en vaut la peine.

Joseph Ottinger

unread,
Nov 9, 2011, 12:55:53 PM11/9/11
to project...@googlegroups.com, rjee
I kinda like the idea, myself.

On Monday, November 7, 2011, Fabrizio Giudici <Fabrizio...@tidalwave.it> wrote:
Reply all
Reply to author
Forward
0 new messages