javadoc注释中的代码示例 [英] code example in a javadoc comment

查看:36
本文介绍了javadoc注释中的代码示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有多个程序员为javadocs编写示例,并且某些示例包含以

I have multiple programmers contributing examples for javadocs and some examples contain comments formatted with

/*
 *
 */

当我将这些示例放入javadoc注释时,示例中的注释关闭将关闭javadoc注释.

When I put these examples into a javadoc comment, the comment close in the example closes the javadoc comment.

/**
 *
 * /*
 *  *
 *  */  <-- right here
 *
 */

是否有适当的方法来处理此问题,而不告诉所有人他们无法以这种格式编写评论?

Is there a proper way to handle this without telling everyone that they cannot write comments in this format?

推荐答案

Javadoc注释使用html,因此将/编码为实体:&#47;

Javadoc comments use html, so encode the / as an entity: &#47;

/**
 *
 * /*
 *  *
 *  *&#47;  <-- right here
 *
 */

告诉每个人不要在其代码示例中添加这种注释可能会更容易.

Telling everyone not to put that kind of comment in their code examples might be easier.

这篇关于javadoc注释中的代码示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