Use pattern matching with cast

See gh-42076
This commit is contained in:
Tran Ngoc Nhan 2024-09-01 21:10:29 +07:00 committed by Phillip Webb
parent 09684295e0
commit 7cb1671871
1 changed files with 2 additions and 2 deletions

View File

@ -365,8 +365,8 @@ public class BomExtension {
}
public Object methodMissing(String name, Object args) {
if (args instanceof Object[] && ((Object[]) args).length == 1) {
Object arg = ((Object[]) args)[0];
if (args instanceof Object[] objects && objects.length == 1) {
Object arg = objects[0];
if (arg instanceof Closure<?> closure) {
ModuleHandler moduleHandler = new ModuleHandler();
closure.setResolveStrategy(Closure.DELEGATE_FIRST);