Issue created <http://jira.codehaus.org/browse/CASTOR-2827> with a patch submitted.
Regards, Stevo. On Fri, Aug 14, 2009 at 11:09 AM, Werner Guttmann <[email protected]>wrote: > Hi Stevo, > > mind filing one or more Jira issues for those tasks ? And please make > sure before doing so that those issues still exist in SVN trunk. > > Regards > Werner > > Stevo Slavić wrote: > > Hello castor users, > > > > Generation of java5 enums for simpleType enumeration has been added in > > Castor v1.2 (see this issue <http://jira.codehaus.org/browse/CASTOR-2117 > >). > > castor-maven-plugin v1.5 depends on castor-codegen v1.2 and generates > java5 > > enums well, but I'd like to suggest following few improvements: > > > > 1. all java 5 enums implement Serializable (and Comparable too; see > > java.lang.Enum > > javadoc <http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Enum.html > >), > > so there is no need to generate "implements java.io.Serializable" > > 2. similarly, there is no need to generate > '@SuppressWarnings("serial")' > > since there is no need to specify serialVersionUID anyway, all enums > have a > > fixed serialVersionUID = 0L, and even if one specifies different value > it is > > being ignored (see this related > > blog< > http://marxsoftware.blogspot.com/2009/06/java-enums-are-inherently-serializable.html > >and > > Sun > > Java doc< > http://java.sun.com/javase/6/docs/platform/serialization/spec/serial-arch.html#6469 > >for > > detailed explanation) > > 3. since all simpleType enumerations have a value, and Castor > generates a > > value property for them and uses/sets that value in Enum constructor > for > > every Enum constant, couldn't generated fromValue method be optimized > to use > > e.g. a EnumMap > > <http://java.sun.com/j2se/1.5.0/docs/api/java/util/EnumMap.html>which > > would get filled with (value,Enum) pairs in Enum constructor, so that > > currently used for-loop in generated fromValue is avoided for > increased > > efficiency? > > > > > > Regards, > > Stevo. > > > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > >

