Skip to content

Commit

Permalink
Ensure enum names are valid identifiers.
Browse files Browse the repository at this point in the history
  • Loading branch information
christiandeange committed Mar 10, 2024
1 parent f42a3cb commit 12beb29
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ fun createEnumClass(
.apply {
values.forEach { value ->
addEnumConstant(
name = value.substringAfterLast('#').toEnumCase(),
name = value.substringAfterLast('#').trimStart { !it.isJavaIdentifierStart() }.toEnumCase(),
typeSpec = TypeSpec.anonymousClassBuilder()
.addAnnotation(
AnnotationSpec.builder(TypeNames.SerialName)
Expand Down

0 comments on commit 12beb29

Please sign in to comment.