in log4j-docgen/src/main/java/org/apache/logging/log4j/docgen/processor/AbstractAsciiDocTreeVisitor.java [283:300]
private static String linkLabelToAsciiDoc(final LinkTree node) {
int[] labelTokenIndex = {0};
return node.getLabel().stream()
.map(labelToken -> {
if (!(labelToken instanceof TextTree)) {
final String message = String.format(
"Non-text labels in links are not allowed! "
+ "That is, `{@link foo.bar.Baz awesome thing}` is allowed, whereas {@link foo.bar.Baz {@code doh}}` is not. "
+ "While visiting link `%s`, label token at index %d found to be of unexpected type: `%s`",
node, labelTokenIndex[0], labelToken.getClass().getCanonicalName());
throw new IllegalArgumentException(message);
}
labelTokenIndex[0]++;
final TextTree textLabel = (TextTree) labelToken;
return textLabel.getBody();
})
.collect(Collectors.joining(" "));
}