Assigned final fields and @AllArgsConstructor

473 views
Skip to first unread message

Nicolas Guillaumin

unread,
Sep 30, 2011, 3:05:30 AM9/30/11
to project...@googlegroups.com
Hi,

I've been using the 0.10.0-RC3 since a few month now quite happily,
thanks for this great tool !

I tried to switch my Eclipse projects to the official 0.10.0 but I came
across an issue: It seems that the behavior of @AllArgsConstructor and
assigned final fields has changed.

For example with the following class:
----------
import java.util.ArrayList;
import java.util.List;

import lombok.AllArgsConstructor;

@AllArgsConstructor
public class TestLombok {
private final List<String> lst = new ArrayList<String>();
private String str;
}
----------

With 0.10.0-RC3 (On Eclipse) lombok was generating a constructor with
the String field only, since the final list was already assigned.

With the 0.10.0 release lombok doesn't generate a constructor at all. If
I remove the final or the assignment then I get a constructor with the 2
arguments.

So is that a bug, or if it was an intentional change how can I have my
construction with String back again ? ;)

Thanks,

Nico

Philipp Eichhorn

unread,
Sep 30, 2011, 4:24:04 AM9/30/11
to Project Lombok
Hi Nico,

good catch.
Since it works with javac and the source code comment says "Skip
initialized final fields." I would say it is a bug, but got introduced
way back int 2010 with this commit: https://github.com/rzwitserloot/lombok/commit/52582dc
. So the issue should be present in all version since 0.10.0-RC1. I
Will fix this asap so that it gets included in 0.10.1. And if we are
good maybe Reinier will create a new edge release.

-- Philipp

On Sep 30, 9:05 am, Nicolas Guillaumin <nguillau...@funnelback.com>
wrote:

Reinier Zwitserloot

unread,
Oct 2, 2011, 7:38:37 AM10/2/11
to project...@googlegroups.com
Heh. Whoops.

I could make an edge release, but maybe we should just toss 0.10.1 out. 0.10.0-final also doesn't have the @Delegate-leaks-memory fix.

Eh, tomorrow is lombok day. I'll bring this up. If we don't make 0.10.1 tomorrowevening, we'll spin out an edge release.

Nicolas Guillaumin

unread,
Oct 3, 2011, 6:00:11 PM10/3/11
to project...@googlegroups.com
Thanks guys ! :)

Nico

Reply all
Reply to author
Forward
0 new messages