Repository: checkstyle/checkstyle (Java)

Issue:
Add Check Support for Java 21 Record Pattern : MethodParamPad
child of #14890 

I have read check documentation: https://checkstyle.org/checks/whitespace/methodparampad.html#MethodParamPad
I have downloaded the latest checkstyle from: https://checkstyle.org/cmdline.html#Download_and_Run
I have executed the cli and showed it below, as cli describes the problem better than 1,000 words

```
PS D:\CS\test> javac src/RecordPatterns.java
PS D:\CS\test> cat src/RecordPatterns.java
import java.util.List;

public class RecordPatterns {
    class A { }
    sealed interface I permits C, D { }
    final class C implements I { }
    final class D implements I { }
    record Pair<T> (T x, T y) { } // violation

    void test() {
        C c = new C();
        D d = new D();

        Pair<I> p2 = new Pair<>(c, d);

        switch (p2) {
            case Pair (I i, C _) -> System.out.println("Pair (C|D, C)");    // expected violation
            case Pair(I i, D j) -> System.out.println("Pair (C|D, D)");
        }

    }
}
PS D:\CS\test> cat config.xml
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
          "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
          "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">

<module name="Checker">
    <property name="charset" value="UTF-8"/>
 <module name="TreeWalker">
    <module name="MethodParamPad"/>
 </module>
</module>
PS D:\CS\test>  java  -jar checkstyle-10.14.2-all.jar -c config.xml  src/RecordPatterns.java
Starting audit...
[ERROR] D:\CS\test\src\RecordPatterns.java:8:20: '(' is preceded with whitespace. [MethodParamPad]
Audit done.
Checkstyle ends with 1 errors.
```

---

**Describe what you expect in detail.**

I want a violation on the record pattern


---




Discussion:
We need to make sure that we update the docs to mention that we check record deconstruction patterns.



