[project lombok] Fluent setters experiment

107 views
Skip to first unread message

Robin Fernandes

unread,
Apr 17, 2010, 8:16:32 PM4/17/10
to Project Lombok
Hi all,

I finally got around to trying out Project Lombok today. Great stuff!
The more I used it, the more it felt like fluent setters would be a
neat addition, so I thought I'd have a go at implementing a prototype.
I realise you're already looking at doing this as part of @Builder, so
it's just a bit of fun really:
http://github.com/rewbs/lombok/commit/ee60a6c21f48f7f9d8ca02db586e9949ae4888cc

I'm aware of at least 4 things that don't work properly yet in my
prototype (I think 1, 2 & 3 should be pretty easy to resolve, not yet
sure about 4):
1. Adding a fluent setter annotation does not yet result in a warning
if a user-added non-fluent setters already exists, and vice versa.
2. Fluent setters don't yet correctly return parametrized types.
3. No tie-in with @Data yet.
4. While the "fluent" attribute that I added to @Setter can co-exist
with the unnamed AccessLevel attribute when compiling with javac, this
doesn't work with the Eclipse compiler. In other words, the following
compiles with javac but not Eclipse:
@Setter(fluent=true, lombok.AccessLevel.PRIVATE) int foo;

I was really impressed by how simple it was to set up the environment
and start hacking.
By the way, is there a way to run the automated tests against the
Eclipse compiler handlers?

Cheers,
Robin

--
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

Reinier Zwitserloot

unread,
Apr 21, 2010, 6:01:37 AM4/21/10
to Project Lombok
There's isnt a way to test the eclipse handlers. But, the next major
release of lombok (flying turtle) uses a single unified AST, and its a
lot easier to test and debug than either ecj's or javac's. And, of
course, you'd only have to write 1 handler. That's gotta be a good
thing.

On Apr 18, 2:16 am, Robin Fernandes <ro...@soal.org> wrote:
> Hi all,
>
> I finally got around to trying out Project Lombok today. Great stuff!
> The more I used it, the more it felt like fluent setters would be a
> neat addition, so I thought I'd have a go at implementing a prototype.
> I realise you're already looking at doing this as part of @Builder, so
> it's just a bit of fun really:http://github.com/rewbs/lombok/commit/ee60a6c21f48f7f9d8ca02db586e994...
>
> I'm aware of at least 4 things that don't work properly yet in my
> prototype (I think 1, 2 & 3 should be pretty easy to resolve, not yet
> sure about 4):
> 1. Adding a fluent setter annotation does not yet result in a warning
> if a user-added non-fluent setters already exists, and vice versa.
> 2. Fluent setters don't yet correctly return parametrized types.
> 3. No tie-in with @Data yet.
> 4. While the "fluent" attribute that I added to @Setter can co-exist
> with the unnamed AccessLevel attribute when compiling with javac, this
> doesn't work with the Eclipse compiler. In other words, the following
> compiles with javac but not Eclipse:
> @Setter(fluent=true, lombok.AccessLevel.PRIVATE) int foo;
>
> I was really impressed by how simple it was to set up the environment
> and start hacking.
> By the way, is there a way to run the automated tests against the
> Eclipse compiler handlers?
>
> Cheers,
> Robin
>
> --
> You received this message because you are subscribed to the Google
> Groups group forhttp://projectlombok.org/

Robin Fernandes

unread,
Apr 21, 2010, 8:23:43 AM4/21/10
to project...@googlegroups.com
Hi,

That sounds great! I was just going to ask if there were any plans to
unify the AST transformation interfaces, since writing everything
twice is indeed a bit annoying.
Is the development code for flying turtle already available anywhere?

Cheers,
Robin

Reinier Zwitserloot

unread,
Apr 21, 2010, 7:49:04 PM4/21/10
to Project Lombok
Yes. The unified AST, which includes a parser and converters to the
ecj and javac ASTs, is available at http://github.com/rzwitserloot/lombok.ast.

Roel and I are currently working on updating lombok itself to work
with it, and as we were planning on a sort of reset on the lombok
github (it's a 100MB download due to us stupidly checking in website
videos and a bunch of libraries - whoops. Now we use ivy), that
development (which is just 3 days worth so far, we just started) isn't
in a branch or repo yet.


On Apr 21, 2:23 pm, Robin Fernandes <ro...@soal.org> wrote:
> Hi,
>
> That sounds great! I was just going to ask if there were any plans to
> unify the AST transformation interfaces, since writing everything
> twice is indeed a bit annoying.
> Is the development code for flying turtle already available anywhere?
>
> Cheers,
> Robin
>
Reply all
Reply to author
Forward
0 new messages