Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 574734 - [17] Refactor rename is not working for type reference in switch pattern expression
Summary: [17] Refactor rename is not working for type reference in switch pattern expr...
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.21   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: BETA J17   Edit
Assignee: Sarika Sinha CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 573941
Blocks: 572061
  Show dependency tree
 
Reported: 2021-07-08 08:24 EDT by Vikas Chandra CLA
Modified: 2021-08-12 03:40 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vikas Chandra CLA 2021-07-08 08:24:36 EDT
1) Copy paste this code in Java 17 project ( enable preview)
public class X {
public static void main(String[] args) {
foo(Integer.valueOf(5));
foo(new Object());
}
private static void foo(Object o) {
 switch (o) {
	case Integer i     -> System.out.println("Integer:" + i);
	case String /*here*/str && str.length()>0    -> System.out.println("String:" + str + str);
	default       -> System.out.println("Object" + o);
 	}
}
}

2) Select str
3) Refactor rename to str2

Expectation : the other 3 reference are renamed
Result: nothing happens

Please note that selecting str and pressing control-shift-G gives 3 references 
Same problem with  pattern switch too.
Comment 1 Kalyan Prasad Tatavarthi CLA 2021-07-29 07:39:14 EDT
Waiting on ASTNode changes going into JDT Core. Will have test once these changes go in.
Comment 2 Kalyan Prasad Tatavarthi CLA 2021-08-12 03:34:44 EDT
Fixed as a result of fixes for bug 573941