Skip to content

Add checks for OpenJDK Style §3.13 - Redundant Paranthesis #20093

@Aman-Baliyan

Description

@Aman-Baliyan

Parent issue: #19798

Description:

Image

Rules Covered:

From §3.13 - Redundant Paranthesis:

Redundant grouping parentheses (i.e. parentheses that does not affect evaluation) may be used if they improve readability. - Not Coverable

Redundant grouping parentheses should typically be left out in shorter expressions involving common operators but included in longer expressions or expressions involving operators whose precedence and associativity is unclear without parentheses. Ternary expressions with non-trivial conditions belong to the latter .- Not Coverable

The entire expression following a return keyword must not be surrounded by parentheses. - MatchXpath

Checks to add to openjdk_checks.xml

TreeWalker_level:

 <module name="MatchXpath">
            <property name="query" value="//LITERAL_RETURN/EXPR[./LPAREN and ./RPAREN and not(./LPAREN/preceding-sibling::*)]"/>
            <message key="matchxpath.match" value="The entire expression following a return keyword must not be surrounded by parentheses."/>
        </module>

Progress Tracker:

Check Rule PR
MatchXPath The entire expression following a return keyword must not be surrounded by parentheses.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions