Since I migrated my instance to JDK 17, some Groovy code fails

1 minute readKnowledge base

Issue

Since I migrated my instance to JDK 17, some Groovy code fails, for example, using List.of throws the following in the build log:

java.lang.VerifyError: (class: java_util_List$of$17, method: call signature: (Ljava/lang/Object;)Ljava/lang/Object;) Illegal type in constant pool

Resolution

Modify your code to replace List.of(…) with […].

Workaround

Seems there is no workaround other than avoiding direct calls to static interface methods from Groovy scripts.

Tested product/plugin versions

This article is part of our Knowledge Base and is provided for guidance-based purposes only. The solutions or workarounds described here are not officially supported by CloudBees and may not be applicable in all environments. Use at your own discretion, and test changes in a safe environment before applying them to production systems.