Skip to content

[java] Update rule NullAssignment#3649

Merged
oowekyala merged 5 commits into
pmd:pmd/7.0.xfrom
adangel:pmd7-update-NullAssignment
Jan 4, 2022
Merged

[java] Update rule NullAssignment#3649
oowekyala merged 5 commits into
pmd:pmd/7.0.xfrom
adangel:pmd7-update-NullAssignment

Conversation

@adangel

@adangel adangel commented Nov 29, 2021

Copy link
Copy Markdown
Member

@adangel adangel added this to the 7.0.0 milestone Nov 29, 2021
@ghost

ghost commented Nov 29, 2021

Copy link
Copy Markdown
2 Messages
📖 Compared to pmd/7.0.x:
This changeset changes 0 violations,
introduces 2230 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 0 errors and 0 configuration errors.
Full report
📖 Compared to master:
This changeset changes 45981 violations,
introduces 25578 new violations, 5 new errors and 0 new configuration errors,
removes 179969 violations, 27 errors and 3 configuration errors.
Full report
Compared to pmd/7.0.x:
This changeset changes 0 violations,
introduces 2229 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 0 errors and 0 configuration errors.
Full report
Compared to master:
This changeset changes 45981 violations,
introduces 25578 new violations, 5 new errors and 0 new configuration errors,
removes 179970 violations, 27 errors and 3 configuration errors.
Full report
Compared to pmd/7.0.x:
This changeset changes 0 violations,
introduces 2163 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 0 errors and 0 configuration errors.
Full report
Compared to master:
This changeset changes 45900 violations,
introduces 25761 new violations, 38 new errors and 0 new configuration errors,
removes 180011 violations, 28 errors and 3 configuration errors.
Full report

Generated by 🚫 Danger

@adangel

This comment has been minimized.

@adangel adangel self-assigned this Dec 20, 2021
@adangel

This comment has been minimized.

@oowekyala

oowekyala commented Jan 4, 2022

Copy link
Copy Markdown
Member

I think I'll merge this.. In the long term I think this rule should be deprecated though. Its justification is really bad:

Sometimes, this type of assignment is an indication that the programmer doesn't completely understand what is going on in the code.

This is completely unverifiable. The message is even worse:

Assigning an Object to null is a code smell. Consider refactoring.

null is not more dangerous when assigned into a variable than in other places, so the rule really has no reason to exist.
Using data flow analysis we should try to detect possible NPEs in a useful manner, not just blindly flag all null literals in the program. I think this kind of very noisy and badly justified rules make PMD look bad and they should be hunted down.

@oowekyala oowekyala merged commit 7fcc1c8 into pmd:pmd/7.0.x Jan 4, 2022
@adangel adangel deleted the pmd7-update-NullAssignment branch January 8, 2022 18:59
@adangel adangel mentioned this pull request Jan 23, 2023
55 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[java] NullAssignment - FP with ternary and null as method argument [java] NullAssignment - FP with ternay and null as constructor argument

2 participants