GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||
GeezerVison is showing github.com — [java] Remove ParenthesizedExpr by oowekyala · Pull Request #1872 · pmd/pmd Conversation
Member
Removes ParenthesizedExpr from the current version of java-grammar. It's replaced by an attribute of ASTExpression, that stores the number of parentheses levels around the expression. Most rules, and all analysis passes, would never care about parentheses. So having an extra node causes the following problems:
So eg as today, + AdditiveExpr + `1` + MultiplicativeExpr + `2` + `3` but now, this is the same as OTOH + MultiplicativeExpression + AdditiveExpr [ @Parenthesized = true() ] + `1` + `2` + `3` Notice, that this really is a simplification, since because of operator precedence rules, the only way you can nest an addition into a multiplication is with parentheses anyway. That means, that the ParenthesizedExpr in this context was entirely redundant. Finally, + AdditiveExpr + `1` + `2` + `3` whereas + AdditiveExpr + AdditiveExpr [ @Parenthesized = true() ] + `1` + `2` + `3` meaning, we have to preserve the parens on a node that would otherwise have been flattened - even though they're unnecessary... But that's in fact consistent with + AdditiveExpr + `1` + AdditiveExpr [ @Parenthesized = true() ] + `2` + `3`
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
adangel
approved these changes
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Avoiding the extra node level in the AST makes sense. The information about the parentheses is still retained, so rules like UselessParentheses are still possible.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like we should add this comment on the master branch for PMD 6. Here it is already a interface...
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like MethodLikeNode is mostly used in metrics. I see, this is already a point on https://github.com/pmd/pmd/wiki/PMD-7.0.0-Java
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReviewersUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabels
in:ast
ProjectsDevelopmentSuccessfully merging this pull request may close these issues. Uh oh!
There was an error while loading. Please reload this page. Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later. | ||||||||||||||||||||||||
| 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. |