Closed GoogleCodeExporter closed 9 years ago
Original comment by philippe.beaudoin
on 20 Sep 2010 at 3:03
Ouh crap, there is something like that in the current trunk but I also did not
use the Modifier enum. I could provide a patch for the GenerationHelper so that
the modifiers in the generated sources equals the modifier in the @GenX element
or is this issue already addressed to someone?
Replacement for AnnotationHelper in 0.5:
http://code.google.com/p/gwt-platform/source/browse/src/com/gwtplatform/annotati
on/processor/GenerationHelper.java
Original comment by FloOn...@gmail.com
on 20 Sep 2010 at 3:37
Go for it !
What's your committer name !?
Original comment by goudreau...@gmail.com
on 20 Sep 2010 at 4:10
I think that should be floonweb.
Original comment by FloOn...@gmail.com
on 21 Sep 2010 at 7:49
I just assigned you this issue :D Try to work on a branch with the issue number
or a clone if it's going to be breaking change.
Cheers,
Original comment by goudreau...@gmail.com
on 21 Sep 2010 at 12:10
Great, thanks Christian :) I'll work with my clone.
What do you think about following to solve the problems with final fields:
Use the @Final annotation on fields when you want to set the final value by
passing a parameter to constructor.
Code:
@GenDto
public class Product {
@Final private String myAge;
public String myName;
}
Generates:
public class ProductDto {
private final String myAge;
public String myName;
public MyClass(String myAge, String myName) {
this.myAge = myAge;
this.myName = myName;
}
....
}
Final fields without the @Final annotation will generate following:
Code:
@GenDto
public class Product {
private final String myAge = "20";
public String myName;
}
Generates:
public class ProductDto {
private final String myAge = "20";
public String myName;
public MyClass(String myName) {
this.myName = myName;
}
greetings Flori
Original comment by FloOn...@gmail.com
on 22 Sep 2010 at 6:56
[deleted comment]
Or you think it is not required to initialize final fields subsequently?
Original comment by FloOn...@gmail.com
on 22 Sep 2010 at 7:03
Number two is better, no ? though Getter and setter are missing or it was to
simplify the example ? :D
Original comment by goudreau...@gmail.com
on 22 Sep 2010 at 11:26
Original comment by philippe.beaudoin
on 22 Sep 2010 at 1:40
Original comment by FloOn...@gmail.com
on 22 Sep 2010 at 11:52
Original comment by goudreau...@gmail.com
on 23 Sep 2010 at 10:20
If u want to set a final field over the constructor the according object can
not have an empty constructor for serialization. So I think that in most cases
the setting of final fields over the constructor is meaningless and therefore
shouldn't be possible for @GenX annotations. Do you agree?
Original comment by FloOn...@gmail.com
on 24 Sep 2010 at 10:17
I agree. I would even have said: no final for DTOs since final fields are not
serialized. (Maybe allow for public final static fields for constants, but they
can store them elsewhere, a DTO is not the best place for this.)
Original comment by philippe.beaudoin
on 24 Sep 2010 at 6:50
Patch available: http://codereview.appspot.com/2283041/
I would be happy if you test the generation in more detail and all kind of
combinations.
Original comment by FloOn...@gmail.com
on 27 Sep 2010 at 8:31
Created a new clone with changes:
http://code.google.com/r/floonweb-annotationmodifiers/source/browse
Please ignore the codereview mentioned above.
Original comment by FloOn...@gmail.com
on 29 Sep 2010 at 8:29
New code review available at: http://codereview.appspot.com/2317041
Original comment by FloOn...@gmail.com
on 29 Sep 2010 at 8:37
Merged with trunk.
Florian, can you please update
http://code.google.com/p/gwt-platform/wiki/BoilerplateGeneration with details
of new features.
Original comment by bren...@doherty.net.nz
on 7 Oct 2010 at 6:43
Reopening until doc is updated.
Original comment by philippe.beaudoin
on 7 Oct 2010 at 4:26
http://code.google.com/p/gwt-platform/wiki/BoilerplateGeneration updated
(section @Optional & Modifiers and Constants).
Original comment by FloOn...@gmail.com
on 10 Oct 2010 at 4:03
Original comment by FloOn...@gmail.com
on 10 Oct 2010 at 4:09
Original issue reported on code.google.com by
harald.pehl
on 20 Sep 2010 at 2:19