This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 239984 - "Type Cast is Too Strong" hint is overzealous for numbers
Summary: "Type Cast is Too Strong" hint is overzealous for numbers
Status: RESOLVED DUPLICATE of bug 237553
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 7.4
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-04 15:31 UTC by davidje13
Modified: 2014-01-06 08:38 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description davidje13 2014-01-04 15:31:19 UTC
This code:

int a = 3;
int b = 2;
double c = a / (double) b;

triggers a hint to "remove redundant cast to double", but this obviously leads to integer division instead of floating point division, changing the answer from 1.5 to 1. Same applies to (double) a / b, (double) a / (double) b, and float too.
Comment 1 Jiri Prox 2014-01-06 08:38:14 UTC

*** This bug has been marked as a duplicate of bug 237553 ***