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