/**
* This method is used for ABC.
* @return
* @throw IOException when this exceptional condition occurs
*/
[Error]:line:4- Javadoc comment at column 0 has parse error. Details: no viable alternative at input ' *' while parsing JAVADOC_TAG [NonEmptyAtClauseDescription]
知道为什么我会在 Javadoc 的 @throw 行中收到此错误吗?如何解决这个问题?
最佳答案
如上所述,在返回标签中添加描述或将其完全删除以解决错误。
$ cat TestClass.java
public class TestClass {
/**
* This method is used for ABC.
* @return desc
* @throw IOException when this exceptional condition occurs
*/
int method() throws IOException {
return 0;
}
}
$ cat TestConfig.xml
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
<property name="charset" value="UTF-8"/>
<module name="TreeWalker">
<module name="NonEmptyAtclauseDescriptionCheck" />
</module>
</module>
$ java -jar checkstyle-9.0.1-all.jar -c TestConfig.xml TestClass.java
Starting audit...
Audit done.
关于java - 如何修复 Javadoc 注释有解析错误,详细信息 : no viable alternative at input ' *' while parsing JAVADOC_TAG [NonEmptyAtClauseDescription],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69725545/