Uploaded image for project: 'SonarJava'
  1. SonarJava
  2. SONARJAVA-3455

FN in S2111 for boxed Double and Float

    Details

    • Type: False Negative
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.6
    • Component/s: Rules
    • Labels:
      None

      Description

      BigDecimal created from boxed types Float and Double are not reported, but still subject to the problem described in the rule.
      We should report them aswell.

      Double d = 0.1;
      BigDecimal bd1 = new BigDecimal(d); // FN
      BigDecimal bd2 = new BigDecimal((Double) 0.1); // FN
      
      Float f = 0.1f;
      BigDecimal bd3 = new BigDecimal(f); // FN
      BigDecimal bd4 = new BigDecimal((Float) 0.1f); // FN
      
      Object myDoubleObject = 23.5d;
      new BigDecimal((Double)myDoubleObject); // FN
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                quentin.jaquier Quentin Jaquier
                Reporter:
                quentin.jaquier Quentin Jaquier
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: