gpt4 book ai didi

java - 了解 CheckStyle 检查 "JavadocMethod",属性 "logLoadErrors"

转载 作者:太空宇宙 更新时间:2023-11-04 12:14:59 24 4
gpt4 key购买 nike

阅读 CheckStyle 文档 JavadocMethod我不明白 logLoadErrors 属性。

我们被告知

This check may need to load exception classes mentioned in the @throws tag to check whether they are RuntimeExceptions. If loading the class fails, this property allows to control checkstyle's error handling. If set to false a classpath configuration problem is assumed and the TreeWalker stops operating on the class completely. If set to true (the default) , checkstyle assumes a typo or refactoring problem in the javadoc and logs the problem in the normal checkstyle report (potentially masking a configuration error).

此外,属性suppressLoadErrors描述如下:

When logLoadErrors is set to true, the TreeWalker completely processes a class and displays any problems with loading exceptions as checkstyle violations. When this property is set to true, the violations generated when logLoadErrors is set true are suppressed from being reported as violations in the checkstyle report.

我的第一个想法是,在标准配置中 logLoadErrors = true,suppressLoadErrors = false 如果未找到 @throws 标记中提到的 Exception 类,CheckStyle 会发出警告。我尝试了这个例子:

 /**
* Returns if the first of two given numbers is smaller than the other one.
* @param a Description param a
* @param b Description param b
* @throws Exception bla
* @throws MyException foo
*/
public boolean javadocMethod(int a, int b) throws Exception, MyException {
return a < b;
}

我以为运行 CheckStyle 时会收到警告,因为类 MyException 不存在。但我没有收到任何警告。有人可以提供另一个例子吗?

最佳答案

此属性已被删除,因此从 v8.28 起不再可用。

您可以找到更多信息here .

关于java - 了解 CheckStyle 检查 "JavadocMethod",属性 "logLoadErrors",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39506566/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com