Make sure that enum documentation contains unique IDs for animations #2060
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, on pages like this, the animations produced don't have unique IDs, because for enum fields, their
oneLineDoc
contains the entire documentation, so that they all appear in the Constants list on the enum's class page.The way we tried to generate unique values in the past was to assume that each element would appear on its own page, and so be unique, but that's not true for enums.
This change creates a package-level
Map<String, Set<String>
that contains a mapping fromElement.href
to a set of animation IDs that have been already used for that href. We then generate new ids, making sure that each new ID is unique for the href. This should assure that there are no non-unique IDs on a single output page, including checking to make sure that user-supplied IDs are unique per page.Also added a test that should make sure this is the case.