Open GoogleCodeExporter opened 8 years ago
Works for me with this class:
public class Person {
private String firstname;
private final String lastname;
}
Generates:
public class Person {
private String firstname;
private final String lastname;
public static class Builder {
private String firstname;
private String lastname;
public Builder firstname(String firstname) {
this.firstname = firstname;
return this;
}
public Builder lastname(String lastname) {
this.lastname = lastname;
return this;
}
public Person build() {
return new Person(this);
}
}
private Person(Builder builder) {
this.firstname = builder.firstname;
this.lastname = builder.lastname;
}
}
which seems to be entirely correct w.r.t. the final field.
Original comment by pelle.ev...@gmail.com
on 27 Apr 2012 at 8:10
[deleted comment]
This does not work for me either.
Original comment by adam.g...@evocatus.com
on 9 Nov 2012 at 3:31
I just ran into this as well using Eclipe Juno and the BPEP 1.0.0 SNAPSOT.
When creating the test class below:
public class Person {
private final String firstName;
private final String lastName;
}
And attempting to run the builder, there are no fields which are selectable
(see attached image). Removing the final modifier from both of the fields
makes it work as expected.
Original comment by joh...@gmail.com
on 10 Jan 2013 at 4:50
Attachments:
Final fields are supported again in the newest version of the code, thanks to
the patch submitted in issue #9. The code for the newest version can nowadays
be found from GitHub: https://github.com/henningjensen/bpep :)
Original comment by ville...@gmail.com
on 16 Feb 2013 at 10:02
Original issue reported on code.google.com by
david.jo...@gmail.com
on 29 Jul 2011 at 6:41