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] AssignmentInOperand false positive with lambda expressions · Issue #6075 · pmd/pmd

[java] AssignmentInOperand false positive with lambda expressions #6075

New issue
Copy link
New issue
Copy link
Closed
#6078
Closed
[java] AssignmentInOperand false positive with lambda expressions#6075
#6078
Copy link
Labels
a:false-positivePMD flags a piece of code that is not problematic
Milestone
7.18.0

Description

@vzorge
vzorge
opened on Sep 19, 2025
Issue body actions

Affects PMD Version:
7.17.0
Rule:
AssignmentInOperand
Please provide the rule name and a link to the rule documentation:
AssignmentInOperand

Description:
The fix for issue #3434 causes version 7.17.0 to flag assignment in Consumers as part of the AssignmentInOperand. This does not seem to be the intention, as it was not mentioned in any of the tests in this fix.

We use Consumers in this way in a Reactor Mono to assign value in a doOnNext.

Code Sample demonstrating the issue:

class PmdTest {
    private String field;
    public void pmdTest() {
        Consumer<String> cons = s -> this.field = s;
        cons.accept("pmd");
    }
}

Expected outcome:

PMD reports a violation at line 4, but that's wrong. That's a false positive.

Running PMD through: [Gradle]

Activity

  1. vzorge
    added
    a:false-positivePMD flags a piece of code that is not problematic
    on Sep 19, 2025
  2. vzorge
    changed the title [-][java] AssignmentInOperand false positives in 7.17.0[/-] [+][java] AssignmentInOperand false positive in 7.17.0[/+] on Sep 19, 2025
  3. adangel
    added this to the 7.18.0 milestone on Sep 25, 2025
  4. adangel
    changed the title [-][java] AssignmentInOperand false positive in 7.17.0[/-] [+][java] AssignmentInOperand false positive with lambda expressions[/+] on Sep 25, 2025
  5. adangel
    added 2 commits that reference this issue on Sep 25, 2025

    [doc] Update release notes (pmd#6075, pmd#6078)

    aadac20

    [doc] Update release notes (pmd#6075, pmd#6078)

    fbf33bc
  6. adangel
    closed this as completedin #6078on Sep 25, 2025
  7. adangel
    added a commit that references this issue on Sep 25, 2025

    [java] Fix #6075: Fix FP in AssignmentInOperandRule (#6078)

    This issue will close once commit 31cdcfa is merged into the 'main' branch.
    31cdcfa
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-positivePMD flags a piece of code that is not problematic

    Type

    No type

    Projects

    No projects

      Milestone

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