From 786df17f0d75e834d55d6f9a69794a4f73f1f7b7 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Tue, 21 Feb 2023 21:41:48 -0800 Subject: [PATCH] Revert "insert space" setting for type parameters Change `insert_space_after_closing_angle_bracket_in_type_parameters` back to `insert` to ensure generics are always formatted correctly. This commit reverts commit b11499d4 as which we no longer need thanks to https://github.com/eclipse-jdt/eclipse.jdt.core/issues/443 Fixes gh-363 --- .../src/test/resources/expected/generics2.txt | 8 ++++++++ .../src/test/resources/source/generics2.txt | 8 ++++++++ .../io/spring/javaformat/formatter/eclipse/Options.java | 4 ---- .../spring/javaformat/formatter/eclipse/formatter.prefs | 2 +- 4 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/expected/generics2.txt create mode 100644 spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/source/generics2.txt diff --git a/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/expected/generics2.txt b/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/expected/generics2.txt new file mode 100644 index 00000000..da493d53 --- /dev/null +++ b/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/expected/generics2.txt @@ -0,0 +1,8 @@ +package simple; + +/** + * gh-363. + */ +public class UnresolvedGenericProperties extends AbstractGenericProperties { + +} diff --git a/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/source/generics2.txt b/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/source/generics2.txt new file mode 100644 index 00000000..da493d53 --- /dev/null +++ b/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/source/generics2.txt @@ -0,0 +1,8 @@ +package simple; + +/** + * gh-363. + */ +public class UnresolvedGenericProperties extends AbstractGenericProperties { + +} diff --git a/spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/eclipse/Options.java b/spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/eclipse/Options.java index 7006feb9..37f4faa9 100644 --- a/spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/eclipse/Options.java +++ b/spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/eclipse/Options.java @@ -24,7 +24,6 @@ import java.util.Properties; import io.spring.javaformat.config.IndentationStyle; -import io.spring.javaformat.config.JavaBaseline; import io.spring.javaformat.config.JavaFormatConfig; /** @@ -68,9 +67,6 @@ private void applyConfig(Map properties, JavaFormatConfig javaFo if (javaFormatConfig.getIndentationStyle() == IndentationStyle.SPACES) { properties.put(coreFormatter + "tabulation.char", "space"); } - if (javaFormatConfig.getJavaBaseline() == JavaBaseline.V8) { - properties.put(coreFormatter + "insert_space_after_closing_angle_bracket_in_type_parameters", "insert"); - } } } diff --git a/spring-javaformat/spring-javaformat-formatter/src/main/resources/io/spring/javaformat/formatter/eclipse/formatter.prefs b/spring-javaformat/spring-javaformat-formatter/src/main/resources/io/spring/javaformat/formatter/eclipse/formatter.prefs index 174274a0..46940cbe 100644 --- a/spring-javaformat/spring-javaformat-formatter/src/main/resources/io/spring/javaformat/formatter/eclipse/formatter.prefs +++ b/spring-javaformat/spring-javaformat-formatter/src/main/resources/io/spring/javaformat/formatter/eclipse/formatter.prefs @@ -134,7 +134,7 @@ core.formatter.insert_space_after_at_in_annotation_type_declaration=do not inser core.formatter.insert_space_after_binary_operator=insert core.formatter.insert_space_after_bitwise_operator=insert core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert -core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=do not insert +core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert core.formatter.insert_space_after_closing_brace_in_block=insert core.formatter.insert_space_after_closing_paren_in_cast=insert core.formatter.insert_space_after_colon_in_assert=insert