Repository navigation
[2447] Escape the block comment terminator when exporting a comment body - #2448
Merged
AxelRICHARD merged 1 commit intoAug 20, 2026
Merged
AxelRICHARD merged 1 commit into
AxelRICHARD merged 1 commit into
Conversation
AxelRICHARD
approved these changes
Aug 20, 2026
getCommentBody concatenated the body between "/* " and " */" without any escaping, so a body containing the terminator closed the comment early and the rest of it was exported as if it were SysML v2 code, giving a file which does not parse. Documenting a piece of code is enough to run into it. The grammar defines a comment as a non greedy match up to the first terminator, with no escape sequence and no nesting, so that sequence cannot be represented inside a comment body. It is separated by a space instead, and reported as a warning through the existing report consumer, since the exported text is then not exactly the one which was written and that should not happen silently. The reverse replacement is deliberately not done on import: a body may legitimately contain the separated form, and turning it back would corrupt it. getCommentBody is used for the body of a Comment, of a Documentation and of a TextualRepresentation, so all three are covered. Bug: eclipse-syson#2447 Signed-off-by: kkkk1258999 <fishing_kaba@yahoo.co.jp>
AxelRICHARD
force-pushed
the
kab/fix/escape-comment-terminator
branch
from
August 20, 2026 13:35
0cc20a1 to
1cfdd61
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
PLEASE READ ALL ITEMS AND CHECK ONLY RELEVANT CHECKBOXES BELOW
Auto review
Project management
priority:andpr:labels been added to the pull request? (In case of doubt, start with the labelspriority: lowandpr: to review later)area:,type:)Changelog and release notes
CHANGELOG.adoc+doc/content/modules/user-manual/pages/release-notes/YYYY.MM.0.adocbeen updated to reference the relevant issues?CHANGELOG.adoc?CHANGELOG.adoc?doc/content/modules/user-manual/pages/release-notes/YYYY.MM.0.adoc?Key highlightssection indoc/content/modules/user-manual/pages/release-notes/YYYY.MM.0.adoc?Documentation
Tests
The unchecked boxes of the Project management section are the ones I have no
permission for: the milestone and the labels, on this pull request and on the
issue. Could someone from the team set them? The remaining unchecked boxes do
not apply: there is no API break, no dependency change, and no visual impact
since this only changes the exported text.
Fixes #2447
Problem
getCommentBodyconcatenated the body between/*and*/without anyescaping, so a body containing the terminator closed the comment early and the
rest of it was exported as if it were SysML v2 code:
The comment ends at the first terminator,
in the codeis left as code and thetrailing one is dangling, so the exported file does not parse. Documenting a
piece of code is enough to run into it.
Fix
The grammar defines a comment as
a non greedy match up to the first terminator, with no escape sequence and no
nesting, so that sequence cannot be represented inside a comment body. It is
separated by a space instead:
Since the exported text is then not exactly the one that was written, it is
reported as a warning through the existing report consumer rather than changed
silently. The export was silently broken before, and a silent rewrite would
only move the surprise somewhere else.
The reverse replacement is deliberately not done on import: a body may
legitimately contain the separated form, and turning it back would corrupt it.
getCommentBodyis used for the body of aComment, of aDocumentationandof a
TextualRepresentation, so all three are covered by the single change.Tests
SysMLElementSerializerTest.documentationContainingACommentTerminatorexportsa documentation whose body contains the terminator, and checks both the
separated form in the output and the reported warning.
The 124 existing tests of
SysMLElementSerializerTestand the 47 tests ofImportExportTestsstill pass.Note
This came out of #2436, where the documentation widget of the Details view is
to be replaced by the RichTextEditor. It is not specific to rich text though,
the defect is there today, which is why it is fixed separately and does not
wait for the SiriusWeb release.