Patch:
diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/MethodParamPadCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/MethodParamPadCheck.java
index 32ed4798d05..7c276b14654 100644
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/MethodParamPadCheck.java
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/MethodParamPadCheck.java
@@ -31,7 +31,7 @@
 /**
  * <p>
  * Checks the padding between the identifier of a method definition,
- * constructor definition, method call, or constructor invocation;
+ * constructor definition, method call, constructor invocation, record, or record pattern;
  * and the left parenthesis of the parameter list.
  * That is, if the identifier and left parenthesis are on the same line,
  * checks whether a space is required immediately after the identifier or
@@ -72,7 +72,9 @@
  * <a href="https://checkstyle.org/apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ENUM_CONSTANT_DEF">
  * ENUM_CONSTANT_DEF</a>,
  * <a href="https://checkstyle.org/apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#RECORD_DEF">
- * RECORD_DEF</a>.
+ * RECORD_DEF</a>,
+ * <a href="https://checkstyle.org/apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#RECORD_PATTERN_DEF">
+ * RECORD_PATTERN_DEF</a>.
  * </li>
  * </ul>
  * <p>
@@ -142,6 +144,7 @@ public int[] getAcceptableTokens() {
             TokenTypes.SUPER_CTOR_CALL,
             TokenTypes.ENUM_CONSTANT_DEF,
             TokenTypes.RECORD_DEF,
+            TokenTypes.RECORD_PATTERN_DEF,
         };
     }
 
diff --git a/src/main/resources/com/puppycrawl/tools/checkstyle/meta/checks/whitespace/MethodParamPadCheck.xml b/src/main/resources/com/puppycrawl/tools/checkstyle/meta/checks/whitespace/MethodParamPadCheck.xml
index a87b5812560..76e640564dc 100644
--- a/src/main/resources/com/puppycrawl/tools/checkstyle/meta/checks/whitespace/MethodParamPadCheck.xml
+++ b/src/main/resources/com/puppycrawl/tools/checkstyle/meta/checks/whitespace/MethodParamPadCheck.xml
@@ -6,7 +6,7 @@
              parent="com.puppycrawl.tools.checkstyle.TreeWalker">
          <description>&lt;p&gt;
  Checks the padding between the identifier of a method definition,
- constructor definition, method call, or constructor invocation;
+ constructor definition, method call, constructor invocation, record, or record pattern;
  and the left parenthesis of the parameter list.
  That is, if the identifier and left parenthesis are on the same line,
  checks whether a space is required immediately after the identifier or
@@ -25,7 +25,7 @@
                       type="com.puppycrawl.tools.checkstyle.checks.whitespace.PadOption">
                <description>Specify policy on how to pad method parameter.</description>
             </property>
-            <property default-value="CTOR_DEF,CTOR_CALL,LITERAL_NEW,METHOD_CALL,METHOD_DEF,SUPER_CTOR_CALL,ENUM_CONSTANT_DEF,RECORD_DEF"
+            <property default-value="CTOR_DEF,CTOR_CALL,LITERAL_NEW,METHOD_CALL,METHOD_DEF,SUPER_CTOR_CALL,ENUM_CONSTANT_DEF,RECORD_DEF,RECORD_PATTERN_DEF"
                       name="tokens"
                       type="java.lang.String[]"
                       validation-type="tokenSet">
diff --git a/src/main/resources/google_checks.xml b/src/main/resources/google_checks.xml
index f0b64441793..5db93e0e24e 100644
--- a/src/main/resources/google_checks.xml
+++ b/src/main/resources/google_checks.xml
@@ -280,7 +280,7 @@
     <module name="MethodParamPad">
       <property name="tokens"
                value="CTOR_DEF, LITERAL_NEW, METHOD_CALL, METHOD_DEF, CTOR_CALL,
-                    SUPER_CTOR_CALL, ENUM_CONSTANT_DEF, RECORD_DEF"/>
+                    SUPER_CTOR_CALL, ENUM_CONSTANT_DEF, RECORD_DEF, RECORD_PATTERN_DEF"/>
     </module>
     <module name="NoWhitespaceBefore">
       <property name="tokens"
diff --git a/src/xdocs/checks.xml b/src/xdocs/checks.xml
index 48e72513d1a..b0281452876 100644
--- a/src/xdocs/checks.xml
+++ b/src/xdocs/checks.xml
@@ -727,8 +727,9 @@
             </td>
             <td>
               Checks the padding between the identifier of a method definition,
-              constructor definition, method call, or constructor invocation;
-            and the left parenthesis of the parameter list.</td>
+              constructor definition, method call, constructor invocation,
+              record, or record pattern;
+              and the left parenthesis of the parameter list.</td>
           </tr>
           <tr>
             <td><a href="checks/naming/methodtypeparametername.html#MethodTypeParameterName">
diff --git a/src/xdocs/checks/whitespace/index.xml b/src/xdocs/checks/whitespace/index.xml
index 8477864af94..b2f3eafcfa6 100644
--- a/src/xdocs/checks/whitespace/index.xml
+++ b/src/xdocs/checks/whitespace/index.xml
@@ -74,7 +74,8 @@
             </td>
             <td>
               Checks the padding between the identifier of a method definition,
-              constructor definition, method call, or constructor invocation;
+              constructor definition, method call,
+              constructor invocation, record, or record pattern;
               and the left parenthesis of the parameter list.
             </td>
           </tr>
diff --git a/src/xdocs/checks/whitespace/methodparampad.xml b/src/xdocs/checks/whitespace/methodparampad.xml
index 0d486fb3a25..20d7ddb8e83 100644
--- a/src/xdocs/checks/whitespace/methodparampad.xml
+++ b/src/xdocs/checks/whitespace/methodparampad.xml
@@ -11,8 +11,8 @@
       <subsection name="Description" id="Description">
         <p>
           Checks the padding between the identifier of a method definition,
-          constructor definition, method call, or constructor invocation; and
-          the left parenthesis of the parameter list. That is, if the
+          constructor definition, method call, constructor invocation, record, or record pattern;
+          and the left parenthesis of the parameter list. That is, if the
           identifier and left parenthesis are on the same line, checks whether
           a space is required immediately after the identifier or such a space
           is forbidden. If they are not on the same line, reports a violation,
@@ -66,6 +66,8 @@
                     ENUM_CONSTANT_DEF</a>
                 , <a href="../../apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#RECORD_DEF">
                     RECORD_DEF</a>
+                , <a href="../../apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#RECORD_PATTERN_DEF">
+                    RECORD_PATTERN_DEF</a>
                   .
               </td>
               <td>
@@ -85,6 +87,8 @@
                     ENUM_CONSTANT_DEF</a>
                 , <a href="../../apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#RECORD_DEF">
                     RECORD_DEF</a>
+                , <a href="../../apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#RECORD_PATTERN_DEF">
+                    RECORD_PATTERN_DEF</a>
                   .
               </td>
               <td>3.4</td>
diff --git a/src/xdocs/checks/whitespace/methodparampad.xml.template b/src/xdocs/checks/whitespace/methodparampad.xml.template
index 756c8112dce..d14f28c312d 100644
--- a/src/xdocs/checks/whitespace/methodparampad.xml.template
+++ b/src/xdocs/checks/whitespace/methodparampad.xml.template
@@ -11,8 +11,8 @@
       <subsection name="Description" id="Description">
         <p>
           Checks the padding between the identifier of a method definition,
-          constructor definition, method call, or constructor invocation; and
-          the left parenthesis of the parameter list. That is, if the
+          constructor definition, method call, constructor invocation, record, or record pattern;
+          and the left parenthesis of the parameter list. That is, if the
           identifier and left parenthesis are on the same line, checks whether
           a space is required immediately after the identifier or such a space
           is forbidden. If they are not on the same line, reports a violation,


Test patch:
diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/MethodParamPadCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/MethodParamPadCheckTest.java
index 7a9e5e45484..1c3b4ae67ec 100644
--- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/MethodParamPadCheckTest.java
+++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/MethodParamPadCheckTest.java
@@ -191,6 +191,7 @@ public void testGetAcceptableTokens() {
             TokenTypes.SUPER_CTOR_CALL,
             TokenTypes.ENUM_CONSTANT_DEF,
             TokenTypes.RECORD_DEF,
+            TokenTypes.RECORD_PATTERN_DEF,
         };
         assertWithMessage("Default acceptable tokens are invalid")
             .that(actual)
@@ -224,4 +225,38 @@ public void testTrimOptionProperty() throws Exception {
         verifyWithInlineConfigParser(
                 getPath("InputMethodParamPadSetOptionTrim.java"), expected);
     }
+
+    @Test
+    public void testRecordPattern() throws Exception {
+        final String[] expected = {
+            "19:41: " + getCheckMessage(MSG_WS_PRECEDED, "("),
+            "22:42: " + getCheckMessage(MSG_WS_PRECEDED, "("),
+            "22:50: " + getCheckMessage(MSG_WS_PRECEDED, "("),
+            "31:31: " + getCheckMessage(MSG_WS_PRECEDED, "("),
+            "31:39: " + getCheckMessage(MSG_WS_PRECEDED, "("),
+            "36:31: " + getCheckMessage(MSG_WS_PRECEDED, "("),
+            "57:41: " + getCheckMessage(MSG_WS_PRECEDED, "("),
+            "57:49: " + getCheckMessage(MSG_WS_PRECEDED, "("),
+        };
+        verifyWithInlineConfigParser(
+                getNonCompilablePath("InputMethodParamPadCheckRecordPattern.java"), expected);
+    }
+
+    @Test
+    public void testRecordPattern2() throws Exception {
+        final String[] expected = {
+            "23:40: " + getCheckMessage(MSG_WS_NOT_PRECEDED, "("),
+            "23:46: " + getCheckMessage(MSG_WS_NOT_PRECEDED, "("),
+            "31:23: " + getCheckMessage(MSG_WS_NOT_PRECEDED, "("),
+            "36:17: " + getCheckMessage(MSG_LINE_PREVIOUS, "("),
+            "39:17: " + getCheckMessage(MSG_LINE_PREVIOUS, "("),
+            "40:26: " + getCheckMessage(MSG_LINE_PREVIOUS, "("),
+            "44:17: " + getCheckMessage(MSG_LINE_PREVIOUS, "("),
+            "46:22: " + getCheckMessage(MSG_LINE_PREVIOUS, "("),
+            "50:40: " + getCheckMessage(MSG_WS_NOT_PRECEDED, "("),
+            "50:47: " + getCheckMessage(MSG_WS_NOT_PRECEDED, "("),
+        };
+        verifyWithInlineConfigParser(
+                getNonCompilablePath("InputMethodParamPadCheckRecordPattern2.java"), expected);
+    }
 }
diff --git a/src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/checks/whitespace/methodparampad/InputMethodParamPadCheckRecordPattern.java b/src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/checks/whitespace/methodparampad/InputMethodParamPadCheckRecordPattern.java
new file mode 100644
index 00000000000..7e0da6ffdd5
--- /dev/null
+++ b/src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/checks/whitespace/methodparampad/InputMethodParamPadCheckRecordPattern.java
@@ -0,0 +1,65 @@
+/*
+MethodParamPad
+allowLineBreaks = true
+option = (default)nospace
+tokens = (default)CTOR_DEF, LITERAL_NEW, METHOD_CALL, METHOD_DEF, SUPER_CTOR_CALL, \
+         ENUM_CONSTANT_DEF, RECORD_DEF, RECORD_PATTERN_DEF
+
+
+*/
+
+//non-compiled with javac: Compilable with Java21
+package com.puppycrawl.tools.checkstyle.checks.whitespace.methodparampad;
+
+public class InputMethodParamPadCheckRecordPattern {
+
+    void test(Object obj) {
+
+        // violation below, ''(' is preceded with whitespace'
+        if (obj instanceof ColoredPoint (Point p, String s)) {
+        }
+
+        if (obj instanceof ColoredPoint  (Point  ( int x, int y), String s)) {}
+        // 2 violations above:
+        //              ''(' is preceded with whitespace'
+        //              ''(' is preceded with whitespace'
+
+         if (obj instanceof ColoredPoint(Point(int x, int y), _)) {
+        }
+
+        switch (obj) {
+            case ColoredPoint (Point  ( int x, int y), String s) -> {}
+            // 2 violations above:
+            //              ''(' is preceded with whitespace'
+            //              ''(' is preceded with whitespace'
+            // violation below, ''(' is preceded with whitespace'
+            case ColoredPoint (Point p, String s) -> {}
+            case Point(int x, int y) -> {}
+            default -> {}
+        }
+
+        boolean b = obj instanceof ColoredPoint
+                (Point p, String s); // ok, because allow line breaks
+
+        boolean c = obj instanceof ColoredPoint
+                (Point   // ok, because allow line breaks
+                         (int x, int y), // ok, because allow line breaks
+                 String s);
+
+        boolean cc = obj instanceof ColoredPoint
+                (  // ok, because allow line breaks
+                    Point
+                     ( // ok, because allow line breaks
+                         int x, int y),
+                 String s);
+
+        if (obj instanceof ColoredPoint( Point( int x, int y ), _)) {}
+        if (obj instanceof ColoredPoint ( Point ( int x, int y), _)) {}
+         // 2 violations above:
+         //              ''(' is preceded with whitespace'
+         //              ''(' is preceded with whitespace'
+    }
+
+    record ColoredPoint(Point p, String s) {}
+    record Point(int x, int y) {}
+}
diff --git a/src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/checks/whitespace/methodparampad/InputMethodParamPadCheckRecordPattern2.java b/src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/checks/whitespace/methodparampad/InputMethodParamPadCheckRecordPattern2.java
new file mode 100644
index 00000000000..edaf51bc9d3
--- /dev/null
+++ b/src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/checks/whitespace/methodparampad/InputMethodParamPadCheckRecordPattern2.java
@@ -0,0 +1,59 @@
+/*
+MethodParamPad
+allowLineBreaks = false
+option = space
+tokens = (default)CTOR_DEF, LITERAL_NEW, METHOD_CALL, METHOD_DEF, SUPER_CTOR_CALL, \
+         ENUM_CONSTANT_DEF, RECORD_DEF, RECORD_PATTERN_DEF
+
+
+*/
+
+//non-compiled with javac: Compilable with Java21
+package com.puppycrawl.tools.checkstyle.checks.whitespace.methodparampad;
+
+public class InputMethodParamPadCheckRecordPattern2 {
+
+    void test (Object obj) {
+
+
+        if (obj instanceof ColoredPoint (Point p, String s)) {
+        }
+
+        if (obj instanceof ColoredPoint  (Point  ( int x, int y), String s)) {}
+        if (obj instanceof ColoredPoint(Point(int x, int y), _)) {}
+         // 2 violations above:
+         //              ''(' is not preceded with whitespace'
+         //              ''(' is not preceded with whitespace'
+
+        switch (obj) {
+            case ColoredPoint (Point  ( int x, int y), String s) -> {}
+            case ColoredPoint (Point p, String s) -> {}
+            case Point(int x, int y) -> {} // violation, ''(' is not preceded with whitespace'
+            default -> {}
+        }
+
+        boolean b = obj instanceof ColoredPoint
+                (Point p, String s); // violation, ''(' should be on the previous line'
+
+        boolean c = obj instanceof ColoredPoint
+                (Point // violation, ''(' should be on the previous line'
+                         (int x, int y), // violation, ''(' should be on the previous line'
+                 String s);
+
+        boolean cc = obj instanceof ColoredPoint
+                ( // violation, ''(' should be on the previous line'
+                    Point
+                     ( // violation, ''(' should be on the previous line'
+                         int x, int y),
+                 String s);
+
+        if (obj instanceof ColoredPoint( Point( int x, int y ), _)) {}
+         // 2 violations above:
+         //              ''(' is not preceded with whitespace'
+         //              ''(' is not preceded with whitespace'
+        if (obj instanceof ColoredPoint ( Point ( int x, int y), _)) {}
+    }
+
+    record ColoredPoint (Point p, String s) {}
+    record Point (int x, int y) {}
+}
diff --git a/src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/checks/whitespace/methodparampad/InputMethodParamPadRecords.java b/src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/checks/whitespace/methodparampad/InputMethodParamPadRecords.java
index c723a422bfa..98dffd4d2fe 100644
--- a/src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/checks/whitespace/methodparampad/InputMethodParamPadRecords.java
+++ b/src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/checks/whitespace/methodparampad/InputMethodParamPadRecords.java
@@ -3,7 +3,7 @@
 allowLineBreaks = true
 option = (default)nospace
 tokens = (default)CTOR_DEF, LITERAL_NEW, METHOD_CALL, METHOD_DEF, SUPER_CTOR_CALL, \
