Skip to content

[MNG-8482] Use instanceof assignments to get rid of casting expressions #9952

@jira-importer

Description

@jira-importer

Nils Breunese opened MNG-8482 and commented

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

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

By declaring an automatically cast variable this can be simplified:

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

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


Affects: 4.0.0-rc-2

Remote Links:

Backported to: 4.0.0-rc-3

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestpriority:minorMinor loss of function, or other problem where easy workaround is present

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions