Skip to content

[core] Bug with node stream drop #2664

Merged
adangel merged 2 commits into
pmd:pmd/7.0.xfrom
oowekyala:node-stream-drop-bug
Jul 30, 2020
Merged

[core] Bug with node stream drop #2664
adangel merged 2 commits into
pmd:pmd/7.0.xfrom
oowekyala:node-stream-drop-bug

Conversation

@oowekyala

Copy link
Copy Markdown
Member

Describe the PR

Fix a bug in ancestor node streams.

If you have an ancestor path like /B/B/A/A, where the innermost (last) node is named a, then
a.ancestors(B.class).drop(1) was equivalent to a.getParent().ancestors(B.class), which is wrong as it still contains both B nodes.

This also makes ancestor streams less lazy, so that they can be folded to empty streams more often.

Ready?

  • Added unit tests for fixed bug/feature
  • Passing all unit tests
  • Complete build ./mvnw clean verify passes (checked automatically by travis)
  • Added (in-code) documentation (if needed)

The drop(1) of FilteredAncestorOrSelfStream didn't work
@oowekyala oowekyala added this to the 7.0.0 milestone Jul 26, 2020
@ghost

ghost commented Jul 26, 2020

Copy link
Copy Markdown
1 Message
📖 No java rules are changed!

Generated by 🚫 Danger

@adangel adangel self-assigned this Jul 30, 2020
@adangel adangel merged commit fc44dba into pmd:pmd/7.0.x Jul 30, 2020
@oowekyala oowekyala deleted the node-stream-drop-bug branch July 30, 2020 15:42
@adangel adangel added the in:ast About the AST structure or API, the parsing step label Jan 12, 2023
@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

in:ast About the AST structure or API, the parsing step

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants