Skip to content

Commit

Permalink
Clarify meaning of 'inserted' to be 'inserted before the end of the l…
Browse files Browse the repository at this point in the history
…ist of existing values'
  • Loading branch information
ianbotsf authored and mtdowling committed Aug 2, 2021
1 parent cc9ce60 commit 08c827a
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
/**
* Emits a NOTE when a new enum value is appended, emits an ERROR when an
* enum value is removed, emits an ERROR when an enum name changes, and
* emits an ERROR when a new enum value is inserted.
* emits an ERROR when a new enum value is inserted before the end of the
* list of existing values.
*/
public final class ChangedEnumTrait extends AbstractDiffEvaluator {
@Override
Expand Down Expand Up @@ -75,8 +76,9 @@ private List<ValidationEvent> validateEnum(ChangedShape<Shape> change, Pair<Enum
if (!oldTrait.getEnumDefinitionValues().contains(definition.getValue())) {
if (newPosition <= oldEndPosition) {
events.add(error(change.getNewShape(), String.format(
"Enum value `%s` was inserted. This can cause compatibility issues when ordinal values are "
+ "used for iteration, serialization, etc.", definition.getValue())));
"Enum value `%s` was inserted before the end of the list of existing values. This can "
+ "cause compatibility issues when ordinal values are used for iteration, "
+ "serialization, etc.", definition.getValue())));
} else {
events.add(note(change.getNewShape(), String.format(
"Enum value `%s` was appended", definition.getValue())));
Expand Down

0 comments on commit 08c827a

Please sign in to comment.