-         ENUM_CONSTANT_DEF, RECORD_DEF
+         ENUM_CONSTANT_DEF, RECORD_DEF, RECORD_PATTERN_DEF
 
 
 */
diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/methodparampad/InputMethodParamPad.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/methodparampad/InputMethodParamPad.java
index bda81bdf9ee..dea9af60159 100644
--- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/methodparampad/InputMethodParamPad.java
+++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/methodparampad/InputMethodParamPad.java
@@ -3,7 +3,7 @@
 allowLineBreaks = (default)false
 option = (default)nospace
 tokens = (default)CTOR_DEF, LITERAL_NEW, METHOD_CALL, METHOD_DEF, SUPER_CTOR_CALL, \
-         ENUM_CONSTANT_DEF, RECORD_DEF
+         ENUM_CONSTANT_DEF, RECORD_DEF, RECORD_PATTERN_DEF
 
 
 */
diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/methodparampad/InputMethodParamPad2.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/methodparampad/InputMethodParamPad2.java
index 63ae20d79a0..4eab663c7ab 100644
--- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/methodparampad/InputMethodParamPad2.java
+++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/methodparampad/InputMethodParamPad2.java
@@ -3,7 +3,7 @@
 allowLineBreaks = true
 option = (default)nospace
 tokens = (default)CTOR_DEF, LITERAL_NEW, METHOD_CALL, METHOD_DEF, SUPER_CTOR_CALL, \
