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] BooleanGetMethodName: False-negatives with `Boolean` wrapper · Issue #5253 · pmd/pmd

[java] BooleanGetMethodName: False-negatives with Boolean wrapper #5253

New issue
Copy link
New issue
Copy link
Closed
#5269
Closed
[java] BooleanGetMethodName: False-negatives with Boolean wrapper#5253
#5269
Copy link
Labels
a:false-negativePMD doesn't flag a problematic piece of codean:enhancementAn improvement on existing features / rules
Milestone
7.7.0

Description

@phansys
phansys
opened on Oct 4, 2024
Issue body actions

Is your feature request related to a problem? Please describe.
Methods using Boolean return declaration are not managed by the BooleanGetMethodName rule.

Describe the solution you'd like
Update the rule to consider the Boolean wrapper too.

Describe alternatives you've considered
If this is considered as a BC break, I guess a property enabling the detection for the Boolean type could work.

Additional context

Boolean getFoo() {
    return true;
}

pmd/pmd-java/src/main/resources/category/java/codestyle.xml

Lines 187 to 192 in a0818d5

<![CDATA[
//MethodDeclaration
[starts-with(@Name, 'get')]
[@Arity = 0 or $checkParameterizedMethods = true()]
[ PrimitiveType[@Kind = 'boolean'] and @Overridden = false() ]
]]>

Activity

  1. phansys
    added
    an:enhancementAn improvement on existing features / rules
    on Oct 4, 2024
  2. jsotuyod
    added
    good first issueA great starting point for new contributors
    on Oct 4, 2024
  3. aryanttripathi commented on Oct 8, 2024

    @aryanttripathi
    aryanttripathi
    on Oct 8, 2024
    Contributor
    More actions

    Hello @phansys, I would like to work on this issue. I didn't get clarification on what we need to do here. Could you explain a little about what we need to perform here? I will be happy to do.

    Reacted by Javier Spagnoletti
  4. phansys commented on Oct 8, 2024

    @phansys
    phansys
    on Oct 8, 2024
    Author
    More actions

    Hi @Aryant-Tripathi!

    Could you explain a little about what we need to perform here?

    The rule BooleanGetMethodName is catching cases like this:

    boolean getFoo() {
        return true;
    }

    but isn't detecting any violation in cases like this:

    Boolean getFoo() {
        return true;
    }

    Please, let me know if you need more context.
    Thank you in advance.

  5. aryanttripathi
    added a commit that references this issue on Oct 9, 2024

    Support Boolean wrapper class for BooleanGetMethodName rule (pmd#5253)

    54dfabe
  6. aryanttripathi commented on Oct 9, 2024

    @aryanttripathi
    aryanttripathi
    on Oct 9, 2024
    Contributor
    More actions

    @phansys sir, If possible may you be able to mark/tag PR as hacktoberfest-accepted / hacktoberfest label. It will help me in contributing a PR in hacktoberfest.

  7. phansys commented on Oct 9, 2024

    @phansys
    phansys
    on Oct 9, 2024
    Author
    More actions

    I haven't permission for that @Aryant-Tripathi, sorry.
    Maybe @jsotuyod can help.

  8. jsotuyod commented on Oct 9, 2024

    @jsotuyod
    jsotuyod
    on Oct 9, 2024
    Member
    More actions

    Sure, I've just added the hacktoberfest topic to the repo. Happy coding!

    Reacted by Javier Spagnoletti and Aryant Tripathi
  9. aryanttripathi
    added a commit that references this issue on Oct 10, 2024

    Support wrapper class in BooleanGetMethodName rule (pmd#5253)

    8b2af2d
  10. adangel
    changed the title [-][java] [BooleanGetMethodName] Is there an explicit reason for not supporting `Boolean` wrapper class?[/-] [+][java] BooleanGetMethodName: False-negatives with `Boolean` wrapper[/+] on Oct 11, 2024
  11. adangel
    added
    a:false-negativePMD doesn't flag a problematic piece of code
    on Oct 11, 2024
  12. adangel
    added this to the 7.7.0 milestone on Oct 11, 2024
  13. adangel
    removed
    good first issueA great starting point for new contributors
    on Oct 11, 2024
  14. aryanttripathi
    added 3 commits that reference this issue on Oct 11, 2024

    Support wrapper class in BooleanGetMethodName rule (pmd#5253)\n \n - …

    ed6312e

    Support wrapper class in BooleanGetMethodName rule (pmd#5253)\n \n - …

    9077c6a

    Support wrapper class in BooleanGetMethodName rule (pmd#5253)\n \n - …

    9a123bf
  15. adangel
    added a commit that references this issue on Oct 12, 2024

    [doc] Update release notes (#5253, #5269)

    e502345
  16. adangel
    closed this as completedin 08bcf29on Oct 12, 2024
  17. adangel
    added a commit that references this issue on Oct 12, 2024

    [java] Fix pmd#5253: Support Boolean wrapper class for BooleanGetMeth…

    This issue will close once commit 08bcf29 is merged into the 'main' branch.
    08bcf29
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

      • 7.7.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.