Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 543798

Summary: [12][quick fix] exception in switch expression: no "Add throws declaration" proposal
Product: [Eclipse Project] JDT Reporter: Stephan Herrmann <stephan.herrmann>
Component: UIAssignee: Noopur Gupta <noopur_gupta>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: noopur_gupta
Version: 4.11   
Target Milestone: BETA J12   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on: 539080, 542558    
Bug Blocks: 545120    

Description Stephan Herrmann CLA 2019-01-24 14:42:04 EST
This code:

	void throwing (int i) {
		int next = switch (i) {
		case 1 -> 2;
		default -> throw new Exception();
		};
	}

only triggers a proposal "surround with try/catch",
but no proposal "Add throws declaration".
Comment 1 Noopur Gupta CLA 2019-01-25 01:17:53 EST
Should be handled once new AST is available.
Comment 2 Noopur Gupta CLA 2019-03-07 06:32:42 EST
This is working with the latest code after AST changes (bug 539080).

The "surround with try/catch" proposal results in error. Opened bug 545163.