-         ENUM_CONSTANT_DEF, RECORD_DEF
+         ENUM_CONSTANT_DEF, RECORD_DEF, RECORD_PATTERN_DEF
 
 
 */
diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/methodparampad/InputMethodParamPad3.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/methodparampad/InputMethodParamPad3.java
index 76ae1a8864a..564444382d9 100644
--- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/methodparampad/InputMethodParamPad3.java
+++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/methodparampad/InputMethodParamPad3.java
@@ -3,7 +3,7 @@
 allowLineBreaks = (default)false
 option = space
 tokens = (default)CTOR_DEF, LITERAL_NEW, METHOD_CALL, METHOD_DEF, SUPER_CTOR_CALL, \
-         ENUM_CONSTANT_DEF, RECORD_DEF
+         ENUM_CONSTANT_DEF, RECORD_DEF, RECORD_PATTERN_DEF
 
 
 */
diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/methodparampad/InputMethodParamPad4.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/methodparampad/InputMethodParamPad4.java
index dcc8096295f..3a2e21084e3 100644
--- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/methodparampad/InputMethodParamPad4.java
+++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/methodparampad/InputMethodParamPad4.java
@@ -3,7 +3,7 @@
 allowLineBreaks = (default)false
 option = invalid_option
 tokens = (default)CTOR_DEF, LITERAL_NEW, METHOD_CALL, METHOD_DEF, SUPER_CTOR_CALL, \
