GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [java] Improve BadComparison and rename to ComparisonWithNaN · Issue #2895 · pmd/pmd

[java] Improve BadComparison and rename to ComparisonWithNaN #2895

New issue
Copy link
New issue
Copy link
Closed
#3312
Closed
[java] Improve BadComparison and rename to ComparisonWithNaN#2895
#3312
Copy link
Labels
a:false-negativePMD doesn't flag a problematic piece of codean:enhancementAn improvement on existing features / rules
Milestone
6.36.0

Description

@oowekyala
oowekyala
opened on Nov 2, 2020
Issue body actions

Is your feature request related to a problem? Please describe.

  • The documentation of errorprone.xml/BadComparison is wrong. The problem with comparing some number to Double.NaN is not floating-point precision, it's that such a comparison always returns false. Double and Float.NaN are not even equal to themselves:
jshell> Double.NaN == Double.NaN
$1 ==> false
jshell> Double.NaN <= Double.NaN
$2 ==> false
  • As evidenced by the test above, the rule should care about comparison operators other than == and !=
  • The rule name is really vague. Consider renaming it to ComparisonWithNaN

Describe the solution you'd like Described above

Activity

  1. oowekyala
    added
    an:enhancementAn improvement on existing features / rules
    on Nov 2, 2020
  2. adangel
    added this to the 6.36.0 milestone on Jun 10, 2021
  3. adangel
    added
    a:false-negativePMD doesn't flag a problematic piece of code
    on Jun 10, 2021
  4. adangel
    changed the title [-][java] Improve BadComparison[/-] [+][java] Improve BadComparison and rename to ComparisonWithNaN[/+] on Jun 10, 2021
  5. adangel
    added a commit that references this issue on Jun 10, 2021

    [doc] Update release notes (pmd#2895, pmd#3312)

    b8ff2b5
  6. adangel
    closed this as completedin #3312on Jun 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    a:false-negativePMD doesn't flag a problematic piece of codean:enhancementAn improvement on existing features / rules

    Type

    No type

    Projects

    No projects

      Milestone

      • 6.36.0

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.