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 269990 - "Replace chain of ifs with switch" hint results in compile error when the switch value is double.
Summary: "Replace chain of ifs with switch" hint results in compile error when the swi...
Status: NEW
Alias: None
Product: ide
Classification: Unclassified
Component: Code (show other bugs)
Version: 8.2
Hardware: PC Windows 10
: P3 normal (vote)
Assignee: issues@ide
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-03-05 10:52 UTC by Andie51
Modified: 2017-03-05 10:52 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
IDE log (89.74 KB, text/plain)
2017-03-05 10:52 UTC, Andie51
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andie51 2017-03-05 10:52:32 UTC
Product Version = NetBeans IDE 8.2 (Build 201609300101)
Operating System = Windows 10 version 10.0 running on amd64
Java; VM; Vendor = 1.8.0_121
Runtime = Java HotSpot(TM) 64-Bit Server VM 25.121-b13

Reproducibility: null

STEPS:
  * Open dialog Foo
  * Click on button "Click me"

ACTUAL:
  nothing happens

EXPECTED:
  message pops up

Example
   // Return recurring decimals as fractions.
    private static String formatWeight(double weight) {
        if (weight == (1.0 / 3.0)) {
            return ("\u2153");
        } else if (weight == (2.0 / 3.0)) {
            return ("\u2154");
        } else if (weight == (1.0 / 6.0)) {
            return ("\u2159");
        } else if (weight == (5.0 / 6.0)) {
            return ("\u215A");
        } else {
            return (weightFormat.format(weight));
        }
    }

NetBeans advises changing above to a switch statement, but if you do, it does not accept weight as the switch variable.
Comment 1 Andie51 2017-03-05 10:52:36 UTC
Created attachment 163769 [details]
IDE log