-         ENUM_CONSTANT_DEF, RECORD_DEF
+         ENUM_CONSTANT_DEF, RECORD_DEF, RECORD_PATTERN_DEF
 
 
 */
diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/methodparampad/InputMethodParamPadCheckConstructors.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/methodparampad/InputMethodParamPadCheckConstructors.java
index 0901e395733..263aca00641 100644
--- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/methodparampad/InputMethodParamPadCheckConstructors.java
+++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/methodparampad/InputMethodParamPadCheckConstructors.java
@@ -3,7 +3,7 @@
 allowLineBreaks = true
 option = (default)nospace
 tokens = (default)CTOR_DEF, LITERAL_NEW, METHOD_CALL, METHOD_DEF, SUPER_CTOR_CALL, \
-         CTOR_CALL, ENUM_CONSTANT_DEF, RECORD_DEF
+         CTOR_CALL, ENUM_CONSTANT_DEF, RECORD_DEF, RECORD_PATTERN_DEF
 
 
 */
diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/methodparampad/InputMethodParamPadCheckWithEmoji.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/methodparampad/InputMethodParamPadCheckWithEmoji.java
index 4798176cfb6..23b07acfcb0 100644
--- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/methodparampad/InputMethodParamPadCheckWithEmoji.java
+++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/methodparampad/InputMethodParamPadCheckWithEmoji.java
@@ -3,7 +3,7 @@
 allowLineBreaks = true
 option = (default)nospace
 tokens = (default)CTOR_DEF, LITERAL_NEW, METHOD_CALL, METHOD_DEF, SUPER_CTOR_CALL, \
