Skip to content

Commit c5600b5

Browse files
committed
Fix spotbugs warning.
1 parent 3a6ba9c commit c5600b5

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

lib/src/ktlint/java/com/diffplug/spotless/glue/ktlint/KtlintFormatterFunc.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,20 @@ public class KtlintFormatterFunc implements FormatterFunc.NeedsFile {
4343
public KtlintFormatterFunc(boolean isScript, Map<String, String> userData) {
4444
rulesets = Collections.singletonList(new StandardRuleSetProvider().get());
4545
this.userData = userData;
46-
formatterCallback = new Function2<LintError, Boolean, Unit>() {
47-
@Override
48-
public Unit invoke(LintError lint, Boolean corrected) {
49-
if (!corrected) {
50-
throw new AssertionError("Error on line: " + lint.getLine() + ", column: " + lint.getCol() + "\n" + lint.getDetail());
51-
}
52-
return null;
53-
}
54-
};
46+
formatterCallback = new FormatterCallback();
5547
this.isScript = isScript;
5648
}
5749

50+
static class FormatterCallback implements Function2<LintError, Boolean, Unit> {
51+
@Override
52+
public Unit invoke(LintError lint, Boolean corrected) {
53+
if (!corrected) {
54+
throw new AssertionError("Error on line: " + lint.getLine() + ", column: " + lint.getCol() + "\n" + lint.getDetail());
55+
}
56+
return null;
57+
}
58+
}
59+
5860
@Override
5961
public String applyWithFile(String unix, File file) throws Exception {
6062
return KtLint.INSTANCE.format(new Params(

0 commit comments

Comments
 (0)