Bug 543853 - Warn about switch over constant value
Summary: Warn about switch over constant value
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.11   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-01-25 17:56 EST by Stephan Herrmann CLA
Modified: 2019-01-25 17:56 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 Stephan Herrmann CLA 2019-01-25 17:56:51 EST
Discussed during https://git.eclipse.org/r/#/c/135120/

> What about "switch (1) { case 1 -> 2; case 2 -> 0; }"?
> Could use a constant instead of the literal.

apparently that would produce unreachable code, but even for old switch *statements* we don't report this. Could either use regular dead-code warning, or make it a special warning, but perhaps still under the same option.