Merge pull request #42076 from ngocnhan-tran1996

* pr/42076:
  Polish 'Use pattern matching with cast'
  Use pattern matching with cast

Closes gh-42076
This commit is contained in:
Phillip Webb
2024-09-01 19:01:47 -07:00

View File

@@ -365,9 +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 (arg instanceof Closure<?> closure) {
if (args instanceof Object[] argsArray && argsArray.length == 1) {
if (argsArray[0] instanceof Closure<?> closure) {
ModuleHandler moduleHandler = new ModuleHandler();
closure.setResolveStrategy(Closure.DELEGATE_FIRST);
closure.setDelegate(moduleHandler);