-         ENUM_CONSTANT_DEF, RECORD_DEF
+         ENUM_CONSTANT_DEF, RECORD_DEF,RECORD_PATTERN_DEF
 
 
 */
diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/methodparampad/InputMethodParamPadSetOptionTrim.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/methodparampad/InputMethodParamPadSetOptionTrim.java
index 8b44a726b3c..4fab931893d 100644
--- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/methodparampad/InputMethodParamPadSetOptionTrim.java
+++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/methodparampad/InputMethodParamPadSetOptionTrim.java
@@ -3,7 +3,7 @@
 allowLineBreaks = (default)false
 option = \tspace
 tokens = (default)CTOR_DEF, LITERAL_NEW, METHOD_CALL, METHOD_DEF, SUPER_CTOR_CALL, \
-         ENUM_CONSTANT_DEF, RECORD_DEF
+         ENUM_CONSTANT_DEF, RECORD_DEF, RECORD_PATTERN_DEF
 
 
 */
diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/methodparampad/InputMethodParamPadWhitespaceAround.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/methodparampad/InputMethodParamPadWhitespaceAround.java
index 1435bbb5405..f7a375a583f 100644
--- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/methodparampad/InputMethodParamPadWhitespaceAround.java
+++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/methodparampad/InputMethodParamPadWhitespaceAround.java
@@ -3,7 +3,7 @@
 allowLineBreaks = (default)false
 option = SPACE
 tokens = (default)CTOR_DEF, LITERAL_NEW, METHOD_CALL, METHOD_DEF, SUPER_CTOR_CALL, \
-         ENUM_CONSTANT_DEF, RECORD_DEF
+         ENUM_CONSTANT_DEF, RECORD_DEF, RECORD_PATTERN_DEF
 
 
 */