Dun*_*nes 11 java eclipse refactoring checkstyle
Eclipse Checkstyle插件提供了两种自动更正问题的方法:
右键单击单个源文件,然后选择"应用Checkstyle更正".
右键单击问题标记,然后选择"快速修复".
如果我选择多个相同类型的标记并尝试快速修复所有标记,则Eclipse指出:
所选问题没有常见的适用快速修复方法.
有没有办法让我以更有效的方式执行相同类型的多个Checkstyle修正?
(参见相关问题:如何轻松修复Checkstyle错误?)
举个例子,考虑以下代码:
/**
* Example to demonstrate check-style quick fix.
*/
public final class CheckStyle {
/**
* Example constructor with no if braces.
*
* @param arg an argument
*/
public CheckStyle(final String arg) {
if (arg == null)
throw new RuntimeException("Arg is null.");
if (arg.isEmpty())
throw new RuntimeException("Arg is empty.");
}
}
Run Code Online (Sandbox Code Playgroud)
根据Sun的checkstyle配置检查时,会收到三个错误:

如果我选择与缺少大括号相关的两个错误并尝试快速修复它们,那么它将无法工作.
| 归档时间: |
|
| 查看次数: |
5963 次 |
| 最近记录: |