Nils Breunese created MNG-8482:
----------------------------------

             Summary: Use instanceof assignments to get rid of casting 
expressions
                 Key: MNG-8482
                 URL: https://issues.apache.org/jira/browse/MNG-8482
             Project: Maven
          Issue Type: Improvement
    Affects Versions: 4.0.0-rc-2
            Reporter: Nils Breunese


Java's {{instanceof}} can be used to get rid of casting expressions. The Maven 
code base contains a lot of snippets like this:

{code}
if (val instanceof Boolean) {
    return (Boolean) val;
}
{code}

By declaring an automatically cast variable this can be simplified:

{code}
if (val instance Boolean bool) {
    return bool;
}
{code}

I can create a merge request to apply this pattern wherever applicable to get 
rid of the casting expressions after {{instanceof}} checks.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to