@@ -473,7 +473,7 @@ private NewName test() {
473473
474474 }
475475
476- // test fro varargs and generic.
476+ // test for varargs and generic.
477477 public void testRenameRecordGenVar () throws Exception {
478478 sideBySideCompare =true ;
479479 showOutputOnPass =true ;
@@ -520,6 +520,54 @@ private NewName<Integer> test() {
520520 """ ));
521521
522522 }
523+ // test for varargs and generic.
524+ public void testRenameRecordGenVarComponent () throws Exception {
525+ sideBySideCompare =true ;
526+ showOutputOnPass =true ;
527+
528+ String testCode = """
529+ package test;
530+ public record Test<G extends Number>(G... comp|onent) {
531+ public Test {
532+ assert 0 < component.length;
533+ }
534+ }
535+ """ ;
536+ TestInput splitCode = TestUtilities .splitCodeAndPos (testCode );
537+ writeFilesAndWaitForScan (src ,
538+ new File ("Test.java" , splitCode .code ()),
539+ new File ("Use.java" ,
540+ """
541+ package test;
542+ public class Use {
543+ private Test<Integer> test() {
544+ return new Test(1, 2);
545+ }
546+ }
547+ """ ));
548+ JavaRenameProperties props = new JavaRenameProperties ();
549+ performRename (src .getFileObject ("Test.java" ), splitCode .pos (), "parts" , props , true );
550+ verifyContent (src , new File ("Test.java" ,
551+ """
552+ package test;
553+ public record Test<G extends Number>(G... parts) {
554+ public Test {
555+ assert 0 < parts.length;
556+ }
557+ }
558+ """ ),
559+ new File ("Use.java" ,
560+ """
561+ package test;
562+ public class Use {
563+ private Test<Integer> test() {
564+ return new Test(1, 2);
565+ }
566+ }
567+ """ ));
568+
569+ }
570+
523571 private void performRename (FileObject source , final int absPos , final String newname , final JavaRenameProperties props , final boolean searchInComments , Problem ... expectedProblems ) throws Exception {
524572 final RenameRefactoring [] r = new RenameRefactoring [1 ];
525573 JavaSource .forFileObject (source ).runUserActionTask (new Task <CompilationController >() {
0 commit comments