Bug 549327 - [13] Better recovery for Switch Expressions
Summary: [13] Better recovery for Switch Expressions
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.13   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact: Manoj N Palat CLA
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-17 00:49 EDT by Manoj N Palat CLA
Modified: 2023-08-30 03:35 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 Manoj N Palat CLA 2019-07-17 00:49:58 EDT
Better error recovery (and consequently improvised and localized error messages) would be a good step for switch expression adoption. For eg, consider the following incorrect code:
public class X {

	@SuppressWarnings("preview")
	public  static int foo(int i) {
		int yield = 100;
		int r = switch(i) {
			 case 0 : yield 100;
			 case 1 : yield yield;
			 default: yield 0;
		};
		return a yield + 1;
	}
	public static void main(String[] args) {
		System.out.println(X.foo(0));
	}
}
The error messages need to be localized to return and not percolate to SE.
Comment 1 Eclipse Genie CLA 2021-09-07 15:37:40 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 2 Jay Arthanareeswaran CLA 2021-09-08 06:47:19 EDT
Manoj, what error did you see earlier? On BETA_JAVA17, I see these two:

Syntax error on token "yield", AssignmentOperator expected after this token line 7	
Syntax error on token "yield", delete this token line 11	

Not good enough?
Comment 3 Eclipse Genie CLA 2023-08-30 03:35:08 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.