You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
JavaDocImpl.comment() throws on a javadoc containing a literal {n} #166
JavaDocImpl.comment() expands {n} in the stored text as a placeholder for inline tag n. Literal text of that form in the javadoc itself gets the same treatment. When n is not a valid tag index, comment() throws.
java.lang.IndexOutOfBoundsException: Index: 1 Size: 1
at java.base/java.util.ImmutableCollections$List12.get(ImmutableCollections.java:611)
at io.codelaser.maddi.cst.impl.element.JavaDocImpl.comment(JavaDocImpl.java:189)
This happened while parsing an open-source project (nacos) and calling comment() on each type's comments.
Minimal shape: a javadoc that contains a MessageFormat-style pattern and at least one inline tag, for example:
/** * Formats {@code key} as "{0}={1}". */
The stored text holds {0} for {@code key}, so tag 0 exists. The literal {0} and {1} are then taken as placeholders too. {1} is out of range and throws. {0} is silently replaced by the wrong tag.
Expected:comment() returns the javadoc text as written. Literal {n} sequences are kept, and only the parser's own placeholders are expanded.
Possible fixes:
Escape literal { (or {n}) when the placeholders are created, and unescape in comment().
Use a placeholder form that cannot occur in source text, such as one with a private-use character.
Either way, out-of-range indices should not throw.
Workaround for callers:commentWithPlaceholders() returns the stored text without expansion. That is enough for checks that only look for words in the comment.
Sorry this issue should have been closed yesterday. I already did the fix yesterday morning before the 0.9.6 release. I've had a quick look in the issue list and there are quite a few open but most require an in-depth understanding of the code-base. However, since the 0.9.6 release the IDE plugins and the MCP server are in very decent shape; it would help a lot if you could test-drive one of them, and report issues.
Activity
Tamilarasan-mac commentedon Oct 23, 2026
i like to work on it
bnaudts commentedon Oct 23, 2026
Cool, give it a go. Ensure that you're working on the latest 'devel' branch, and commit with '-s' to sign off on the DCO.
bnaudts commentedon Oct 30, 2026
I'm working towards a new release on Tuesday Nov 3rd, and I'd like to get a fix in before that. Are you still interested in solving this issue?
JavaDocImpl.comment() keeps a literal {n} (#166)
Tamilarasan-mac commentedon Nov 3, 2026
Ok, I'll try my best
bnaudts commentedon Nov 3, 2026
Sorry this issue should have been closed yesterday. I already did the fix yesterday morning before the 0.9.6 release. I've had a quick look in the issue list and there are quite a few open but most require an in-depth understanding of the code-base. However, since the 0.9.6 release the IDE plugins and the MCP server are in very decent shape; it would help a lot if you could test-drive one of them, and report issues.