Book a Demo

Author Topic: Java 1.5 enum code generation error  (Read 2295 times)

davisupmc

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Java 1.5 enum code generation error
« on: November 07, 2005, 11:12:01 am »
It seems as though there is an error in code generation for Java 1.5 enumerations.  Normal 1.5 syntax is

public enum Gender {
Male, Female;}

however, EA generates the following:

public enum Gender {
;
private int Male;
private int Female;
}

this does not work when I try to retrieve the values.  Does anyone have the correct code template for this?

regards

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Java 1.5 enum code generation error
« Reply #1 on: November 07, 2005, 01:06:01 pm »
The default java templates require that you stereotype your attributes with "enum".  This is to distinguish between then enumeration values, and the rest of the class that the designers of Java 1.5 included.

You can of course change this behaviour of the templates, so that you need to stereotype your attributes that aren't the enumeration values.  However that will have other consequences if you want to use synchronisation and/or reverse engineering.
« Last Edit: November 07, 2005, 01:08:33 pm by simonm »

davisupmc

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Java 1.5 enum code generation error
« Reply #2 on: November 07, 2005, 01:49:07 pm »
Works!  thanks Simon   :)