Skip to content

Commit

Permalink
Fix issue eclipse-ee4j#1819 incorrect enum value name generation with…
Browse files Browse the repository at this point in the history
… leading digits

The first character of an enum value name is checked whether it complies with isJavaIdentifierStart, if not an underscore prefix will be added to that name.
  • Loading branch information
TheMinefighter authored Oct 14, 2024
1 parent b7d1ff7 commit 32467f0
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,8 @@ private List<CEnumConstant> buildCEnumConstants(XSRestrictionSimpleType type, bo

if(name==null) {
StringBuilder sb = new StringBuilder();
if (factValue.length()>0 && !Character.isJavaIdentifierStart(facetValue.charAt(0)))
sb.append('_'); //Otherwise enum constants starting with digits will be renamed to VALUE_x
for( int i=0; i<facetValue.length(); i++) {
char ch = facetValue.charAt(i);
if(Character.isJavaIdentifierPart(ch))
Expand Down

0 comments on commit 32467f0

Please sign in to comment.