Bug 546072 - [13][quick fix] Assign to Local variable Quick fix can be added for Switch Expression
Summary: [13][quick fix] Assign to Local variable Quick fix can be added for Switch Ex...
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.12   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks: 545120
  Show dependency tree
 
Reported: 2019-04-02 16:14 EDT by Sarika Sinha CLA
Modified: 2020-02-17 01:12 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sarika Sinha CLA 2019-04-02 16:14:42 EDT
switch (day) {
		    case MONDAY, TUESDAY  -> 1;
		    case WEDNESDAY, THURSDAY, FRIDAY -> 2;
		    case SATURDAY, SUNDAY -> {
		    	System.out.println("End of the Week");
		    	break 3;
		    }
	    };

This leads to compiler error "Invalid expression as statement".
We can have a quick fix to assign the value of Switch expression to a local variable to fix this error.