Skip to content

Commit d1e9c1e

Browse files
TheMinefighterlukasj
authored andcommitted
Fix issue #1819 incorrect enum value name generation with 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.
1 parent 90db12f commit d1e9c1e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/SimpleTypeBuilder.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,8 @@ private List<CEnumConstant> buildCEnumConstants(XSRestrictionSimpleType type, bo
674674

675675
if(name==null) {
676676
StringBuilder sb = new StringBuilder();
677+
if (facetValue.length()>0 && !Character.isJavaIdentifierStart(facetValue.charAt(0)))
678+
sb.append('_');
677679
for( int i=0; i<facetValue.length(); i++) {
678680
char ch = facetValue.charAt(i);
679681
if(Character.isJavaIdentifierPart(ch))

0 commit comments

Comments
 (0)