Bug 530420 - [quick fix] Suggest narrowing cast in switch statement
Summary: [quick fix] Suggest narrowing cast in switch statement
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.7.2   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-01-28 11:42 EST by Nathan Gilbert CLA
Modified: 2018-01-29 08:44 EST (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 Nathan Gilbert CLA 2018-01-28 11:42:34 EST
When switching on an expression that evaluates to a long, double, or float, an error results. This is correct.  It would be nice if Quick Fix treats the target type as int, and provided the same suggestions as for assigning to an int.

Example:
long l;
switch(l) {}
//Quick Fix: Add cast to 'int'
//Quick Fix: Change type of 'l' to 'int'
Comment 1 Jay Arthanareeswaran CLA 2018-01-29 07:38:21 EST
Moving to UI