The Eclipse Checkstyle plugin offers two ways to auto-correct issues:
-
Right-click on an individual source file and select “Apply Checkstyle Corrections”.
-
Right-click on problem marker and select “Quick Fix”.
If I select multiple markers of the same type and attempt to quick fix all of them, Eclipse states:
The selected problems do not have a common applicable quick fix.
Is there a way for me to execute multiple Checkstyle corrections of the same type in a more efficient manner?
(See related question: How can I easily fix Checkstyle errors?)
To give an example, consider the following code:
/**
* 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.");
}
}
When checked against Sun’s checkstyle configuration, three errors are picked up:

If I select the two errors relating to missing braces and try and quick-fix the pair of them, it will not work.
Since version 5.6.1, this capability is now available in eclipse-cs. I’ve just tested this with 5.7.0 (the latest version) and confirmed it works.
For reference, the original bug report is here. The feature doesn’t appear in the release notes for that version, but that’s due to omission (see comments in bug report).