Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMateusz Matela2020-01-20 20:13:30 +0000
committerMateusz Matela2020-02-13 20:06:28 +0000
commit686572a074e4fa9ab6cc524da56d021ba7065b22 (patch)
treed2d5d8925b6997042f6e263c1de6f1f59eefce59
parent837fc6117452521c22faca53a84b66d3747ac101 (diff)
downloadeclipse.jdt.core-686572a074e4fa9ab6cc524da56d021ba7065b22.tar.gz
eclipse.jdt.core-686572a074e4fa9ab6cc524da56d021ba7065b22.tar.xz
eclipse.jdt.core-686572a074e4fa9ab6cc524da56d021ba7065b22.zip
Bug 553155 - [14] Records - Formatter Support
Change-Id: I373cd79244dbd81fe6771e07b9f3a117a8735902 Signed-off-by: Mateusz Matela <mateusz.matela@gmail.com>
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java134
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/A_out.java8
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/B_out.java8
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/C_out.java9
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/D_out.java9
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/E_out.java10
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/F_out.java8
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/G_out.java8
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/H_out.java8
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/I_out.java8
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/J_out.java8
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/K_out.java8
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/L_out.java8
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/M_out.java12
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/N_out.java12
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/in.java8
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/RecordDeclaration.java2
-rw-r--r--org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java207
-rw-r--r--org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatter.java4
-rw-r--r--org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java106
-rw-r--r--org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/LineBreaksPreparator.java14
-rw-r--r--org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/OneLineEnforcer.java12
-rw-r--r--org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/SpacePreparator.java122
-rw-r--r--org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/linewrap/WrapPreparator.java37
24 files changed, 717 insertions, 53 deletions
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java
index a63c61b5c4..0469de3902 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java
@@ -15502,4 +15502,138 @@ public void testBug547261() throws JavaModelException {
" boolean b = ! a && ! (c || d) && (f != -5);\n" +
"}");
}
+/**
+ * https://bugs.eclipse.org/553155 - [14] Records - Formatter Support
+ */
+public void testBug553155a() throws JavaModelException {
+ setComplianceLevel(CompilerOptions.VERSION_14);
+ formatSourceInWorkspace("test553155", "in.java", "A_out.java");
+}
+/**
+ * https://bugs.eclipse.org/553155 - [14] Records - Formatter Support
+ */
+public void testBug553155b() throws JavaModelException {
+ setComplianceLevel(CompilerOptions.VERSION_14);
+ this.formatterPrefs.indent_body_declarations_compare_to_record_header = false;
+ formatSourceInWorkspace("test553155", "in.java", "B_out.java");
+}
+/**
+ * https://bugs.eclipse.org/553155 - [14] Records - Formatter Support
+ */
+public void testBug553155c() throws JavaModelException {
+ setComplianceLevel(CompilerOptions.VERSION_14);
+ this.formatterPrefs.brace_position_for_record_declaration = DefaultCodeFormatterConstants.NEXT_LINE;
+ formatSourceInWorkspace("test553155", "in.java", "C_out.java");
+}
+/**
+ * https://bugs.eclipse.org/553155 - [14] Records - Formatter Support
+ */
+public void testBug553155d() throws JavaModelException {
+ setComplianceLevel(CompilerOptions.VERSION_14);
+ this.formatterPrefs.brace_position_for_record_constructor = DefaultCodeFormatterConstants.NEXT_LINE;
+ formatSourceInWorkspace("test553155", "in.java", "D_out.java");
+}
+/**
+ * https://bugs.eclipse.org/553155 - [14] Records - Formatter Support
+ */
+public void testBug553155e() throws JavaModelException {
+ setComplianceLevel(CompilerOptions.VERSION_14);
+ this.formatterPrefs.parenthesis_positions_in_record_declaration = DefaultCodeFormatterConstants.SEPARATE_LINES;
+ formatSourceInWorkspace("test553155", "in.java", "E_out.java");
+}
+/**
+ * https://bugs.eclipse.org/553155 - [14] Records - Formatter Support
+ */
+public void testBug553155f() throws JavaModelException {
+ setComplianceLevel(CompilerOptions.VERSION_14);
+ this.formatterPrefs.insert_space_after_comma_in_record_components = false;
+ formatSourceInWorkspace("test553155", "in.java", "F_out.java");
+}
+/**
+ * https://bugs.eclipse.org/553155 - [14] Records - Formatter Support
+ */
+public void testBug553155g() throws JavaModelException {
+ setComplianceLevel(CompilerOptions.VERSION_14);
+ this.formatterPrefs.insert_space_after_opening_paren_in_record_declaration = true;
+ formatSourceInWorkspace("test553155", "in.java", "G_out.java");
+}
+/**
+ * https://bugs.eclipse.org/553155 - [14] Records - Formatter Support
+ */
+public void testBug553155h() throws JavaModelException {
+ setComplianceLevel(CompilerOptions.VERSION_14);
+ this.formatterPrefs.insert_space_before_closing_paren_in_record_declaration = true;
+ formatSourceInWorkspace("test553155", "in.java", "H_out.java");
+}
+/**
+ * https://bugs.eclipse.org/553155 - [14] Records - Formatter Support
+ */
+public void testBug553155i() throws JavaModelException {
+ setComplianceLevel(CompilerOptions.VERSION_14);
+ this.formatterPrefs.insert_space_before_comma_in_record_components = true;
+ formatSourceInWorkspace("test553155", "in.java", "I_out.java");
+}
+/**
+ * https://bugs.eclipse.org/553155 - [14] Records - Formatter Support
+ */
+public void testBug553155j() throws JavaModelException {
+ setComplianceLevel(CompilerOptions.VERSION_14);
+ this.formatterPrefs.insert_space_before_opening_brace_in_record_constructor = false;
+ formatSourceInWorkspace("test553155", "in.java", "J_out.java");
+}
+/**
+ * https://bugs.eclipse.org/553155 - [14] Records - Formatter Support
+ */
+public void testBug553155k() throws JavaModelException {
+ setComplianceLevel(CompilerOptions.VERSION_14);
+ this.formatterPrefs.insert_space_before_opening_brace_in_record_declaration = false;
+ formatSourceInWorkspace("test553155", "in.java", "K_out.java");
+}
+/**
+ * https://bugs.eclipse.org/553155 - [14] Records - Formatter Support
+ */
+public void testBug553155l() throws JavaModelException {
+ setComplianceLevel(CompilerOptions.VERSION_14);
+ this.formatterPrefs.insert_space_before_opening_paren_in_record_declaration = true;
+ formatSourceInWorkspace("test553155", "in.java", "L_out.java");
+}
+/**
+ * https://bugs.eclipse.org/553155 - [14] Records - Formatter Support
+ */
+public void testBug553155m() throws JavaModelException {
+ setComplianceLevel(CompilerOptions.VERSION_14);
+ this.formatterPrefs.alignment_for_record_components = Alignment.M_ONE_PER_LINE_SPLIT + + Alignment.M_FORCE;
+ formatSourceInWorkspace("test553155", "in.java", "M_out.java");
+}
+/**
+ * https://bugs.eclipse.org/553155 - [14] Records - Formatter Support
+ */
+public void testBug553155n() throws JavaModelException {
+ setComplianceLevel(CompilerOptions.VERSION_14);
+ this.formatterPrefs.alignment_for_superinterfaces_in_record_declaration = Alignment.M_ONE_PER_LINE_SPLIT + + Alignment.M_FORCE;
+ formatSourceInWorkspace("test553155", "in.java", "N_out.java");
+}
+/**
+ * https://bugs.eclipse.org/553155 - [14] Records - Formatter Support
+ */
+public void testBug553155o() throws JavaModelException {
+ setComplianceLevel(CompilerOptions.VERSION_14);
+ this.formatterPrefs.keep_record_constructor_on_one_line = DefaultCodeFormatterConstants.ONE_LINE_ALWAYS;
+ String source = "record Range(int lo, int hi) {public Range {foo();}}";
+ formatSource(source,
+ "record Range(int lo, int hi) {\n" +
+ " public Range { foo(); }\n" +
+ "}");
+}
+/**
+ * https://bugs.eclipse.org/553155 - [14] Records - Formatter Support
+ */
+public void testBug553155p() throws JavaModelException {
+ setComplianceLevel(CompilerOptions.VERSION_14);
+ this.formatterPrefs.keep_record_constructor_on_one_line = DefaultCodeFormatterConstants.ONE_LINE_ALWAYS;
+ this.formatterPrefs.keep_record_declaration_on_one_line = DefaultCodeFormatterConstants.ONE_LINE_ALWAYS;
+ String source = "record Range(int lo, int hi) {public Range {foo();}}";
+ formatSource(source,
+ "record Range(int lo, int hi) { public Range { foo(); } }");
+}
}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/A_out.java
new file mode 100644
index 0000000000..e6ff0b1fdc
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/A_out.java
@@ -0,0 +1,8 @@
+record Range(int lo, int hi, Strign aasofdi, String aoifjasoifdj) implements Interface1, Interface2, Interfacee3 {
+ public Range {
+ this.lo = lo;
+ this.hi = hi;
+ if (lo > hi)
+ throw new IllegalArgumentException(String.format("(%d,%d)", lo, hi));
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/B_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/B_out.java
new file mode 100644
index 0000000000..4d35b8e0b9
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/B_out.java
@@ -0,0 +1,8 @@
+record Range(int lo, int hi, Strign aasofdi, String aoifjasoifdj) implements Interface1, Interface2, Interfacee3 {
+public Range {
+ this.lo = lo;
+ this.hi = hi;
+ if (lo > hi)
+ throw new IllegalArgumentException(String.format("(%d,%d)", lo, hi));
+}
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/C_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/C_out.java
new file mode 100644
index 0000000000..299bb4a12b
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/C_out.java
@@ -0,0 +1,9 @@
+record Range(int lo, int hi, Strign aasofdi, String aoifjasoifdj) implements Interface1, Interface2, Interfacee3
+{
+ public Range {
+ this.lo = lo;
+ this.hi = hi;
+ if (lo > hi)
+ throw new IllegalArgumentException(String.format("(%d,%d)", lo, hi));
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/D_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/D_out.java
new file mode 100644
index 0000000000..60c0dbf9bd
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/D_out.java
@@ -0,0 +1,9 @@
+record Range(int lo, int hi, Strign aasofdi, String aoifjasoifdj) implements Interface1, Interface2, Interfacee3 {
+ public Range
+ {
+ this.lo = lo;
+ this.hi = hi;
+ if (lo > hi)
+ throw new IllegalArgumentException(String.format("(%d,%d)", lo, hi));
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/E_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/E_out.java
new file mode 100644
index 0000000000..161e77820a
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/E_out.java
@@ -0,0 +1,10 @@
+record Range(
+ int lo, int hi, Strign aasofdi, String aoifjasoifdj
+) implements Interface1, Interface2, Interfacee3 {
+ public Range {
+ this.lo = lo;
+ this.hi = hi;
+ if (lo > hi)
+ throw new IllegalArgumentException(String.format("(%d,%d)", lo, hi));
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/F_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/F_out.java
new file mode 100644
index 0000000000..782b88a88a
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/F_out.java
@@ -0,0 +1,8 @@
+record Range(int lo,int hi,Strign aasofdi,String aoifjasoifdj) implements Interface1, Interface2, Interfacee3 {
+ public Range {
+ this.lo = lo;
+ this.hi = hi;
+ if (lo > hi)
+ throw new IllegalArgumentException(String.format("(%d,%d)", lo, hi));
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/G_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/G_out.java
new file mode 100644
index 0000000000..5c6dd82db3
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/G_out.java
@@ -0,0 +1,8 @@
+record Range( int lo, int hi, Strign aasofdi, String aoifjasoifdj) implements Interface1, Interface2, Interfacee3 {
+ public Range {
+ this.lo = lo;
+ this.hi = hi;
+ if (lo > hi)
+ throw new IllegalArgumentException(String.format("(%d,%d)", lo, hi));
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/H_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/H_out.java
new file mode 100644
index 0000000000..99154db63f
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/H_out.java
@@ -0,0 +1,8 @@
+record Range(int lo, int hi, Strign aasofdi, String aoifjasoifdj ) implements Interface1, Interface2, Interfacee3 {
+ public Range {
+ this.lo = lo;
+ this.hi = hi;
+ if (lo > hi)
+ throw new IllegalArgumentException(String.format("(%d,%d)", lo, hi));
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/I_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/I_out.java
new file mode 100644
index 0000000000..bafd9b949f
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/I_out.java
@@ -0,0 +1,8 @@
+record Range(int lo , int hi , Strign aasofdi , String aoifjasoifdj) implements Interface1, Interface2, Interfacee3 {
+ public Range {
+ this.lo = lo;
+ this.hi = hi;
+ if (lo > hi)
+ throw new IllegalArgumentException(String.format("(%d,%d)", lo, hi));
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/J_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/J_out.java
new file mode 100644
index 0000000000..536d5a822f
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/J_out.java
@@ -0,0 +1,8 @@
+record Range(int lo, int hi, Strign aasofdi, String aoifjasoifdj) implements Interface1, Interface2, Interfacee3 {
+ public Range{
+ this.lo = lo;
+ this.hi = hi;
+ if (lo > hi)
+ throw new IllegalArgumentException(String.format("(%d,%d)", lo, hi));
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/K_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/K_out.java
new file mode 100644
index 0000000000..ab1082ec59
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/K_out.java
@@ -0,0 +1,8 @@
+record Range(int lo, int hi, Strign aasofdi, String aoifjasoifdj) implements Interface1, Interface2, Interfacee3{
+ public Range {
+ this.lo = lo;
+ this.hi = hi;
+ if (lo > hi)
+ throw new IllegalArgumentException(String.format("(%d,%d)", lo, hi));
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/L_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/L_out.java
new file mode 100644
index 0000000000..1cf51e6d83
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/L_out.java
@@ -0,0 +1,8 @@
+record Range (int lo, int hi, Strign aasofdi, String aoifjasoifdj) implements Interface1, Interface2, Interfacee3 {
+ public Range {
+ this.lo = lo;
+ this.hi = hi;
+ if (lo > hi)
+ throw new IllegalArgumentException(String.format("(%d,%d)", lo, hi));
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/M_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/M_out.java
new file mode 100644
index 0000000000..cc402ee51e
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/M_out.java
@@ -0,0 +1,12 @@
+record Range(
+ int lo,
+ int hi,
+ Strign aasofdi,
+ String aoifjasoifdj) implements Interface1, Interface2, Interfacee3 {
+ public Range {
+ this.lo = lo;
+ this.hi = hi;
+ if (lo > hi)
+ throw new IllegalArgumentException(String.format("(%d,%d)", lo, hi));
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/N_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/N_out.java
new file mode 100644
index 0000000000..830ffbefab
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/N_out.java
@@ -0,0 +1,12 @@
+record Range(int lo, int hi, Strign aasofdi, String aoifjasoifdj)
+ implements
+ Interface1,
+ Interface2,
+ Interfacee3 {
+ public Range {
+ this.lo = lo;
+ this.hi = hi;
+ if (lo > hi)
+ throw new IllegalArgumentException(String.format("(%d,%d)", lo, hi));
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/in.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/in.java
new file mode 100644
index 0000000000..dca30ab046
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553155/in.java
@@ -0,0 +1,8 @@
+record Range(int lo, int hi, Strign
+aasofdi, String aoifjasoifdj) implements Interface1, Interface2, Interfacee3 {
+ public Range {
+ this.lo = lo;
+ this.hi = hi;
+ if (lo > hi) throw new IllegalArgumentException( String.format("(%d,%d)", lo, hi));
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/RecordDeclaration.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/RecordDeclaration.java
index d1cfa65cf4..13da1b33be 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/RecordDeclaration.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/RecordDeclaration.java
@@ -142,8 +142,8 @@ public class RecordDeclaration extends AbstractTypeDeclaration {
addProperty(MODIFIERS2_PROPERTY, propertyList);
addProperty(NAME_PROPERTY, propertyList);
addProperty(TYPE_PARAMETERS_PROPERTY, propertyList);
- addProperty(SUPER_INTERFACE_TYPES_PROPERTY, propertyList);
addProperty(RECORD_COMPONENTS_PROPERTY, propertyList);
+ addProperty(SUPER_INTERFACE_TYPES_PROPERTY, propertyList);
addProperty(BODY_DECLARATIONS_PROPERTY, propertyList);
PROPERTY_DESCRIPTORS = reapPropertyList(propertyList);
diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java
index 37a4772f4c..533b4c9f16 100644
--- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java
+++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java
@@ -43,6 +43,8 @@ public class DefaultCodeFormatterConstants {
* @see #FORMATTER_BRACE_POSITION_FOR_BLOCK
* @see #FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION
* @see #FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION
+ * @see #FORMATTER_BRACE_POSITION_FOR_RECORD_CONSTRUCTOR
+ * @see #FORMATTER_BRACE_POSITION_FOR_RECORD_DECLARATION
* @see #FORMATTER_BRACE_POSITION_FOR_SWITCH
* @see #FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION
* @see #FORMATTER_BRACE_POSITION_FOR_LAMBDA_BODY
@@ -443,6 +445,17 @@ public class DefaultCodeFormatterConstants {
public static final String FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION = JavaCore.PLUGIN_ID + ".formatter.alignment_for_parameters_in_method_declaration"; //$NON-NLS-1$
/**
* <pre>
+ * FORMATTER / Option for alignment of components in record declaration
+ * - option id: "org.eclipse.jdt.core.formatter.alignment_for_record_components"
+ * - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call
+ * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
+ * </pre>
+ * @see #createAlignmentValue(boolean, int, int)
+ * @since 3.21
+ */
+ public static final String FORMATTER_ALIGNMENT_FOR_RECORD_COMPONENTS = JavaCore.PLUGIN_ID + ".formatter.alignment_for_record_components"; //$NON-NLS-1$
+ /**
+ * <pre>
* FORMATTER / Option for alignment of resources in a try with resources statement
* - option id: "org.eclipse.jdt.core.formatter.alignment_for_resources_in_try"
* - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call
@@ -487,6 +500,17 @@ public class DefaultCodeFormatterConstants {
public static final String FORMATTER_ALIGNMENT_FOR_SUPERINTERFACES_IN_ENUM_DECLARATION = JavaCore.PLUGIN_ID + ".formatter.alignment_for_superinterfaces_in_enum_declaration"; //$NON-NLS-1$
/**
* <pre>
+ * FORMATTER / Option for alignment of superinterfaces in record declaration
+ * - option id: "org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_record_declaration"
+ * - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call
+ * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
+ * </pre>
+ * @see #createAlignmentValue(boolean, int, int)
+ * @since 3.21
+ */
+ public static final String FORMATTER_ALIGNMENT_FOR_SUPERINTERFACES_IN_RECORD_DECLARATION = JavaCore.PLUGIN_ID + ".formatter.alignment_for_superinterfaces_in_record_declaration"; //$NON-NLS-1$
+ /**
+ * <pre>
* FORMATTER / Option for alignment of superinterfaces in type declaration
* - option id: "org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration"
* - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call
@@ -924,6 +948,34 @@ public class DefaultCodeFormatterConstants {
public static final String FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION = JavaCore.PLUGIN_ID + ".formatter.brace_position_for_method_declaration"; //$NON-NLS-1$
/**
* <pre>
+ * FORMATTER / Option to position the braces of a record constructor
+ * - option id: "org.eclipse.jdt.core.formatter.brace_position_for_record_constructor"
+ * - possible values: { END_OF_LINE, NEXT_LINE, NEXT_LINE_SHIFTED, NEXT_LINE_ON_WRAP }
+ * - default: END_OF_LINE
+ * </pre>
+ * @see #END_OF_LINE
+ * @see #NEXT_LINE
+ * @see #NEXT_LINE_SHIFTED
+ * @see #NEXT_LINE_ON_WRAP
+ * @since 3.21
+ */
+ public static final String FORMATTER_BRACE_POSITION_FOR_RECORD_CONSTRUCTOR = JavaCore.PLUGIN_ID + ".formatter.brace_position_for_record_constructor"; //$NON-NLS-1$
+ /**
+ * <pre>
+ * FORMATTER / Option to position the braces of a record declaration
+ * - option id: "org.eclipse.jdt.core.formatter.brace_position_for_record_declaration"
+ * - possible values: { END_OF_LINE, NEXT_LINE, NEXT_LINE_SHIFTED, NEXT_LINE_ON_WRAP }
+ * - default: END_OF_LINE
+ * </pre>
+ * @see #END_OF_LINE
+ * @see #NEXT_LINE
+ * @see #NEXT_LINE_SHIFTED
+ * @see #NEXT_LINE_ON_WRAP
+ * @since 3.21
+ */
+ public static final String FORMATTER_BRACE_POSITION_FOR_RECORD_DECLARATION = JavaCore.PLUGIN_ID + ".formatter.brace_position_for_record_declaration"; //$NON-NLS-1$
+ /**
+ * <pre>
* FORMATTER / Option to position the braces of a switch statement
* - option id: "org.eclipse.jdt.core.formatter.brace_position_for_switch"
* - possible values: { END_OF_LINE, NEXT_LINE, NEXT_LINE_SHIFTED, NEXT_LINE_ON_WRAP }
@@ -1013,6 +1065,22 @@ public class DefaultCodeFormatterConstants {
* @since 3.12
*/
public static final String FORMATTER_PARENTHESES_POSITIONS_IN_ENUM_CONSTANT_DECLARATION = JavaCore.PLUGIN_ID + ".formatter.parentheses_positions_in_enum_constant_declaration"; //$NON-NLS-1$
+
+ /**
+ * <pre>
+ * FORMATTER / Option to position parentheses in record declarations
+ * - option id: "org.eclipse.jdt.core.formatter.parentheses_positions_in_record_declaration"
+ * - possible values: { COMMON_LINES, SEPARATE_LINES_IF_NOT_EMPTY, SEPARATE_LINES_IF_WRAPPED, SEPARATE_LINES, PRESERVE_POSITIONS }
+ * - default: COMMON_LINES
+ * </pre>
+ * @see #COMMON_LINES
+ * @see #SEPARATE_LINES_IF_NOT_EMPTY
+ * @see #SEPARATE_LINES_IF_WRAPPED
+ * @see #SEPARATE_LINES
+ * @see #PRESERVE_POSITIONS
+ * @since 3.21
+ */
+ public static final String FORMATTER_PARENTHESES_POSITIONS_IN_RECORD_DECLARATION = JavaCore.PLUGIN_ID + ".formatter.parentheses_positions_in_record_declaration"; //$NON-NLS-1$
/**
* <pre>
@@ -1806,6 +1874,18 @@ public class DefaultCodeFormatterConstants {
public static final String FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ENUM_DECLARATION_HEADER = JavaCore.PLUGIN_ID + ".formatter.indent_body_declarations_compare_to_enum_declaration_header"; //$NON-NLS-1$
/**
* <pre>
+ * FORMATTER / Option to indent body declarations compare to its enclosing record header
+ * - option id: "org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_record_header"
+ * - possible values: { TRUE, FALSE }
+ * - default: TRUE
+ * </pre>
+ * @see #TRUE
+ * @see #FALSE
+ * @since 3.21
+ */
+ public static final String FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_RECORD_HEADER = JavaCore.PLUGIN_ID + ".formatter.indent_body_declarations_compare_to_record_header"; //$NON-NLS-1$
+ /**
+ * <pre>
* FORMATTER / Option to indent body declarations compare to its enclosing type header
* - option id: "org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header"
* - possible values: { TRUE, FALSE }
@@ -2734,6 +2814,18 @@ public class DefaultCodeFormatterConstants {
public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_PARAMETERIZED_TYPE_REFERENCE = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_comma_in_parameterized_type_reference"; //$NON-NLS-1$
/**
* <pre>
+ * FORMATTER / Option to insert a space after comma in record components list
+ * - option id: "org.eclipse.jdt.core.formatter.insert_space_after_comma_in_record_components"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
+ * </pre>
+ * @see JavaCore#INSERT
+ * @see JavaCore#DO_NOT_INSERT
+ * @since 3.21
+ */
+ public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_RECORD_COMPONENTS = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_comma_in_record_components"; //$NON-NLS-1$
+ /**
+ * <pre>
* FORMATTER / Option to insert a space after the comma in superinterfaces names of a type header
* - option id: "org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces"
* - possible values: { INSERT, DO_NOT_INSERT }
@@ -2998,6 +3090,18 @@ public class DefaultCodeFormatterConstants {
public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_PARENTHESIZED_EXPRESSION = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_parenthesized_expression"; //$NON-NLS-1$
/**
* <pre>
+ * FORMATTER / Option to insert a space after the opening parenthesis in a record declaration
+ * - option id: "org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_record_declaration"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
+ * </pre>
+ * @see JavaCore#INSERT
+ * @see JavaCore#DO_NOT_INSERT
+ * @since 3.21
+ */
+ public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_RECORD_DECLARATION = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_record_declaration"; //$NON-NLS-1$
+ /**
+ * <pre>
* FORMATTER / Option to insert a space after the opening parenthesis in a switch statement
* - option id: "org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch"
* - possible values: { INSERT, DO_NOT_INSERT }
@@ -3495,6 +3599,18 @@ public class DefaultCodeFormatterConstants {
public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_PARENTHESIZED_EXPRESSION = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_parenthesized_expression"; //$NON-NLS-1$
/**
* <pre>
+ * FORMATTER / Option to insert a space before the closing parenthesis in a record declaration
+ * - option id: "org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_record_declaration"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
+ * </pre>
+ * @see JavaCore#INSERT
+ * @see JavaCore#DO_NOT_INSERT
+ * @since 3.21
+ */
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_RECORD_DECLARATION = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_record_declaration"; //$NON-NLS-1$
+ /**
+ * <pre>
* FORMATTER / Option to insert a space before the closing parenthesis in a switch statement
* - option id: "org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch"
* - possible values: { INSERT, DO_NOT_INSERT }
@@ -3807,6 +3923,18 @@ public class DefaultCodeFormatterConstants {
public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_PARAMETERIZED_TYPE_REFERENCE = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_comma_in_parameterized_type_reference"; //$NON-NLS-1$
/**
* <pre>
+ * FORMATTER / Option to insert a space before comma in record components list
+ * - option id: "org.eclipse.jdt.core.formatter.insert_space_before_comma_in_record_components"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
+ * </pre>
+ * @see JavaCore#INSERT
+ * @see JavaCore#DO_NOT_INSERT
+ * @since 3.21
+ */
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_RECORD_COMPONENTS = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_comma_in_record_components"; //$NON-NLS-1$
+ /**
+ * <pre>
* FORMATTER / Option to insert a space before comma in the superinterfaces names in a type header
* - option id: "org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces"
* - possible values: { INSERT, DO_NOT_INSERT }
@@ -4011,6 +4139,30 @@ public class DefaultCodeFormatterConstants {
public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_METHOD_DECLARATION = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_opening_brace_in_method_declaration"; //$NON-NLS-1$
/**
* <pre>
+ * FORMATTER / Option to insert a space before the opening brace in a record constructor
+ * - option id: "org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_constructor"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
+ * </pre>
+ * @see JavaCore#INSERT
+ * @see JavaCore#DO_NOT_INSERT
+ * @since 3.21
+ */
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_RECORD_CONSTRUCTOR = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_opening_brace_in_record_constructor"; //$NON-NLS-1$
+ /**
+ * <pre>
+ * FORMATTER / Option to insert a space before the opening brace in a record declaration
+ * - option id: "org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_declaration"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
+ * </pre>
+ * @see JavaCore#INSERT
+ * @see JavaCore#DO_NOT_INSERT
+ * @since 3.21
+ */
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_RECORD_DECLARATION = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_opening_brace_in_record_declaration"; //$NON-NLS-1$
+ /**
+ * <pre>
* FORMATTER / Option to insert a space before the opening brace in a switch statement
* - option id: "org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch"
* - possible values: { INSERT, DO_NOT_INSERT }
@@ -4191,6 +4343,18 @@ public class DefaultCodeFormatterConstants {
public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_PARENTHESIZED_EXPRESSION = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_parenthesized_expression"; //$NON-NLS-1$
/**
* <pre>
+ * FORMATTER / Option to insert a space before the opening parenthesis in a record declaration
+ * - option id: "org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_record_declaration"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
+ * </pre>
+ * @see JavaCore#INSERT
+ * @see JavaCore#DO_NOT_INSERT
+ * @since 3.21
+ */
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_RECORD_DECLARATION = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_record_declaration"; //$NON-NLS-1$
+ /**
+ * <pre>
* FORMATTER / Option to insert a space before the opening parenthesis in a switch statement
* - option id: "org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch"
* - possible values: { INSERT, DO_NOT_INSERT }
@@ -4730,6 +4894,38 @@ public class DefaultCodeFormatterConstants {
* @since 3.16
*/
public static final String FORMATTER_KEEP_ANNOTATION_DECLARATION_ON_ONE_LINE = JavaCore.PLUGIN_ID + ".formatter.keep_annotation_declaration_on_one_line"; //$NON-NLS-1$
+ /**
+ * <pre>
+ * FORMATTER / Option to control when a record declaration should be kept on one line
+ * - option id: "org.eclipse.jdt.core.formatter.keep_record_declaration_on_one_line"
+ * - possible values: { ONE_LINE_NEVER, ONE_LINE_IF_EMPTY, ONE_LINE_IF_SINGLE_ITEM,
+ * ONE_LINE_ALWAYS, ONE_LINE_PRESERVE }
+ * - default: ONE_LINE_NEVER
+ * </pre>
+ * @see #ONE_LINE_NEVER
+ * @see #ONE_LINE_IF_EMPTY
+ * @see #ONE_LINE_IF_SINGLE_ITEM
+ * @see #ONE_LINE_ALWAYS
+ * @see #ONE_LINE_PRESERVE
+ * @since 3.21
+ */
+ public static final String FORMATTER_KEEP_RECORD_DECLARATION_ON_ONE_LINE = JavaCore.PLUGIN_ID + ".formatter.keep_record_declaration_on_one_line"; //$NON-NLS-1$
+ /**
+ * <pre>
+ * FORMATTER / Option to control when a record constructor should be kept on one line
+ * - option id: "org.eclipse.jdt.core.formatter.keep_record_constructor_on_one_line"
+ * - possible values: { ONE_LINE_NEVER, ONE_LINE_IF_EMPTY, ONE_LINE_IF_SINGLE_ITEM,
+ * ONE_LINE_ALWAYS, ONE_LINE_PRESERVE }
+ * - default: ONE_LINE_NEVER
+ * </pre>
+ * @see #ONE_LINE_NEVER
+ * @see #ONE_LINE_IF_EMPTY
+ * @see #ONE_LINE_IF_SINGLE_ITEM
+ * @see #ONE_LINE_ALWAYS
+ * @see #ONE_LINE_PRESERVE
+ * @since 3.21
+ */
+ public static final String FORMATTER_KEEP_RECORD_CONSTRUCTOR_ON_ONE_LINE = JavaCore.PLUGIN_ID + ".formatter.keep_record_constructor_on_one_line"; //$NON-NLS-1$
/**
* <pre>
@@ -5127,6 +5323,8 @@ public class DefaultCodeFormatterConstants {
* @see #FORMATTER_BRACE_POSITION_FOR_BLOCK
* @see #FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION
* @see #FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION
+ * @see #FORMATTER_BRACE_POSITION_FOR_RECORD_CONSTRUCTOR
+ * @see #FORMATTER_BRACE_POSITION_FOR_RECORD_DECLARATION
* @see #FORMATTER_BRACE_POSITION_FOR_SWITCH
* @see #FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION
* @see #FORMATTER_BRACE_POSITION_FOR_LAMBDA_BODY
@@ -5143,6 +5341,8 @@ public class DefaultCodeFormatterConstants {
* @see #FORMATTER_BRACE_POSITION_FOR_BLOCK
* @see #FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION
* @see #FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION
+ * @see #FORMATTER_BRACE_POSITION_FOR_RECORD_CONSTRUCTOR
+ * @see #FORMATTER_BRACE_POSITION_FOR_RECORD_DECLARATION
* @see #FORMATTER_BRACE_POSITION_FOR_SWITCH
* @see #FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION
* @see #FORMATTER_BRACE_POSITION_FOR_LAMBDA_BODY
@@ -5159,6 +5359,8 @@ public class DefaultCodeFormatterConstants {
* @see #FORMATTER_BRACE_POSITION_FOR_BLOCK
* @see #FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION
* @see #FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION
+ * @see #FORMATTER_BRACE_POSITION_FOR_RECORD_CONSTRUCTOR
+ * @see #FORMATTER_BRACE_POSITION_FOR_RECORD_DECLARATION
* @see #FORMATTER_BRACE_POSITION_FOR_SWITCH
* @see #FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION
* @see #FORMATTER_BRACE_POSITION_FOR_LAMBDA_BODY
@@ -5174,6 +5376,7 @@ public class DefaultCodeFormatterConstants {
* @see #FORMATTER_PARENTHESES_POSITIONS_IN_METHOD_DECLARATION
* @see #FORMATTER_PARENTHESES_POSITIONS_IN_METHOD_INVOCATION
* @see #FORMATTER_PARENTHESES_POSITIONS_IN_ENUM_CONSTANT_DECLARATION
+ * @see #FORMATTER_PARENTHESES_POSITIONS_IN_RECORD_DECLARATION
* @see #FORMATTER_PARENTHESES_POSITIONS_IN_IF_WHILE_STATEMENT
* @see #FORMATTER_PARENTHESES_POSITIONS_IN_FOR_STATEMENT
* @see #FORMATTER_PARENTHESES_POSITIONS_IN_SWITCH_STATEMENT
@@ -5193,6 +5396,7 @@ public class DefaultCodeFormatterConstants {
* @see #FORMATTER_PARENTHESES_POSITIONS_IN_METHOD_DECLARATION
* @see #FORMATTER_PARENTHESES_POSITIONS_IN_METHOD_INVOCATION
* @see #FORMATTER_PARENTHESES_POSITIONS_IN_ENUM_CONSTANT_DECLARATION
+ * @see #FORMATTER_PARENTHESES_POSITIONS_IN_RECORD_DECLARATION
* @see #FORMATTER_PARENTHESES_POSITIONS_IN_ANNOTATION
* @see #FORMATTER_PARENTHESES_POSITIONS_IN_LAMBDA_DECLARATION
* @since 3.12
@@ -5207,6 +5411,7 @@ public class DefaultCodeFormatterConstants {
* @see #FORMATTER_PARENTHESES_POSITIONS_IN_METHOD_DECLARATION
* @see #FORMATTER_PARENTHESES_POSITIONS_IN_METHOD_INVOCATION
* @see #FORMATTER_PARENTHESES_POSITIONS_IN_ENUM_CONSTANT_DECLARATION
+ * @see #FORMATTER_PARENTHESES_POSITIONS_IN_RECORD_DECLARATION
* @see #FORMATTER_PARENTHESES_POSITIONS_IN_IF_WHILE_STATEMENT
* @see #FORMATTER_PARENTHESES_POSITIONS_IN_FOR_STATEMENT
* @see #FORMATTER_PARENTHESES_POSITIONS_IN_SWITCH_STATEMENT
@@ -5227,6 +5432,7 @@ public class DefaultCodeFormatterConstants {
* @see #FORMATTER_PARENTHESES_POSITIONS_IN_METHOD_DECLARATION
* @see #FORMATTER_PARENTHESES_POSITIONS_IN_METHOD_INVOCATION
* @see #FORMATTER_PARENTHESES_POSITIONS_IN_ENUM_CONSTANT_DECLARATION
+ * @see #FORMATTER_PARENTHESES_POSITIONS_IN_RECORD_DECLARATION
* @see #FORMATTER_PARENTHESES_POSITIONS_IN_IF_WHILE_STATEMENT
* @see #FORMATTER_PARENTHESES_POSITIONS_IN_FOR_STATEMENT
* @see #FORMATTER_PARENTHESES_POSITIONS_IN_SWITCH_STATEMENT
@@ -5246,6 +5452,7 @@ public class DefaultCodeFormatterConstants {
* @see #FORMATTER_PARENTHESES_POSITIONS_IN_METHOD_DECLARATION
* @see #FORMATTER_PARENTHESES_POSITIONS_IN_METHOD_INVOCATION
* @see #FORMATTER_PARENTHESES_POSITIONS_IN_ENUM_CONSTANT_DECLARATION
+ * @see #FORMATTER_PARENTHESES_POSITIONS_IN_RECORD_DECLARATION
* @see #FORMATTER_PARENTHESES_POSITIONS_IN_IF_WHILE_STATEMENT
* @see #FORMATTER_PARENTHESES_POSITIONS_IN_FOR_STATEMENT
* @see #FORMATTER_PARENTHESES_POSITIONS_IN_SWITCH_STATEMENT
diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatter.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatter.java
index b26baced89..c658646b34 100644
--- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatter.java
+++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatter.java
@@ -131,14 +131,14 @@ public class DefaultCodeFormatter extends CodeFormatter {
this.workingOptions = new DefaultCodeFormatterOptions(options);
this.oldCommentFormatOption = getOldCommentFormatOption(options);
String compilerSource = options.get(CompilerOptions.OPTION_Source);
- this.sourceLevel = compilerSource != null ? compilerSource : CompilerOptions.VERSION_13;
+ this.sourceLevel = compilerSource != null ? compilerSource : CompilerOptions.VERSION_14;
this.previewEnabled = JavaCore.ENABLED.equals(options.get(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES));
} else {
Map<String, String> settings = DefaultCodeFormatterConstants.getJavaConventionsSettings();
this.originalOptions = new DefaultCodeFormatterOptions(settings);
this.workingOptions = new DefaultCodeFormatterOptions(settings);
this.oldCommentFormatOption = DefaultCodeFormatterConstants.TRUE;
- this.sourceLevel = CompilerOptions.VERSION_13;
+ this.sourceLevel = CompilerOptions.VERSION_14;
}
if (defaultCodeFormatterOptions != null) {
this.originalOptions.set(defaultCodeFormatterOptions.getMap());
diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java
index 99b5de47da..ff45cf1389 100644
--- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java
+++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java
@@ -147,9 +147,11 @@ public class DefaultCodeFormatterOptions {
public int alignment_for_parameterized_type_references;
public int alignment_for_parameters_in_constructor_declaration;
public int alignment_for_parameters_in_method_declaration;
+ public int alignment_for_record_components;
public int alignment_for_selector_in_method_invocation;
public int alignment_for_superclass_in_type_declaration;
public int alignment_for_superinterfaces_in_enum_declaration;
+ public int alignment_for_superinterfaces_in_record_declaration;
public int alignment_for_superinterfaces_in_type_declaration;
public int alignment_for_throws_clause_in_constructor_declaration;
public int alignment_for_throws_clause_in_method_declaration;
@@ -175,11 +177,14 @@ public class DefaultCodeFormatterOptions {
public String brace_position_for_lambda_body;
public String brace_position_for_method_declaration;
public String brace_position_for_type_declaration;
+ public String brace_position_for_record_constructor;
+ public String brace_position_for_record_declaration;
public String brace_position_for_switch;
public String parenthesis_positions_in_method_declaration;
public String parenthesis_positions_in_method_invocation;
public String parenthesis_positions_in_enum_constant_declaration;
+ public String parenthesis_positions_in_record_declaration;
public String parenthesis_positions_in_if_while_statement;
public String parenthesis_positions_in_for_statement;
public String parenthesis_positions_in_switch_statement;
@@ -246,6 +251,7 @@ public class DefaultCodeFormatterOptions {
public boolean indent_body_declarations_compare_to_annotation_declaration_header;
public boolean indent_body_declarations_compare_to_enum_constant_header;
public boolean indent_body_declarations_compare_to_enum_declaration_header;
+ public boolean indent_body_declarations_compare_to_record_header;
public boolean indent_body_declarations_compare_to_type_header;
public boolean indent_breaks_compare_to_cases;
public boolean indent_empty_lines;
@@ -280,6 +286,8 @@ public class DefaultCodeFormatterOptions {
public String keep_enum_declaration_on_one_line;
public String keep_enum_constant_declaration_on_one_line;
public String keep_annotation_declaration_on_one_line;
+ public String keep_record_declaration_on_one_line;
+ public String keep_record_constructor_on_one_line;
public boolean keep_simple_getter_setter_on_one_line;
public boolean insert_space_after_and_in_type_parameter;
@@ -321,6 +329,7 @@ public class DefaultCodeFormatterOptions {
public boolean insert_space_after_comma_in_multiple_field_declarations;
public boolean insert_space_after_comma_in_multiple_local_declarations;
public boolean insert_space_after_comma_in_parameterized_type_reference;
+ public boolean insert_space_after_comma_in_record_components;
public boolean insert_space_after_comma_in_superinterfaces;
public boolean insert_space_after_comma_in_switch_case_expressions;
public boolean insert_space_after_comma_in_type_arguments;
@@ -344,6 +353,7 @@ public class DefaultCodeFormatterOptions {
public boolean insert_space_after_opening_paren_in_method_declaration;
public boolean insert_space_after_opening_paren_in_method_invocation;
public boolean insert_space_after_opening_paren_in_parenthesized_expression;
+ public boolean insert_space_after_opening_paren_in_record_declaration;
public boolean insert_space_after_opening_paren_in_switch;
public boolean insert_space_after_opening_paren_in_synchronized;
public boolean insert_space_after_opening_paren_in_try;
@@ -383,6 +393,7 @@ public class DefaultCodeFormatterOptions {
public boolean insert_space_before_closing_paren_in_method_declaration;
public boolean insert_space_before_closing_paren_in_method_invocation;
public boolean insert_space_before_closing_paren_in_parenthesized_expression;
+ public boolean insert_space_before_closing_paren_in_record_declaration;
public boolean insert_space_before_closing_paren_in_switch;
public boolean insert_space_before_closing_paren_in_synchronized;
public boolean insert_space_before_closing_paren_in_try;
@@ -409,6 +420,7 @@ public class DefaultCodeFormatterOptions {
public boolean insert_space_before_comma_in_multiple_field_declarations;
public boolean insert_space_before_comma_in_multiple_local_declarations;
public boolean insert_space_before_comma_in_parameterized_type_reference;
+ public boolean insert_space_before_comma_in_record_components;
public boolean insert_space_before_comma_in_superinterfaces;
public boolean insert_space_before_comma_in_switch_case_expressions;
public boolean insert_space_before_comma_in_type_arguments;
@@ -429,6 +441,8 @@ public class DefaultCodeFormatterOptions {
public boolean insert_space_before_opening_brace_in_enum_constant;
public boolean insert_space_before_opening_brace_in_enum_declaration;
public boolean insert_space_before_opening_brace_in_method_declaration;
+ public boolean insert_space_before_opening_brace_in_record_constructor;
+ public boolean insert_space_before_opening_brace_in_record_declaration;
public boolean insert_space_before_opening_brace_in_type_declaration;
public boolean insert_space_before_opening_bracket_in_array_allocation_expression;
public boolean insert_space_before_opening_bracket_in_array_reference;
@@ -442,6 +456,7 @@ public class DefaultCodeFormatterOptions {
public boolean insert_space_before_opening_paren_in_if;
public boolean insert_space_before_opening_paren_in_method_invocation;
public boolean insert_space_before_opening_paren_in_method_declaration;
+ public boolean insert_space_before_opening_paren_in_record_declaration;
public boolean insert_space_before_opening_paren_in_switch;
public boolean insert_space_before_opening_paren_in_try;
public boolean insert_space_before_opening_brace_in_switch;
@@ -505,6 +520,20 @@ public class DefaultCodeFormatterOptions {
DefaultCodeFormatterConstants.ONE_LINE_ALWAYS,
DefaultCodeFormatterConstants.ONE_LINE_PRESERVE);
+ private final static List<String> BRACE_POSITION_VALUES = Arrays.asList(
+ DefaultCodeFormatterConstants.END_OF_LINE,
+ DefaultCodeFormatterConstants.NEXT_LINE,
+ DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED,
+ DefaultCodeFormatterConstants.NEXT_LINE_ON_WRAP);
+
+ private final static List<String> PARENTHESIS_POSITION_VALUES = Arrays.asList(
+ DefaultCodeFormatterConstants.COMMON_LINES,
+ DefaultCodeFormatterConstants.SEPARATE_LINES_IF_NOT_EMPTY,
+ DefaultCodeFormatterConstants.SEPARATE_LINES_IF_WRAPPED,
+ DefaultCodeFormatterConstants.SEPARATE_LINES,
+ DefaultCodeFormatterConstants.SEPARATE_LINES,
+ DefaultCodeFormatterConstants.PRESERVE_POSITIONS);
+
private DefaultCodeFormatterOptions() {
// cannot be instantiated
}
@@ -548,10 +577,12 @@ public class DefaultCodeFormatterOptions {
options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERIZED_TYPE_REFERENCES, getAlignment(this.alignment_for_parameterized_type_references));
options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_CONSTRUCTOR_DECLARATION, getAlignment(this.alignment_for_parameters_in_constructor_declaration));
options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION, getAlignment(this.alignment_for_parameters_in_method_declaration));
+ options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_RECORD_COMPONENTS, getAlignment(this.alignment_for_record_components));
options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_RESOURCES_IN_TRY, getAlignment(this.alignment_for_resources_in_try));
options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_SELECTOR_IN_METHOD_INVOCATION, getAlignment(this.alignment_for_selector_in_method_invocation));
options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_SUPERCLASS_IN_TYPE_DECLARATION, getAlignment(this.alignment_for_superclass_in_type_declaration));
options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_SUPERINTERFACES_IN_ENUM_DECLARATION, getAlignment(this.alignment_for_superinterfaces_in_enum_declaration));
+ options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_SUPERINTERFACES_IN_RECORD_DECLARATION, getAlignment(this.alignment_for_superinterfaces_in_record_declaration));
options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_SUPERINTERFACES_IN_TYPE_DECLARATION, getAlignment(this.alignment_for_superinterfaces_in_type_declaration));
options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_CONSTRUCTOR_DECLARATION, getAlignment(this.alignment_for_throws_clause_in_constructor_declaration));
options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_METHOD_DECLARATION, getAlignment(this.alignment_for_throws_clause_in_method_declaration));
@@ -574,10 +605,13 @@ public class DefaultCodeFormatterOptions {
options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, this.brace_position_for_method_declaration);
options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, this.brace_position_for_type_declaration);
options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_LAMBDA_BODY, this.brace_position_for_lambda_body);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_RECORD_CONSTRUCTOR, this.brace_position_for_record_constructor);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_RECORD_DECLARATION, this.brace_position_for_record_declaration);
options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, this.brace_position_for_switch);
options.put(DefaultCodeFormatterConstants.FORMATTER_PARENTHESES_POSITIONS_IN_METHOD_DECLARATION, this.parenthesis_positions_in_method_declaration);
options.put(DefaultCodeFormatterConstants.FORMATTER_PARENTHESES_POSITIONS_IN_METHOD_INVOCATION, this.parenthesis_positions_in_method_invocation);
options.put(DefaultCodeFormatterConstants.FORMATTER_PARENTHESES_POSITIONS_IN_ENUM_CONSTANT_DECLARATION, this.parenthesis_positions_in_enum_constant_declaration);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_PARENTHESES_POSITIONS_IN_RECORD_DECLARATION, this.parenthesis_positions_in_record_declaration);
options.put(DefaultCodeFormatterConstants.FORMATTER_PARENTHESES_POSITIONS_IN_IF_WHILE_STATEMENT, this.parenthesis_positions_in_if_while_statement);
options.put(DefaultCodeFormatterConstants.FORMATTER_PARENTHESES_POSITIONS_IN_FOR_STATEMENT, this.parenthesis_positions_in_for_statement);
options.put(DefaultCodeFormatterConstants.FORMATTER_PARENTHESES_POSITIONS_IN_SWITCH_STATEMENT, this.parenthesis_positions_in_switch_statement);
@@ -634,6 +668,7 @@ public class DefaultCodeFormatterOptions {
options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ANNOTATION_DECLARATION_HEADER, this.indent_body_declarations_compare_to_annotation_declaration_header ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ENUM_CONSTANT_HEADER, this.indent_body_declarations_compare_to_enum_constant_header ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ENUM_DECLARATION_HEADER, this.indent_body_declarations_compare_to_enum_declaration_header ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_RECORD_HEADER, this.indent_body_declarations_compare_to_record_header ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_TYPE_HEADER, this.indent_body_declarations_compare_to_type_header ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_BREAKS_COMPARE_TO_CASES, this.indent_breaks_compare_to_cases ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_EMPTY_LINES, this.indent_empty_lines ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
@@ -665,6 +700,8 @@ public class DefaultCodeFormatterOptions {
options.put(DefaultCodeFormatterConstants.FORMATTER_KEEP_ENUM_DECLARATION_ON_ONE_LINE, this.keep_enum_declaration_on_one_line);
options.put(DefaultCodeFormatterConstants.FORMATTER_KEEP_METHOD_BODY_ON_ONE_LINE, this.keep_method_body_on_one_line);
options.put(DefaultCodeFormatterConstants.FORMATTER_KEEP_TYPE_DECLARATION_ON_ONE_LINE, this.keep_type_declaration_on_one_line);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_KEEP_RECORD_DECLARATION_ON_ONE_LINE, this.keep_record_declaration_on_one_line);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_KEEP_RECORD_CONSTRUCTOR_ON_ONE_LINE, this.keep_record_constructor_on_one_line);
options.put(DefaultCodeFormatterConstants.FORMATTER_KEEP_SIMPLE_GETTER_SETTER_ON_ONE_LINE, this.keep_simple_getter_setter_on_one_line? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_LABEL, this.insert_new_line_after_label? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_AND_IN_TYPE_PARAMETER, this.insert_space_after_and_in_type_parameter? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
@@ -705,6 +742,7 @@ public class DefaultCodeFormatterOptions {
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_MULTIPLE_FIELD_DECLARATIONS, this.insert_space_after_comma_in_multiple_field_declarations? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_MULTIPLE_LOCAL_DECLARATIONS, this.insert_space_after_comma_in_multiple_local_declarations? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_PARAMETERIZED_TYPE_REFERENCE, this.insert_space_after_comma_in_parameterized_type_reference? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_RECORD_COMPONENTS, this.insert_space_after_comma_in_record_components? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_SUPERINTERFACES, this.insert_space_after_comma_in_superinterfaces? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_SWITCH_CASE_EXPRESSIONS, this.insert_space_after_comma_in_switch_case_expressions ? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_TYPE_ARGUMENTS, this.insert_space_after_comma_in_type_arguments ? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
@@ -728,6 +766,7 @@ public class DefaultCodeFormatterOptions {
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_DECLARATION, this.insert_space_after_opening_paren_in_method_declaration? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_INVOCATION, this.insert_space_after_opening_paren_in_method_invocation? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_PARENTHESIZED_EXPRESSION, this.insert_space_after_opening_paren_in_parenthesized_expression? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_RECORD_DECLARATION, this.insert_space_after_opening_paren_in_record_declaration? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_SWITCH, this.insert_space_after_opening_paren_in_switch? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_SYNCHRONIZED, this.insert_space_after_opening_paren_in_synchronized? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_TRY, this.insert_space_after_opening_paren_in_try? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
@@ -767,6 +806,7 @@ public class DefaultCodeFormatterOptions {
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_DECLARATION, this.insert_space_before_closing_paren_in_method_declaration? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_INVOCATION, this.insert_space_before_closing_paren_in_method_invocation? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_PARENTHESIZED_EXPRESSION, this.insert_space_before_closing_paren_in_parenthesized_expression? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_RECORD_DECLARATION, this.insert_space_before_closing_paren_in_record_declaration? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_SWITCH, this.insert_space_before_closing_paren_in_switch? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_SYNCHRONIZED, this.insert_space_before_closing_paren_in_synchronized? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_TRY, this.insert_space_before_closing_paren_in_try? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
@@ -792,6 +832,7 @@ public class DefaultCodeFormatterOptions {
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_THROWS, this.insert_space_before_comma_in_method_declaration_throws? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_MULTIPLE_FIELD_DECLARATIONS, this.insert_space_before_comma_in_multiple_field_declarations? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_MULTIPLE_LOCAL_DECLARATIONS, this.insert_space_before_comma_in_multiple_local_declarations? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_RECORD_COMPONENTS, this.insert_space_before_comma_in_record_components? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_SUPERINTERFACES, this.insert_space_before_comma_in_superinterfaces? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_SWITCH_CASE_EXPRESSIONS, this.insert_space_before_comma_in_switch_case_expressions? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_TYPE_ARGUMENTS, this.insert_space_before_comma_in_type_arguments ? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
@@ -810,6 +851,8 @@ public class DefaultCodeFormatterOptions {
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ENUM_CONSTANT, this.insert_space_before_opening_brace_in_enum_constant? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ENUM_DECLARATION, this.insert_space_before_opening_brace_in_enum_declaration? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_METHOD_DECLARATION, this.insert_space_before_opening_brace_in_method_declaration? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_RECORD_CONSTRUCTOR, this.insert_space_before_opening_brace_in_record_constructor? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_RECORD_DECLARATION, this.insert_space_before_opening_brace_in_record_declaration? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_TYPE_DECLARATION, this.insert_space_before_opening_brace_in_type_declaration? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACKET_IN_ARRAY_ALLOCATION_EXPRESSION, this.insert_space_before_opening_bracket_in_array_allocation_expression ? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACKET_IN_ARRAY_REFERENCE, this.insert_space_before_opening_bracket_in_array_reference? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
@@ -823,6 +866,7 @@ public class DefaultCodeFormatterOptions {
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_IF, this.insert_space_before_opening_paren_in_if? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_METHOD_INVOCATION, this.insert_space_before_opening_paren_in_method_invocation? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_METHOD_DECLARATION, this.insert_space_before_opening_paren_in_method_declaration? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_RECORD_DECLARATION, this.insert_space_before_opening_paren_in_record_declaration? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_SWITCH, this.insert_space_before_opening_paren_in_switch? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_SWITCH, this.insert_space_before_opening_brace_in_switch? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_SYNCHRONIZED, this.insert_space_before_opening_paren_in_synchronized? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
@@ -1066,6 +1110,8 @@ public class DefaultCodeFormatterOptions {
this.alignment_for_parameters_in_method_declaration = Alignment.M_COMPACT_SPLIT;
}
}
+ setInt(settings, DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_RECORD_COMPONENTS,
+ v -> this.alignment_for_record_components = v);
final Object alignmentForResourcesInTry = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_RESOURCES_IN_TRY);
if (alignmentForResourcesInTry != null) {
try {
@@ -1098,6 +1144,8 @@ public class DefaultCodeFormatterOptions {
this.alignment_for_superinterfaces_in_enum_declaration = Alignment.M_NEXT_SHIFTED_SPLIT;
}
}
+ setInt(settings, DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_SUPERINTERFACES_IN_RECORD_DECLARATION,
+ v -> this.alignment_for_superinterfaces_in_record_declaration = v);
final Object alignmentForSuperinterfacesInTypeDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_SUPERINTERFACES_IN_TYPE_DECLARATION);
if (alignmentForSuperinterfacesInTypeDeclarationOption != null) {
try {
@@ -1242,6 +1290,10 @@ public class DefaultCodeFormatterOptions {
this.brace_position_for_method_declaration = DefaultCodeFormatterConstants.END_OF_LINE;
}
}
+ setString(settings, DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_RECORD_CONSTRUCTOR, BRACE_POSITION_VALUES,
+ v -> this.brace_position_for_record_constructor = v);
+ setString(settings, DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_RECORD_DECLARATION, BRACE_POSITION_VALUES,
+ v -> this.brace_position_for_record_declaration = v);
final Object bracePositionForSwitchOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH);
if (bracePositionForSwitchOption != null) {
try {
@@ -1271,6 +1323,8 @@ public class DefaultCodeFormatterOptions {
if (closingParenPositionInEnumConstantDeclaration != null) {
this.parenthesis_positions_in_enum_constant_declaration = toString(closingParenPositionInEnumConstantDeclaration, DefaultCodeFormatterConstants.COMMON_LINES);
}
+ setString(settings, DefaultCodeFormatterConstants.FORMATTER_PARENTHESES_POSITIONS_IN_RECORD_DECLARATION, PARENTHESIS_POSITION_VALUES,
+ v -> this.parenthesis_positions_in_record_declaration = v);
final Object closingParenPositionInIfWhileStatement = settings.get(DefaultCodeFormatterConstants.FORMATTER_PARENTHESES_POSITIONS_IN_IF_WHILE_STATEMENT);
if (closingParenPositionInIfWhileStatement != null) {
this.parenthesis_positions_in_if_while_statement = toString(closingParenPositionInIfWhileStatement, DefaultCodeFormatterConstants.COMMON_LINES);
@@ -1521,6 +1575,8 @@ public class DefaultCodeFormatterOptions {
if (indentStatementsCompareToBodyOption != null) {
this.indent_statements_compare_to_body = DefaultCodeFormatterConstants.TRUE.equals(indentStatementsCompareToBodyOption);
}
+ setBoolean(settings, DefaultCodeFormatterConstants.FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_RECORD_HEADER, DefaultCodeFormatterConstants.TRUE,
+ v -> this.indent_body_declarations_compare_to_record_header = v);
final Object indentBodyDeclarationsCompareToAnnotationDeclarationHeaderOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ANNOTATION_DECLARATION_HEADER);
if (indentBodyDeclarationsCompareToAnnotationDeclarationHeaderOption != null) {
this.indent_body_declarations_compare_to_annotation_declaration_header = DefaultCodeFormatterConstants.TRUE.equals(indentBodyDeclarationsCompareToAnnotationDeclarationHeaderOption);
@@ -1617,6 +1673,10 @@ public class DefaultCodeFormatterOptions {
v -> this.keep_method_body_on_one_line = v);
setString(settings, DefaultCodeFormatterConstants.FORMATTER_KEEP_TYPE_DECLARATION_ON_ONE_LINE, KEEP_ON_ONE_LINE_VALUES,
v -> this.keep_type_declaration_on_one_line = v);
+ setString(settings, DefaultCodeFormatterConstants.FORMATTER_KEEP_RECORD_DECLARATION_ON_ONE_LINE, KEEP_ON_ONE_LINE_VALUES,
+ v -> this.keep_record_declaration_on_one_line = v);
+ setString(settings, DefaultCodeFormatterConstants.FORMATTER_KEEP_RECORD_CONSTRUCTOR_ON_ONE_LINE, KEEP_ON_ONE_LINE_VALUES,
+ v -> this.keep_record_constructor_on_one_line = v);
setBoolean(settings, DefaultCodeFormatterConstants.FORMATTER_KEEP_SIMPLE_GETTER_SETTER_ON_ONE_LINE, DefaultCodeFormatterConstants.TRUE,
v -> this.keep_simple_getter_setter_on_one_line = v);
@@ -1758,6 +1818,8 @@ public class DefaultCodeFormatterOptions {
if (insertSpaceAfterCommaInParameterizedTypeReferenceOption != null) {
this.insert_space_after_comma_in_parameterized_type_reference = JavaCore.INSERT.equals(insertSpaceAfterCommaInParameterizedTypeReferenceOption);
}
+ setBoolean(settings, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_RECORD_COMPONENTS, JavaCore.INSERT,
+ v -> this.insert_space_after_comma_in_record_components = v);
final Object insertSpaceAfterCommaInSuperinterfacesOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_SUPERINTERFACES);
if (insertSpaceAfterCommaInSuperinterfacesOption != null) {
this.insert_space_after_comma_in_superinterfaces = JavaCore.INSERT.equals(insertSpaceAfterCommaInSuperinterfacesOption);
@@ -1846,6 +1908,8 @@ public class DefaultCodeFormatterOptions {
if (insertSpaceAfterOpeningParenInParenthesizedExpressionOption != null) {
this.insert_space_after_opening_paren_in_parenthesized_expression = JavaCore.INSERT.equals(insertSpaceAfterOpeningParenInParenthesizedExpressionOption);
}
+ setBoolean(settings, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_RECORD_DECLARATION, JavaCore.INSERT,
+ v -> this.insert_space_after_opening_paren_in_record_declaration = v);
final Object insertSpaceAfterOpeningParenInSwitchOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_SWITCH);
if (insertSpaceAfterOpeningParenInSwitchOption != null) {
this.insert_space_after_opening_paren_in_switch = JavaCore.INSERT.equals(insertSpaceAfterOpeningParenInSwitchOption);
@@ -1984,6 +2048,8 @@ public class DefaultCodeFormatterOptions {
if (insertSpaceBeforeClosingParenInParenthesizedExpressionOption != null) {
this.insert_space_before_closing_paren_in_parenthesized_expression = JavaCore.INSERT.equals(insertSpaceBeforeClosingParenInParenthesizedExpressionOption);
}
+ setBoolean(settings, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_RECORD_DECLARATION, JavaCore.INSERT,
+ v -> this.insert_space_before_closing_paren_in_record_declaration = v);
final Object insertSpaceBeforeClosingParenInSwitchOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_SWITCH);
if (insertSpaceBeforeClosingParenInSwitchOption != null) {
this.insert_space_before_closing_paren_in_switch = JavaCore.INSERT.equals(insertSpaceBeforeClosingParenInSwitchOption);
@@ -2089,6 +2155,8 @@ public class DefaultCodeFormatterOptions {
this.insert_space_before_comma_in_parameterized_type_reference = JavaCore.INSERT.equals(insertSpaceBeforeCommaInParameterizedTypeReferenceOption);
}
final Object insertSpaceBeforeCommaInSuperinterfacesOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_SUPERINTERFACES);
+ setBoolean(settings, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_RECORD_COMPONENTS, JavaCore.INSERT,
+ v -> this.insert_space_before_comma_in_record_components = v);
if (insertSpaceBeforeCommaInSuperinterfacesOption != null) {
this.insert_space_before_comma_in_superinterfaces = JavaCore.INSERT.equals(insertSpaceBeforeCommaInSuperinterfacesOption);
}
@@ -2154,6 +2222,10 @@ public class DefaultCodeFormatterOptions {
if (insertSpaceBeforeOpeningBraceInMethodDeclarationOption != null) {
this.insert_space_before_opening_brace_in_method_declaration = JavaCore.INSERT.equals(insertSpaceBeforeOpeningBraceInMethodDeclarationOption);
}
+ setBoolean(settings, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_RECORD_CONSTRUCTOR, JavaCore.INSERT,
+ v -> this.insert_space_before_opening_brace_in_record_constructor = v);
+ setBoolean(settings, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_RECORD_DECLARATION, JavaCore.INSERT,
+ v -> this.insert_space_before_opening_brace_in_record_declaration = v);
final Object insertSpaceBeforeOpeningBraceInTypeDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_TYPE_DECLARATION);
if (insertSpaceBeforeOpeningBraceInTypeDeclarationOption != null) {
this.insert_space_before_opening_brace_in_type_declaration = JavaCore.INSERT.equals(insertSpaceBeforeOpeningBraceInTypeDeclarationOption);
@@ -2206,6 +2278,8 @@ public class DefaultCodeFormatterOptions {
if (insertSpaceBeforeOpeningParenInMethodDeclarationOption != null) {
this.insert_space_before_opening_paren_in_method_declaration = JavaCore.INSERT.equals(insertSpaceBeforeOpeningParenInMethodDeclarationOption);
}
+ setBoolean(settings, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_RECORD_DECLARATION, JavaCore.INSERT,
+ v -> this.insert_space_before_opening_paren_in_record_declaration = v);
final Object insertSpaceBeforeOpeningParenInSwitchOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_SWITCH);
if (insertSpaceBeforeOpeningParenInSwitchOption != null) {
this.insert_space_before_opening_paren_in_switch = JavaCore.INSERT.equals(insertSpaceBeforeOpeningParenInSwitchOption);
@@ -2829,10 +2903,12 @@ public class DefaultCodeFormatterOptions {
this.alignment_for_parameterized_type_references = Alignment.M_NO_ALIGNMENT;
this.alignment_for_parameters_in_constructor_declaration = Alignment.M_COMPACT_SPLIT;
this.alignment_for_parameters_in_method_declaration = Alignment.M_COMPACT_SPLIT;
+ this.alignment_for_record_components = Alignment.M_COMPACT_SPLIT;
this.alignment_for_resources_in_try = Alignment.M_NEXT_PER_LINE_SPLIT;
this.alignment_for_selector_in_method_invocation = Alignment.M_COMPACT_SPLIT;
this.alignment_for_superclass_in_type_declaration = Alignment.M_NEXT_SHIFTED_SPLIT;
this.alignment_for_superinterfaces_in_enum_declaration = Alignment.M_NEXT_SHIFTED_SPLIT;
+ this.alignment_for_superinterfaces_in_record_declaration = Alignment.M_NEXT_SHIFTED_SPLIT;
this.alignment_for_superinterfaces_in_type_declaration = Alignment.M_NEXT_SHIFTED_SPLIT;
this.alignment_for_throws_clause_in_constructor_declaration = Alignment.M_COMPACT_SPLIT;
this.alignment_for_throws_clause_in_method_declaration = Alignment.M_COMPACT_SPLIT;
@@ -2855,10 +2931,13 @@ public class DefaultCodeFormatterOptions {
this.brace_position_for_lambda_body = DefaultCodeFormatterConstants.END_OF_LINE;
this.brace_position_for_method_declaration = DefaultCodeFormatterConstants.END_OF_LINE;
this.brace_position_for_type_declaration = DefaultCodeFormatterConstants.END_OF_LINE;
+ this.brace_position_for_record_constructor = DefaultCodeFormatterConstants.END_OF_LINE;
+ this.brace_position_for_record_declaration = DefaultCodeFormatterConstants.END_OF_LINE;
this.brace_position_for_switch = DefaultCodeFormatterConstants.END_OF_LINE;
this.parenthesis_positions_in_method_declaration = DefaultCodeFormatterConstants.COMMON_LINES;
this.parenthesis_positions_in_method_invocation = DefaultCodeFormatterConstants.COMMON_LINES;
this.parenthesis_positions_in_enum_constant_declaration = DefaultCodeFormatterConstants.COMMON_LINES;
+ this.parenthesis_positions_in_record_declaration = DefaultCodeFormatterConstants.COMMON_LINES;
this.parenthesis_positions_in_if_while_statement = DefaultCodeFormatterConstants.COMMON_LINES;
this.parenthesis_positions_in_for_statement = DefaultCodeFormatterConstants.COMMON_LINES;
this.parenthesis_positions_in_switch_statement = DefaultCodeFormatterConstants.COMMON_LINES;
@@ -2915,6 +2994,7 @@ public class DefaultCodeFormatterOptions {
this.indent_body_declarations_compare_to_annotation_declaration_header = true;
this.indent_body_declarations_compare_to_enum_constant_header = true;
this.indent_body_declarations_compare_to_enum_declaration_header = true;
+ this.indent_body_declarations_compare_to_record_header = true;
this.indent_body_declarations_compare_to_type_header = true;
this.indent_breaks_compare_to_cases = true;
this.indent_empty_lines = false;
@@ -2946,6 +3026,8 @@ public class DefaultCodeFormatterOptions {
this.keep_enum_declaration_on_one_line = DefaultCodeFormatterConstants.ONE_LINE_NEVER;
this.keep_method_body_on_one_line = DefaultCodeFormatterConstants.ONE_LINE_NEVER;
this.keep_type_declaration_on_one_line = DefaultCodeFormatterConstants.ONE_LINE_NEVER;
+ this.keep_record_declaration_on_one_line = DefaultCodeFormatterConstants.ONE_LINE_NEVER;
+ this.keep_record_constructor_on_one_line = DefaultCodeFormatterConstants.ONE_LINE_NEVER;
this.keep_simple_getter_setter_on_one_line = false;
this.insert_space_after_and_in_type_parameter = true;
this.insert_space_after_arrow_in_switch_case = true;
@@ -2985,6 +3067,7 @@ public class DefaultCodeFormatterOptions {
this.insert_space_after_comma_in_multiple_field_declarations = true;
this.insert_space_after_comma_in_multiple_local_declarations = true;
this.insert_space_after_comma_in_parameterized_type_reference = true;
+ this.insert_space_after_comma_in_record_components = true;
this.insert_space_after_comma_in_superinterfaces = true;
this.insert_space_after_comma_in_switch_case_expressions = true;
this.insert_space_after_comma_in_type_arguments = true;
@@ -3008,6 +3091,7 @@ public class DefaultCodeFormatterOptions {
this.insert_space_after_opening_paren_in_method_declaration = false;
this.insert_space_after_opening_paren_in_method_invocation = false;
this.insert_space_after_opening_paren_in_parenthesized_expression = false;
+ this.insert_space_after_opening_paren_in_record_declaration = false;
this.insert_space_after_opening_paren_in_switch = false;
this.insert_space_after_opening_paren_in_synchronized = false;
this.insert_space_after_opening_paren_in_try = false;
@@ -3047,6 +3131,7 @@ public class DefaultCodeFormatterOptions {
this.insert_space_before_closing_paren_in_method_declaration = false;
this.insert_space_before_closing_paren_in_method_invocation = false;
this.insert_space_before_closing_paren_in_parenthesized_expression = false;
+ this.insert_space_before_closing_paren_in_record_declaration = false;
this.insert_space_before_closing_paren_in_switch = false;
this.insert_space_before_closing_paren_in_synchronized = false;
this.insert_space_before_closing_paren_in_try = false;
@@ -3072,6 +3157,7 @@ public class DefaultCodeFormatterOptions {
this.insert_space_before_comma_in_multiple_field_declarations = false;
this.insert_space_before_comma_in_multiple_local_declarations = false;
this.insert_space_before_comma_in_parameterized_type_reference = false;
+ this.insert_space_before_comma_in_record_components = false;
this.insert_space_before_comma_in_superinterfaces = false;
this.insert_space_before_comma_in_switch_case_expressions = false;
this.insert_space_before_comma_in_type_arguments = false;
@@ -3091,6 +3177,8 @@ public class DefaultCodeFormatterOptions {
this.insert_space_before_opening_brace_in_enum_constant = true;
this.insert_space_before_opening_brace_in_enum_declaration = true;
this.insert_space_before_opening_brace_in_method_declaration = true;
+ this.insert_space_before_opening_brace_in_record_constructor = true;
+ this.insert_space_before_opening_brace_in_record_declaration = true;
this.insert_space_before_opening_brace_in_switch = true;
this.insert_space_before_opening_brace_in_type_declaration = true;
this.insert_space_before_opening_bracket_in_array_allocation_expression = false;
@@ -3105,6 +3193,7 @@ public class DefaultCodeFormatterOptions {
this.insert_space_before_opening_paren_in_if = true;
this.insert_space_before_opening_paren_in_method_invocation = false;
this.insert_space_before_opening_paren_in_method_declaration = false;
+ this.insert_space_before_opening_paren_in_record_declaration = false;
this.insert_space_before_opening_paren_in_switch = true;
this.insert_space_before_opening_paren_in_synchronized = true;
this.insert_space_before_opening_paren_in_try = true;
@@ -3196,10 +3285,12 @@ public class DefaultCodeFormatterOptions {
this.alignment_for_parameterized_type_references = Alignment.M_NO_ALIGNMENT;
this.alignment_for_parameters_in_constructor_declaration = Alignment.M_COMPACT_SPLIT;
this.alignment_for_parameters_in_method_declaration = Alignment.M_COMPACT_SPLIT;
+ this.alignment_for_record_components = Alignment.M_COMPACT_SPLIT;
this.alignment_for_resources_in_try = Alignment.M_NEXT_PER_LINE_SPLIT;
this.alignment_for_selector_in_method_invocation = Alignment.M_COMPACT_SPLIT;
this.alignment_for_superclass_in_type_declaration = Alignment.M_COMPACT_SPLIT;
this.alignment_for_superinterfaces_in_enum_declaration = Alignment.M_COMPACT_SPLIT;
+ this.alignment_for_superinterfaces_in_record_declaration = Alignment.M_COMPACT_SPLIT;
this.alignment_for_superinterfaces_in_type_declaration = Alignment.M_COMPACT_SPLIT;
this.alignment_for_throws_clause_in_constructor_declaration = Alignment.M_COMPACT_SPLIT;
this.alignment_for_throws_clause_in_method_declaration = Alignment.M_COMPACT_SPLIT;
@@ -3222,10 +3313,13 @@ public class DefaultCodeFormatterOptions {
this.brace_position_for_lambda_body = DefaultCodeFormatterConstants.END_OF_LINE;
this.brace_position_for_method_declaration = DefaultCodeFormatterConstants.END_OF_LINE;
this.brace_position_for_type_declaration = DefaultCodeFormatterConstants.END_OF_LINE;
+ this.brace_position_for_record_constructor = DefaultCodeFormatterConstants.END_OF_LINE;
+ this.brace_position_for_record_declaration = DefaultCodeFormatterConstants.END_OF_LINE;
this.brace_position_for_switch = DefaultCodeFormatterConstants.END_OF_LINE;
this.parenthesis_positions_in_method_declaration = DefaultCodeFormatterConstants.COMMON_LINES;
this.parenthesis_positions_in_method_invocation = DefaultCodeFormatterConstants.COMMON_LINES;
this.parenthesis_positions_in_enum_constant_declaration = DefaultCodeFormatterConstants.COMMON_LINES;
+ this.parenthesis_positions_in_record_declaration = DefaultCodeFormatterConstants.COMMON_LINES;
this.parenthesis_positions_in_if_while_statement = DefaultCodeFormatterConstants.COMMON_LINES;
this.parenthesis_positions_in_for_statement = DefaultCodeFormatterConstants.COMMON_LINES;
this.parenthesis_positions_in_switch_statement = DefaultCodeFormatterConstants.COMMON_LINES;
@@ -3260,6 +3354,7 @@ public class DefaultCodeFormatterOptions {
this.blank_lines_after_imports = 1;
this.blank_lines_after_package = 1;
this.blank_lines_before_field = 0;
+ this.blank_lines_before_first_class_body_declaration = 0;
this.blank_lines_after_last_class_body_declaration = 0;
this.blank_lines_before_imports = 1;
this.blank_lines_before_member_type = 1;
@@ -3281,6 +3376,7 @@ public class DefaultCodeFormatterOptions {
this.indent_body_declarations_compare_to_annotation_declaration_header = true;
this.indent_body_declarations_compare_to_enum_constant_header = true;
this.indent_body_declarations_compare_to_enum_declaration_header = true;
+ this.indent_body_declarations_compare_to_record_header = true;
this.indent_body_declarations_compare_to_type_header = true;
this.indent_breaks_compare_to_cases = true;
this.indent_empty_lines = false;
@@ -3312,6 +3408,9 @@ public class DefaultCodeFormatterOptions {
this.keep_enum_declaration_on_one_line = DefaultCodeFormatterConstants.ONE_LINE_NEVER;
this.keep_method_body_on_one_line = DefaultCodeFormatterConstants.ONE_LINE_NEVER;
this.keep_type_declaration_on_one_line = DefaultCodeFormatterConstants.ONE_LINE_NEVER;
+ this.keep_record_declaration_on_one_line = DefaultCodeFormatterConstants.ONE_LINE_NEVER;
+ this.keep_record_constructor_on_one_line = DefaultCodeFormatterConstants.ONE_LINE_NEVER;
+ this.keep_simple_getter_setter_on_one_line = false;
this.insert_space_after_and_in_type_parameter = true;
this.insert_space_after_arrow_in_switch_case = true;
this.insert_space_after_arrow_in_switch_default = true;
@@ -3350,6 +3449,7 @@ public class DefaultCodeFormatterOptions {
this.insert_space_after_comma_in_multiple_field_declarations = true;
this.insert_space_after_comma_in_multiple_local_declarations = true;
this.insert_space_after_comma_in_parameterized_type_reference = true;
+ this.insert_space_after_comma_in_record_components = true;
this.insert_space_after_comma_in_superinterfaces = true;
this.insert_space_after_comma_in_switch_case_expressions = true;
this.insert_space_after_comma_in_type_arguments = true;
@@ -3373,6 +3473,7 @@ public class DefaultCodeFormatterOptions {
this.insert_space_after_opening_paren_in_method_declaration = false;
this.insert_space_after_opening_paren_in_method_invocation = false;
this.insert_space_after_opening_paren_in_parenthesized_expression = false;
+ this.insert_space_after_opening_paren_in_record_declaration = false;
this.insert_space_after_opening_paren_in_switch = false;
this.insert_space_after_opening_paren_in_synchronized = false;
this.insert_space_after_opening_paren_in_try = false;
@@ -3412,6 +3513,7 @@ public class DefaultCodeFormatterOptions {
this.insert_space_before_closing_paren_in_method_declaration = false;
this.insert_space_before_closing_paren_in_method_invocation = false;
this.insert_space_before_closing_paren_in_parenthesized_expression = false;
+ this.insert_space_before_closing_paren_in_record_declaration = false;
this.insert_space_before_closing_paren_in_switch = false;
this.insert_space_before_closing_paren_in_synchronized = false;
this.insert_space_before_closing_paren_in_try = false;
@@ -3437,6 +3539,7 @@ public class DefaultCodeFormatterOptions {
this.insert_space_before_comma_in_multiple_field_declarations = false;
this.insert_space_before_comma_in_multiple_local_declarations = false;
this.insert_space_before_comma_in_parameterized_type_reference = false;
+ this.insert_space_before_comma_in_record_components = false;
this.insert_space_before_comma_in_superinterfaces = false;
this.insert_space_before_comma_in_switch_case_expressions = false;
this.insert_space_before_comma_in_type_arguments = false;
@@ -3456,6 +3559,8 @@ public class DefaultCodeFormatterOptions {
this.insert_space_before_opening_brace_in_enum_constant = true;
this.insert_space_before_opening_brace_in_enum_declaration = true;
this.insert_space_before_opening_brace_in_method_declaration = true;
+ this.insert_space_before_opening_brace_in_record_constructor = true;
+ this.insert_space_before_opening_brace_in_record_declaration = true;
this.insert_space_before_opening_brace_in_switch = true;
this.insert_space_before_opening_brace_in_type_declaration = true;
this.insert_space_before_opening_bracket_in_array_allocation_expression = false;
@@ -3470,6 +3575,7 @@ public class DefaultCodeFormatterOptions {
this.insert_space_before_opening_paren_in_if = true;
this.insert_space_before_opening_paren_in_method_invocation = false;
this.insert_space_before_opening_paren_in_method_declaration = false;
+ this.insert_space_before_opening_paren_in_record_declaration = false;
this.insert_space_before_opening_paren_in_switch = true;
this.insert_space_before_opening_paren_in_synchronized = true;
this.insert_space_before_opening_paren_in_try = true;
diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/LineBreaksPreparator.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/LineBreaksPreparator.java
index 28ab742012..e2f3be3a54 100644
--- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/LineBreaksPreparator.java
+++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/LineBreaksPreparator.java
@@ -69,6 +69,7 @@ import org.eclipse.jdt.core.dom.ModuleDeclaration;
import org.eclipse.jdt.core.dom.ModuleDirective;
import org.eclipse.jdt.core.dom.NormalAnnotation;
import org.eclipse.jdt.core.dom.PackageDeclaration;
+import org.eclipse.jdt.core.dom.RecordDeclaration;
import org.eclipse.jdt.core.dom.ReturnStatement;
import org.eclipse.jdt.core.dom.SingleMemberAnnotation;
import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
@@ -279,13 +280,22 @@ public class LineBreaksPreparator extends ASTVisitor {
}
@Override
+ public boolean visit(RecordDeclaration node) {
+ handleBracedCode(node, node.getName(), this.options.brace_position_for_record_declaration,
+ this.options.indent_body_declarations_compare_to_record_header);
+ handleBodyDeclarations(node.bodyDeclarations());
+ return true;
+ }
+
+ @Override
public boolean visit(MethodDeclaration node) {
this.declarationModifierVisited = false;
if (node.getBody() == null)
return true;
- String bracePosition = node.isConstructor() ? this.options.brace_position_for_constructor_declaration
- : this.options.brace_position_for_method_declaration;
+ String bracePosition = node.isCompactConstructor() ? this.options.brace_position_for_record_constructor
+ : node.isConstructor() ? this.options.brace_position_for_constructor_declaration
+ : this.options.brace_position_for_method_declaration;
handleBracedCode(node.getBody(), null, bracePosition, this.options.indent_statements_compare_to_body,
this.options.blank_lines_at_beginning_of_method_body, this.options.blank_lines_at_end_of_method_body);
diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/OneLineEnforcer.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/OneLineEnforcer.java
index 9b2671a09c..d3638545ff 100644
--- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/OneLineEnforcer.java
+++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/OneLineEnforcer.java
@@ -40,6 +40,7 @@ import org.eclipse.jdt.core.dom.LambdaExpression;
import org.eclipse.jdt.core.dom.MethodDeclaration;
import org.eclipse.jdt.core.dom.ModuleDeclaration;
import org.eclipse.jdt.core.dom.PrimitiveType;
+import org.eclipse.jdt.core.dom.RecordDeclaration;
import org.eclipse.jdt.core.dom.ReturnStatement;
import org.eclipse.jdt.core.dom.Statement;
import org.eclipse.jdt.core.dom.ThrowStatement;
@@ -86,6 +87,12 @@ public class OneLineEnforcer extends ASTVisitor {
}
@Override
+ public void endVisit(RecordDeclaration node) {
+ tryKeepOnOneLine(node, node.getName(), node.bodyDeclarations(),
+ this.options.keep_record_declaration_on_one_line);
+ }
+
+ @Override
public void endVisit(AnonymousClassDeclaration node) {
if (node.getParent() instanceof EnumConstantDeclaration) {
tryKeepOnOneLine(node, null, node.bodyDeclarations(),
@@ -104,9 +111,10 @@ public class OneLineEnforcer extends ASTVisitor {
return; // this is a fake block created by parsing in statements mode
String oneLineOption;
if (parent instanceof MethodDeclaration) {
- oneLineOption = this.options.keep_method_body_on_one_line;
+ MethodDeclaration method = (MethodDeclaration) parent;
+ oneLineOption = method.isCompactConstructor() ? this.options.keep_record_constructor_on_one_line
+ : this.options.keep_method_body_on_one_line;
if (this.options.keep_simple_getter_setter_on_one_line) {
- MethodDeclaration method = (MethodDeclaration) parent;
String name = method.getName().getIdentifier();
Type returnType = method.getReturnType2();
boolean returnsVoid = returnType instanceof PrimitiveType
diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/SpacePreparator.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/SpacePreparator.java
index 174eb37562..22d0eb7495 100644
--- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/SpacePreparator.java
+++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/SpacePreparator.java
@@ -79,6 +79,7 @@ import org.eclipse.jdt.core.dom.ParenthesizedExpression;
import org.eclipse.jdt.core.dom.PostfixExpression;
import org.eclipse.jdt.core.dom.PrefixExpression;
import org.eclipse.jdt.core.dom.ProvidesDirective;
+import org.eclipse.jdt.core.dom.RecordDeclaration;
import org.eclipse.jdt.core.dom.ReturnStatement;
import org.eclipse.jdt.core.dom.SingleMemberAnnotation;
import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
@@ -245,63 +246,102 @@ public class SpacePreparator extends ASTVisitor {
}
@Override
- public boolean visit(MethodDeclaration node) {
+ public boolean visit(RecordDeclaration node) {
handleToken(node.getName(), TokenNameIdentifier, true, false);
- boolean spaceBeforeOpenParen = node.isConstructor()
- ? this.options.insert_space_before_opening_paren_in_constructor_declaration
- : this.options.insert_space_before_opening_paren_in_method_declaration;
- boolean spaceAfterOpenParen = node.isConstructor()
- ? this.options.insert_space_after_opening_paren_in_constructor_declaration
- : this.options.insert_space_after_opening_paren_in_method_declaration;
- boolean spaceBetweenEmptyParens = node.isConstructor()
- ? this.options.insert_space_between_empty_parens_in_constructor_declaration
- : this.options.insert_space_between_empty_parens_in_method_declaration;
- if (handleEmptyParens(node.getName(), spaceBetweenEmptyParens)) {
- handleToken(node.getName(), TokenNameLPAREN, spaceBeforeOpenParen, false);
+ List<TypeParameter> typeParameters = node.typeParameters();
+ handleTypeParameters(typeParameters);
+
+ handleToken(node.getName(), TokenNameLBRACE,
+ this.options.insert_space_before_opening_brace_in_record_declaration, false);
+ List<Type> superInterfaces = node.superInterfaceTypes();
+ if (!superInterfaces.isEmpty()) {
+ handleTokenBefore(superInterfaces.get(0), TokenNameimplements, true, true);
+ handleCommas(superInterfaces, this.options.insert_space_before_comma_in_superinterfaces,
+ this.options.insert_space_after_comma_in_superinterfaces);
+ }
+
+ List<SingleVariableDeclaration> components = node.recordComponents();
+ if (handleEmptyParens(node, this.options.insert_space_between_empty_parens_in_constructor_declaration)) {
+ handleToken(node, TokenNameLPAREN,
+ this.options.insert_space_before_opening_paren_in_record_declaration, false);
} else {
- handleToken(node.getName(), TokenNameLPAREN, spaceBeforeOpenParen, spaceAfterOpenParen);
-
- boolean spaceBeforeCloseParen = node.isConstructor()
- ? this.options.insert_space_before_closing_paren_in_constructor_declaration
- : this.options.insert_space_before_closing_paren_in_method_declaration;
- if (spaceBeforeCloseParen) {
- List<SingleVariableDeclaration> params = node.parameters();
- ASTNode beforeBrace = params.isEmpty() ? node.getName() : params.get(params.size() - 1);
- handleTokenAfter(beforeBrace, TokenNameRPAREN, true, false);
+ handleToken(node, TokenNameLPAREN,
+ this.options.insert_space_before_opening_paren_in_record_declaration,
+ this.options.insert_space_after_opening_paren_in_record_declaration);
+
+ if (this.options.insert_space_before_closing_paren_in_record_declaration) {
+ ASTNode nodeBeforeBrace = components.isEmpty() ? node.getName() : components.get(components.size() - 1);
+ handleTokenAfter(nodeBeforeBrace, TokenNameRPAREN, true, false);
+ }
+ }
+ handleCommas(components, this.options.insert_space_before_comma_in_record_components,
+ this.options.insert_space_after_comma_in_record_components);
+ return true;
+ }
+
+ @Override
+ public boolean visit(MethodDeclaration node) {
+ handleToken(node.getName(), TokenNameIdentifier, true, false);
+
+ List<SingleVariableDeclaration> params = node.parameters();
+ if (!node.isCompactConstructor()) {
+ boolean beforeOpenParen = node.isConstructor()
+ ? this.options.insert_space_before_opening_paren_in_constructor_declaration
+ : this.options.insert_space_before_opening_paren_in_method_declaration;
+ boolean afterOpenParen = node.isConstructor()
+ ? this.options.insert_space_after_opening_paren_in_constructor_declaration
+ : this.options.insert_space_after_opening_paren_in_method_declaration;
+ boolean betweenEmptyParens = node.isConstructor()
+ ? this.options.insert_space_between_empty_parens_in_constructor_declaration
+ : this.options.insert_space_between_empty_parens_in_method_declaration;
+ if (handleEmptyParens(node.getName(), betweenEmptyParens)) {
+ handleToken(node.getName(), TokenNameLPAREN, beforeOpenParen, false);
+ } else {
+ handleToken(node.getName(), TokenNameLPAREN, beforeOpenParen, afterOpenParen);
+
+ boolean beforeCloseParen = node.isConstructor()
+ ? this.options.insert_space_before_closing_paren_in_constructor_declaration
+ : this.options.insert_space_before_closing_paren_in_method_declaration;
+ if (beforeCloseParen) {
+ ASTNode nodeBeforeBrace = params.isEmpty() ? node.getName() : params.get(params.size() - 1);
+ handleTokenAfter(nodeBeforeBrace, TokenNameRPAREN, true, false);
+ }
+ }
+
+ boolean beforeComma = node.isConstructor()
+ ? this.options.insert_space_before_comma_in_constructor_declaration_parameters
+ : this.options.insert_space_before_comma_in_method_declaration_parameters;
+ boolean afterComma = node.isConstructor()
+ ? this.options.insert_space_after_comma_in_constructor_declaration_parameters
+ : this.options.insert_space_after_comma_in_method_declaration_parameters;
+ if (node.getReceiverType() != null) {
+ params = new ArrayList<>(params);
+ params.add(0, null); // space for explicit receiver, null OK - first value not read in handleCommas
}
+ handleCommas(params, beforeComma, afterComma);
}
- if ((node.isConstructor() ? this.options.insert_space_before_opening_brace_in_constructor_declaration
- : this.options.insert_space_before_opening_brace_in_method_declaration) && node.getBody() != null)
+ boolean beforeOpeningBrace = node.isCompactConstructor()
+ ? this.options.insert_space_before_opening_brace_in_record_constructor
+ : node.isConstructor() ? this.options.insert_space_before_opening_brace_in_constructor_declaration
+ : this.options.insert_space_before_opening_brace_in_method_declaration;
+ if (beforeOpeningBrace && node.getBody() != null)
this.tm.firstTokenIn(node.getBody(), TokenNameLBRACE).spaceBefore();
if (node.getReceiverType() != null)
this.tm.lastTokenIn(node.getReceiverType(), -1).spaceAfter();
- boolean beforeComma = node.isConstructor()
- ? this.options.insert_space_before_comma_in_constructor_declaration_parameters
- : this.options.insert_space_before_comma_in_method_declaration_parameters;
- boolean afterComma = node.isConstructor()
- ? this.options.insert_space_after_comma_in_constructor_declaration_parameters
- : this.options.insert_space_after_comma_in_method_declaration_parameters;
- List<SingleVariableDeclaration> params = node.parameters();
- if (node.getReceiverType() != null) {
- params = new ArrayList<>(params);
- params.add(0, null); // space for explicit receiver, null OK - first value not read in handleCommas
- }
- handleCommas(params, beforeComma, afterComma);
-
List<Type> thrownExceptionTypes = node.thrownExceptionTypes();
if (!thrownExceptionTypes.isEmpty()) {
- this.tm.firstTokenBefore(thrownExceptionTypes.get(0), TokenNamethrows).spaceBefore();
+ handleTokenBefore(thrownExceptionTypes.get(0), TokenNamethrows, true, false);
- beforeComma = node.isConstructor()
+ boolean beforeComma = node.isConstructor()
? this.options.insert_space_before_comma_in_constructor_declaration_throws
- : this.options.insert_space_before_comma_in_method_declaration_throws;
- afterComma = node.isConstructor()
+ : this.options.insert_space_before_comma_in_method_declaration_throws;
+ boolean afterComma = node.isConstructor()
? this.options.insert_space_after_comma_in_constructor_declaration_throws
- : this.options.insert_space_after_comma_in_method_declaration_throws;
+ : this.options.insert_space_after_comma_in_method_declaration_throws;
handleCommas(thrownExceptionTypes, beforeComma, afterComma);
}
diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/linewrap/WrapPreparator.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/linewrap/WrapPreparator.java
index a67b5e0074..515c3f5814 100644
--- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/linewrap/WrapPreparator.java
+++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/linewrap/WrapPreparator.java
@@ -85,6 +85,7 @@ import org.eclipse.jdt.core.dom.OpensDirective;
import org.eclipse.jdt.core.dom.ParameterizedType;
import org.eclipse.jdt.core.dom.ProvidesDirective;
import org.eclipse.jdt.core.dom.QualifiedName;
+import org.eclipse.jdt.core.dom.RecordDeclaration;
import org.eclipse.jdt.core.dom.SingleMemberAnnotation;
import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
import org.eclipse.jdt.core.dom.Statement;
@@ -322,11 +323,37 @@ public class WrapPreparator extends ASTVisitor {
}
@Override
- public boolean visit(MethodDeclaration node) {
+ public boolean visit(RecordDeclaration node) {
int lParen = this.tm.firstIndexAfter(node.getName(), TokenNameLPAREN);
- int rParen = node.getBody() == null ? this.tm.lastIndexIn(node, TokenNameRPAREN)
- : this.tm.firstIndexBefore(node.getBody(), TokenNameRPAREN);
- handleParenthesesPositions(lParen, rParen, this.options.parenthesis_positions_in_method_declaration);
+ List<SingleVariableDeclaration> components = node.recordComponents();
+ int rParen = this.tm.firstIndexAfter(
+ components.isEmpty() ? node.getName() : components.get(components.size() - 1), TokenNameRPAREN);
+ handleParenthesesPositions(lParen, rParen, this.options.parenthesis_positions_in_record_declaration);
+
+ if (!components.isEmpty()) {
+ int wrappingOption = this.options.alignment_for_record_components;
+ this.wrapGroupEnd = this.tm.lastIndexIn(components.get(components.size() - 1), -1);
+ handleArguments(components, wrappingOption);
+ }
+
+ List<Type> superInterfaceTypes = node.superInterfaceTypes();
+ if (!superInterfaceTypes.isEmpty()) {
+ this.wrapParentIndex = this.tm.lastIndexIn(node.getName(), -1);
+ this.wrapIndexes.add(this.tm.firstIndexBefore(superInterfaceTypes.get(0), TokenNameimplements));
+ prepareElementsList(superInterfaceTypes, TokenNameCOMMA, -1);
+ handleWrap(this.options.alignment_for_superinterfaces_in_record_declaration, PREFERRED);
+ }
+ return true;
+ }
+
+ @Override
+ public boolean visit(MethodDeclaration node) {
+ if (!node.isCompactConstructor()) {
+ int lParen = this.tm.firstIndexAfter(node.getName(), TokenNameLPAREN);
+ int rParen = node.getBody() == null ? this.tm.lastIndexIn(node, TokenNameRPAREN)
+ : this.tm.firstIndexBefore(node.getBody(), TokenNameRPAREN);
+ handleParenthesesPositions(lParen, rParen, this.options.parenthesis_positions_in_method_declaration);
+ }
List<SingleVariableDeclaration> parameters = node.parameters();
Type receiverType = node.getReceiverType();
@@ -346,7 +373,7 @@ public class WrapPreparator extends ASTVisitor {
? this.options.alignment_for_throws_clause_in_constructor_declaration
: this.options.alignment_for_throws_clause_in_method_declaration;
if ((wrappingOption & Alignment.M_INDENT_ON_COLUMN) == 0)
- this.wrapParentIndex = lParen;
+ this.wrapParentIndex = this.tm.firstIndexAfter(node.getName(), TokenNameLPAREN);
prepareElementsList(exceptionTypes, TokenNameCOMMA, TokenNameRPAREN);
// instead of the first exception type, wrap the "throws" token
this.wrapIndexes.set(0, this.tm.firstIndexBefore(exceptionTypes.get(0), TokenNamethrows));

Back to the top