JENKINS-58912/JENKINS-58938: Fix Groovy compilation error that breaks the UI. (cherry picked from commit e8df387e)