Skip to content

Commit 9e18a06

Browse files
committed
Use mapMulti instead of flatMap(Optional::stream) in a plugin test
error-prone's StreamFlatMapOptional warned about .flatMap(Optional::stream) in the IntelliJ plugin's settings page test, where findCheckBox walks the component tree for the first check box. It now uses the replacement error-prone suggests, .<JCheckBox>mapMulti(Optional::ifPresent), which builds no stream per element; findFirst still stops at the first check box. The three tests that call findCheckBox pass, as do the plugin's other tests.
1 parent 75a1dbb commit 9e18a06

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎open-java-format-idea-plugin/src/test/java/com/palantir/javaformat/intellij/PalantirJavaFormatConfigurableTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ private static Optional<JCheckBox> findCheckBox(Component root) {
108108
if (root instanceof Container container) {
109109
return Arrays.stream(container.getComponents())
110110
.map(PalantirJavaFormatConfigurableTest::findCheckBox)
111-
.flatMap(Optional::stream)
111+
.<JCheckBox>mapMulti(Optional::ifPresent)
112112
.findFirst();
113113
}
114114
return Optional.empty();

0 commit comments

Comments
 (0)