Clarify behaviour with multiple annotation marks
Issue #84
closed
Discussions related to ADF Change 73 suggest that it is permissible to have multiple annotation
marks on a single text
node. Currently, the library explicitly rejects anything like this. If a caller attempts to build this construct gracefully through the library, they will get an exception:
com.atlassian.adf.model.ex.mark.MarkException$DuplicateMarkType: duplicate mark type: annotation
(path: .annotation)
at com.atlassian.adf.model.node.MarkHolder.lambda$addIfAllowed$4(MarkHolder.java:97)
at com.atlassian.adf.model.node.MarkHolder.lambda$add$1(MarkHolder.java:77)
at com.atlassian.adf.model.ex.AdfException.frame(AdfException.java:70)
at com.atlassian.adf.model.node.MarkHolder.add(MarkHolder.java:75)
at com.atlassian.adf.model.node.Text.mark(Text.java:223)
During parsing, the duplicate marks are detected and silently discarded.
- Establish testing around the current behaviour.
- Confirm whether duplicate marks are really acceptable.
- If so, figure out what API changes are required to allow for this
- Is this behaviour peculiar to
annotation
, or should other duplicate marks also be allowed? - How can this be represented in a way that doesn't overly complicate the existing
MarkHolder
implementation. Maybe an annotation or marker class on the mark to indicate that it permits additional marks of the same type? - Idea: Make it work something like
Throwable.getSuppressed()
. The interface definessuppressedMarks()
to access additional marks of the same type. TheMarkHolder
is aware of this and a) parses redundant marks of that type usingaddSuppressed(M)
, and b) serializes the suppressed marks as well, after the mark itself has been rendered.
- Is this behaviour peculiar to
Comments (3)
-
reporter -
reporter - changed status to resolved
Fixed in
0.36.0
-
reporter - changed status to closed
- Log in to comment
I changed my mind on the whole "addSuppressed" approach. It's a big ugly. Instead, I'm changing the internal
MarkHolder
to have a more flexible key system than just the mark type. While this does create a few temporary warts, I think it's a lot more elegant and manageable than the alternatives.