Skip to content

Commit 823dfa0

Browse files
committed
Merge branch 'main' into renovate/gradle-8.x
2 parents a76401b + 97b27ca commit 823dfa0

File tree

110 files changed

+3275
-877
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+3275
-877
lines changed

CHANGES.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,28 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
1111

1212
## [Unreleased]
1313
### Added
14+
* Add support for biome. The Rome project [was renamed to Biome](https://biomejs.dev/blog/annoucing-biome/).
15+
The configuration is still the same, but you should switch to the new `biome` tag / function and adjust
16+
the version accordingly. ([#1804](https://github.com/diffplug/spotless/issues/1804)).
17+
* Add support for `google-java-format`'s `skip-javadoc-formatting` option. ([#1793](https://github.com/diffplug/spotless/pull/1793))
18+
### Fixed
19+
* Fix support for plugins when using Prettier version `3.0.0` and newer. ([#1802](https://github.com/diffplug/spotless/pull/1802))
20+
### Changes
21+
* Bump default `flexmark` version to latest `0.64.0` -> `0.64.8`. ([#1801](https://github.com/diffplug/spotless/pull/1801))
22+
* Bump default `ktlint` version to latest `0.50.0` -> `1.0.0`. ([#1808](https://github.com/diffplug/spotless/pull/1808))
23+
24+
## [2.41.0] - 2023-08-29
25+
### Added
1426
* Add a `jsonPatch` step to `json` formatter configurations. This allows patching of JSON documents using [JSON Patches](https://jsonpatch.com). ([#1753](https://github.com/diffplug/spotless/pull/1753))
1527
* Support GJF own import order. ([#1780](https://github.com/diffplug/spotless/pull/1780))
1628
### Fixed
1729
* Use latest versions of popular style guides for `eslint` tests to fix failing `useEslintXoStandardRules` test. ([#1761](https://github.com/diffplug/spotless/pull/1761), [#1756](https://github.com/diffplug/spotless/issues/1756))
18-
* Add support for `prettier` version `3.0.0` and newer. ([#1760]https://github.com/diffplug/spotless/pull/1760), [#1751](https://github.com/diffplug/spotless/issues/1751))
19-
* Fix npm install calls when npm cache is not up-to-date. ([#1760]https://github.com/diffplug/spotless/pull/1760), [#1750](https://github.com/diffplug/spotless/issues/1750))
30+
* Add support for `prettier` version `3.0.0` and newer. ([#1760](https://github.com/diffplug/spotless/pull/1760), [#1751](https://github.com/diffplug/spotless/issues/1751))
31+
* Fix npm install calls when npm cache is not up-to-date. ([#1760](https://github.com/diffplug/spotless/pull/1760), [#1750](https://github.com/diffplug/spotless/issues/1750))
2032
### Changes
2133
* Bump default `eslint` version to latest `8.31.0` -> `8.45.0` ([#1761](https://github.com/diffplug/spotless/pull/1761))
2234
* Bump default `prettier` version to latest (v2) `2.8.1` -> `2.8.8`. ([#1760](https://github.com/diffplug/spotless/pull/1760))
35+
* Bump default `greclipse` version to latest `4.27` -> `4.28`. ([#1775](https://github.com/diffplug/spotless/pull/1775))
2336

2437
## [2.40.0] - 2023-07-17
2538
### Added

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,14 @@ lib('kotlin.KtLintStep') +'{{yes}} | {{yes}}
9494
lib('kotlin.KtfmtStep') +'{{yes}} | {{yes}} | {{no}} | {{no}} |',
9595
lib('kotlin.DiktatStep') +'{{yes}} | {{yes}} | {{no}} | {{no}} |',
9696
lib('markdown.FreshMarkStep') +'{{yes}} | {{no}} | {{no}} | {{no}} |',
97-
lib('markdown.FlexmarkStep') +'{{no}} | {{yes}} | {{no}} | {{no}} |',
97+
lib('markdown.FlexmarkStep') +'{{yes}} | {{yes}} | {{no}} | {{no}} |',
9898
lib('npm.EslintFormatterStep') +'{{yes}} | {{yes}} | {{no}} | {{no}} |',
9999
lib('npm.PrettierFormatterStep') +'{{yes}} | {{yes}} | {{no}} | {{no}} |',
100100
lib('npm.TsFmtFormatterStep') +'{{yes}} | {{yes}} | {{no}} | {{no}} |',
101101
lib('pom.SortPomStepStep') +'{{no}} | {{yes}} | {{no}} | {{no}} |',
102102
lib('protobuf.BufStep') +'{{yes}} | {{no}} | {{no}} | {{no}} |',
103103
lib('python.BlackStep') +'{{yes}} | {{no}} | {{no}} | {{no}} |',
104-
lib('rome.RomeStep') +'{{yes}} | {{yes}} | {{no}} | {{no}} |',
104+
lib('biome.BiomeStep') +'{{yes}} | {{yes}} | {{no}} | {{no}} |',
105105
lib('scala.ScalaFmtStep') +'{{yes}} | {{yes}} | {{yes}} | {{no}} |',
106106
lib('sql.DBeaverSQLFormatterStep') +'{{yes}} | {{yes}} | {{yes}} | {{no}} |',
107107
extra('wtp.EclipseWtpFormatterStep') +'{{yes}} | {{yes}} | {{no}} | {{no}} |',
@@ -146,14 +146,14 @@ lib('yaml.JacksonYamlStep') +'{{yes}} | {{yes}}
146146
| [`kotlin.KtfmtStep`](lib/src/main/java/com/diffplug/spotless/kotlin/KtfmtStep.java) | :+1: | :+1: | :white_large_square: | :white_large_square: |
147147
| [`kotlin.DiktatStep`](lib/src/main/java/com/diffplug/spotless/kotlin/DiktatStep.java) | :+1: | :+1: | :white_large_square: | :white_large_square: |
148148
| [`markdown.FreshMarkStep`](lib/src/main/java/com/diffplug/spotless/markdown/FreshMarkStep.java) | :+1: | :white_large_square: | :white_large_square: | :white_large_square: |
149-
| [`markdown.FlexmarkStep`](lib/src/main/java/com/diffplug/spotless/markdown/FlexmarkStep.java) | :white_large_square: | :+1: | :white_large_square: | :white_large_square: |
149+
| [`markdown.FlexmarkStep`](lib/src/main/java/com/diffplug/spotless/markdown/FlexmarkStep.java) | :+1: | :+1: | :white_large_square: | :white_large_square: |
150150
| [`npm.EslintFormatterStep`](lib/src/main/java/com/diffplug/spotless/npm/EslintFormatterStep.java) | :+1: | :+1: | :white_large_square: | :white_large_square: |
151151
| [`npm.PrettierFormatterStep`](lib/src/main/java/com/diffplug/spotless/npm/PrettierFormatterStep.java) | :+1: | :+1: | :white_large_square: | :white_large_square: |
152152
| [`npm.TsFmtFormatterStep`](lib/src/main/java/com/diffplug/spotless/npm/TsFmtFormatterStep.java) | :+1: | :+1: | :white_large_square: | :white_large_square: |
153153
| [`pom.SortPomStepStep`](lib/src/main/java/com/diffplug/spotless/pom/SortPomStepStep.java) | :white_large_square: | :+1: | :white_large_square: | :white_large_square: |
154154
| [`protobuf.BufStep`](lib/src/main/java/com/diffplug/spotless/protobuf/BufStep.java) | :+1: | :white_large_square: | :white_large_square: | :white_large_square: |
155155
| [`python.BlackStep`](lib/src/main/java/com/diffplug/spotless/python/BlackStep.java) | :+1: | :white_large_square: | :white_large_square: | :white_large_square: |
156-
| [`rome.RomeStep`](lib/src/main/java/com/diffplug/spotless/rome/RomeStep.java) | :+1: | :+1: | :white_large_square: | :white_large_square: |
156+
| [`biome.BiomeStep`](lib/src/main/java/com/diffplug/spotless/biome/BiomeStep.java) | :+1: | :+1: | :white_large_square: | :white_large_square: |
157157
| [`scala.ScalaFmtStep`](lib/src/main/java/com/diffplug/spotless/scala/ScalaFmtStep.java) | :+1: | :+1: | :+1: | :white_large_square: |
158158
| [`sql.DBeaverSQLFormatterStep`](lib/src/main/java/com/diffplug/spotless/sql/DBeaverSQLFormatterStep.java) | :+1: | :+1: | :+1: | :white_large_square: |
159159
| [`wtp.EclipseWtpFormatterStep`](lib-extra/src/main/java/com/diffplug/spotless/extra/wtp/EclipseWtpFormatterStep.java) | :+1: | :+1: | :white_large_square: | :white_large_square: |

_ext/gradle/java-setup.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ tasks.withType(JavaCompile).configureEach {
1919
dependencies {
2020
testImplementation "org.junit.jupiter:junit-jupiter:${VER_JUNIT}"
2121
testImplementation "org.assertj:assertj-core:${VER_ASSERTJ}"
22-
testImplementation project(':testlib')
22+
testImplementation projects.testlib
2323
}
2424

2525
tasks.withType(Test).configureEach {

gradle.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ VER_SLF4J=[1.6,2.0[
2929

3030
# Used in multiple places
3131
VER_DURIAN=1.2.0
32-
VER_JGIT=6.6.0.202305301015-r
33-
VER_JUNIT=5.9.3
32+
VER_JGIT=6.7.0.202309050840-r
33+
VER_JUNIT=5.10.0
3434
VER_ASSERTJ=3.24.2
35-
VER_MOCKITO=5.3.1
35+
VER_MOCKITO=5.5.0

lib-extra/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ version = rootProject.spotlessChangelog.versionNext
77
apply from: rootProject.file('gradle/java-setup.gradle')
88
apply from: rootProject.file('gradle/java-publish.gradle')
99

10-
String VER_SOLSTICE = '1.3.1'
10+
String VER_SOLSTICE = '1.7.3'
1111
dependencies {
12-
api project(':lib')
12+
api projects.lib
1313
// misc useful utilities
1414
implementation "com.diffplug.durian:durian-core:${VER_DURIAN}"
1515
implementation "com.diffplug.durian:durian-collect:${VER_DURIAN}"
@@ -20,7 +20,7 @@ dependencies {
2020
implementation "dev.equo.ide:solstice:${VER_SOLSTICE}"
2121

2222
// testing
23-
testImplementation project(':testlib')
23+
testImplementation projects.testlib
2424
testImplementation "org.junit.jupiter:junit-jupiter:${VER_JUNIT}"
2525
testImplementation "org.assertj:assertj-core:${VER_ASSERTJ}"
2626
testImplementation "com.diffplug.durian:durian-testlib:${VER_DURIAN}"

lib-extra/src/main/java/com/diffplug/spotless/extra/groovy/GrEclipseFormatterStep.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public final class GrEclipseFormatterStep {
3232
private GrEclipseFormatterStep() {}
3333

3434
private static final String NAME = "eclipse groovy formatter";
35-
private static final Jvm.Support<String> JVM_SUPPORT = Jvm.<String> support(NAME).add(11, "4.26").add(17, "4.27");
35+
private static final Jvm.Support<String> JVM_SUPPORT = Jvm.<String> support(NAME).add(11, "4.26").add(17, "4.28");
3636

3737
public static String defaultVersion() {
3838
return JVM_SUPPORT.getRecommendedFormatterVersion();
@@ -50,7 +50,9 @@ protected P2Model model(String version) {
5050
throw new IllegalArgumentException("4.8 is the oldest version we support, this was " + version);
5151
}
5252
String greclipseVersion;
53-
if (eVersion >= 18) {
53+
if (eVersion >= 28) {
54+
greclipseVersion = "5." + (eVersion - 28) + ".0";
55+
} else if (eVersion >= 18) {
5456
greclipseVersion = "4." + (eVersion - 18) + ".0";
5557
} else {
5658
greclipseVersion = "3." + (eVersion - 8) + ".0";

lib/build.gradle

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ versionCompatibility {
4848
'0.48.0',
4949
'0.49.0',
5050
'0.50.0',
51+
'1.0.0',
5152
]
5253
targetSourceSetName = 'ktlint'
5354
}
@@ -104,10 +105,14 @@ dependencies {
104105
compatKtLint0Dot49Dot0CompileAndTestOnly 'com.pinterest.ktlint:ktlint-rule-engine:0.49.0'
105106
compatKtLint0Dot49Dot0CompileAndTestOnly 'com.pinterest.ktlint:ktlint-ruleset-standard:0.49.0'
106107
compatKtLint0Dot49Dot0CompileAndTestOnly 'org.slf4j:slf4j-api:2.0.0'
107-
// ktlint latest supported version
108+
// ktlint previous supported version
108109
compatKtLint0Dot50Dot0CompileAndTestOnly 'com.pinterest.ktlint:ktlint-rule-engine:0.50.0'
109110
compatKtLint0Dot50Dot0CompileAndTestOnly 'com.pinterest.ktlint:ktlint-ruleset-standard:0.50.0'
110111
compatKtLint0Dot50Dot0CompileAndTestOnly 'org.slf4j:slf4j-api:2.0.0'
112+
// ktlint latest supported version
113+
compatKtLint1Dot0Dot0CompileAndTestOnly 'com.pinterest.ktlint:ktlint-rule-engine:1.0.0'
114+
compatKtLint1Dot0Dot0CompileAndTestOnly 'com.pinterest.ktlint:ktlint-ruleset-standard:1.0.0'
115+
compatKtLint1Dot0Dot0CompileAndTestOnly 'org.slf4j:slf4j-api:2.0.0'
111116
// palantirJavaFormat
112117
palantirJavaFormatCompileOnly 'com.palantir.javaformat:palantir-java-format:1.1.0' // this version needs to stay compilable against Java 8 for CI Job testNpm
113118
// scalafmt
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
/*
2+
* Copyright 2023 DiffPlug
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.diffplug.spotless.glue.ktlint.compat;
17+
18+
import java.nio.file.Files;
19+
import java.nio.file.Path;
20+
import java.util.ArrayList;
21+
import java.util.Collections;
22+
import java.util.List;
23+
import java.util.Map;
24+
import java.util.Objects;
25+
import java.util.ServiceLoader;
26+
import java.util.Set;
27+
import java.util.stream.Collectors;
28+
import java.util.stream.Stream;
29+
30+
import org.slf4j.Logger;
31+
import org.slf4j.LoggerFactory;
32+
33+
import com.pinterest.ktlint.cli.ruleset.core.api.RuleSetProviderV3;
34+
import com.pinterest.ktlint.rule.engine.api.Code;
35+
import com.pinterest.ktlint.rule.engine.api.EditorConfigDefaults;
36+
import com.pinterest.ktlint.rule.engine.api.EditorConfigOverride;
37+
import com.pinterest.ktlint.rule.engine.api.KtLintRuleEngine;
38+
import com.pinterest.ktlint.rule.engine.api.LintError;
39+
import com.pinterest.ktlint.rule.engine.core.api.Rule;
40+
import com.pinterest.ktlint.rule.engine.core.api.RuleId;
41+
import com.pinterest.ktlint.rule.engine.core.api.RuleProvider;
42+
import com.pinterest.ktlint.rule.engine.core.api.RuleSetId;
43+
import com.pinterest.ktlint.rule.engine.core.api.editorconfig.CodeStyleEditorConfigPropertyKt;
44+
import com.pinterest.ktlint.rule.engine.core.api.editorconfig.EditorConfigProperty;
45+
import com.pinterest.ktlint.rule.engine.core.api.editorconfig.EndOfLinePropertyKt;
46+
import com.pinterest.ktlint.rule.engine.core.api.editorconfig.IndentSizeEditorConfigPropertyKt;
47+
import com.pinterest.ktlint.rule.engine.core.api.editorconfig.IndentStyleEditorConfigPropertyKt;
48+
import com.pinterest.ktlint.rule.engine.core.api.editorconfig.InsertFinalNewLineEditorConfigPropertyKt;
49+
import com.pinterest.ktlint.rule.engine.core.api.editorconfig.MaxLineLengthEditorConfigPropertyKt;
50+
import com.pinterest.ktlint.rule.engine.core.api.editorconfig.RuleExecution;
51+
import com.pinterest.ktlint.rule.engine.core.api.editorconfig.RuleExecutionEditorConfigPropertyKt;
52+
53+
import kotlin.Pair;
54+
import kotlin.Unit;
55+
import kotlin.jvm.functions.Function2;
56+
57+
public class KtLintCompat1Dot0Dot0Adapter implements KtLintCompatAdapter {
58+
59+
private static final Logger logger = LoggerFactory.getLogger(KtLintCompat1Dot0Dot0Adapter.class);
60+
61+
private static final List<EditorConfigProperty<?>> DEFAULT_EDITOR_CONFIG_PROPERTIES;
62+
63+
static {
64+
List<EditorConfigProperty<?>> list = new ArrayList<>();
65+
list.add(CodeStyleEditorConfigPropertyKt.getCODE_STYLE_PROPERTY());
66+
list.add(EndOfLinePropertyKt.getEND_OF_LINE_PROPERTY());
67+
list.add(IndentSizeEditorConfigPropertyKt.getINDENT_SIZE_PROPERTY());
68+
list.add(IndentStyleEditorConfigPropertyKt.getINDENT_STYLE_PROPERTY());
69+
list.add(InsertFinalNewLineEditorConfigPropertyKt.getINSERT_FINAL_NEWLINE_PROPERTY());
70+
list.add(MaxLineLengthEditorConfigPropertyKt.getMAX_LINE_LENGTH_PROPERTY());
71+
list.add(RuleExecutionEditorConfigPropertyKt.getEXPERIMENTAL_RULES_EXECUTION_PROPERTY());
72+
DEFAULT_EDITOR_CONFIG_PROPERTIES = Collections.unmodifiableList(list);
73+
}
74+
75+
static class FormatterCallback implements Function2<LintError, Boolean, Unit> {
76+
77+
@Override
78+
public Unit invoke(LintError lint, Boolean corrected) {
79+
if (!corrected) {
80+
KtLintCompatReporting.report(lint.getLine(), lint.getCol(), lint.getRuleId().getValue(), lint.getDetail());
81+
}
82+
return Unit.INSTANCE;
83+
}
84+
}
85+
86+
@Override
87+
public String format(final String text, Path path, final boolean isScript,
88+
Path editorConfigPath, final Map<String, String> userData,
89+
final Map<String, Object> editorConfigOverrideMap) {
90+
final FormatterCallback formatterCallback = new FormatterCallback();
91+
92+
Set<RuleProvider> allRuleProviders = ServiceLoader.load(RuleSetProviderV3.class, RuleSetProviderV3.class.getClassLoader())
93+
.stream()
94+
.flatMap(loader -> loader.get().getRuleProviders().stream())
95+
.collect(Collectors.toUnmodifiableSet());
96+
97+
EditorConfigOverride editorConfigOverride;
98+
if (editorConfigOverrideMap.isEmpty()) {
99+
editorConfigOverride = EditorConfigOverride.Companion.getEMPTY_EDITOR_CONFIG_OVERRIDE();
100+
} else {
101+
editorConfigOverride = createEditorConfigOverride(allRuleProviders.stream().map(
102+
RuleProvider::createNewRuleInstance).collect(Collectors.toList()),
103+
editorConfigOverrideMap);
104+
}
105+
EditorConfigDefaults editorConfig;
106+
if (editorConfigPath == null || !Files.exists(editorConfigPath)) {
107+
editorConfig = EditorConfigDefaults.Companion.getEMPTY_EDITOR_CONFIG_DEFAULTS();
108+
} else {
109+
editorConfig = EditorConfigDefaults.Companion.load(editorConfigPath, Collections.emptySet());
110+
}
111+
112+
return new KtLintRuleEngine(
113+
allRuleProviders,
114+
editorConfig,
115+
editorConfigOverride,
116+
false,
117+
path.getFileSystem())
118+
.format(Code.Companion.fromPath(path), formatterCallback);
119+
}
120+
121+
/**
122+
* Create EditorConfigOverride from user provided parameters.
123+
*/
124+
private static EditorConfigOverride createEditorConfigOverride(final List<Rule> rules, Map<String, Object> editorConfigOverrideMap) {
125+
// Get properties from rules in the rule sets
126+
Stream<EditorConfigProperty<?>> ruleProperties = rules.stream()
127+
.flatMap(rule -> rule.getUsesEditorConfigProperties().stream());
128+
129+
// Create a mapping of properties to their names based on rule properties and default properties
130+
Map<String, EditorConfigProperty<?>> supportedProperties = Stream
131+
.concat(ruleProperties, DEFAULT_EDITOR_CONFIG_PROPERTIES.stream())
132+
.distinct()
133+
.collect(Collectors.toMap(EditorConfigProperty::getName, property -> property));
134+
135+
// The default style had been changed from intellij_idea to ktlint_official in version 1.0.0
136+
if (!editorConfigOverrideMap.containsKey("ktlint_code_style")) {
137+
editorConfigOverrideMap.put("ktlint_code_style", "intellij_idea");
138+
}
139+
140+
// Create config properties based on provided property names and values
141+
@SuppressWarnings("unchecked")
142+
Pair<EditorConfigProperty<?>, ?>[] properties = editorConfigOverrideMap.entrySet().stream()
143+
.map(entry -> {
144+
EditorConfigProperty<?> property = supportedProperties.get(entry.getKey());
145+
146+
if (property == null && entry.getKey().startsWith("ktlint_")) {
147+
String[] parts = entry.getKey().substring(7).split("_", 2);
148+
if (parts.length == 1) {
149+
// convert ktlint_{ruleset} to RuleSetId
150+
RuleSetId id = new RuleSetId(parts[0]);
151+
property = RuleExecutionEditorConfigPropertyKt.createRuleSetExecutionEditorConfigProperty(id, RuleExecution.enabled);
152+
} else {
153+
// convert ktlint_{ruleset}_{rulename} to RuleId
154+
RuleId id = new RuleId(parts[0] + ":" + parts[1]);
155+
property = RuleExecutionEditorConfigPropertyKt.createRuleExecutionEditorConfigProperty(id, RuleExecution.enabled);
156+
}
157+
}
158+
159+
if (property == null) {
160+
return null;
161+
} else {
162+
return new Pair<>(property, entry.getValue());
163+
}
164+
})
165+
.filter(Objects::nonNull)
166+
.toArray(Pair[]::new);
167+
168+
return EditorConfigOverride.Companion.from(properties);
169+
}
170+
}

lib/src/googleJavaFormat/java/com/diffplug/spotless/glue/java/GoogleJavaFormatFormatterFunc.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,17 @@ public class GoogleJavaFormatFormatterFunc implements FormatterFunc {
4646

4747
private final boolean reorderImports;
4848

49-
public GoogleJavaFormatFormatterFunc(@Nonnull String version, @Nonnull String style, boolean reflowStrings, boolean reorderImports) {
49+
public GoogleJavaFormatFormatterFunc(@Nonnull String version, @Nonnull String style, boolean reflowStrings, boolean reorderImports, boolean formatJavadoc) {
5050
this.version = Objects.requireNonNull(version);
5151
this.formatterStyle = Style.valueOf(Objects.requireNonNull(style));
5252
this.reflowStrings = reflowStrings;
5353
this.reorderImports = reorderImports;
5454

55-
this.formatter = new Formatter(JavaFormatterOptions.builder()
56-
.style(formatterStyle)
57-
.build());
55+
JavaFormatterOptions.Builder builder = JavaFormatterOptions.builder().style(formatterStyle);
56+
if (!formatJavadoc) {
57+
builder = builder.formatJavadoc(false);
58+
}
59+
this.formatter = new Formatter(builder.build());
5860
}
5961

6062
@Override

0 commit comments

Comments
 (0)