Groovy stream filter not accepting closure

Since this is related to using Better PDF Exporter I’m not sure I’m am asking this in the correct forum.

I have a simple groovy script that attempts to filter a stream of a List. I am using closures in this manner:

List<String> myList = [ "1-abc", "1-def", "2-ghi", "2-jkl" ]
return { s -> s.startsWith("1-") }.collect(Collectors.toList())

However this causes the error :


org.apache.velocity.exception.MethodInvocationException: Invocation of method ‘getEntries’ in class dataStreamManagerTool
threw exception groovy.lang.MissingMethodException: No signature of method:
$Head.filter() is applicable for argument types: (dataStreamManagerTool$_getEntries_closure1) values: [dataStreamManagerTool
Possible solutions: filter(java.util.function.Predicate), sorted(), find(), sorted(java.util.Comparator),
find(groovy.lang.Closure), with(groovy.lang.Closure) at testStream-fo.vm (7cvFop9w-1629267406345)[line 19, column 48]

Jira Server version is v8.13.1

Some research suggests this may be caused by the version of Groovy.

Should this work?
What version of Groovy is supplied with Jira (or is this tied to Better PDF Exporter)?
How can i verify the version of installed Groovy?

The full groovy code is shown below:

import java.util.function.Predicate

dataStreamManager = new dataStreamManagerTool()

public class dataStreamManagerTool {
  	//private static Predicate<String> doStartsWith(match) {
        //  return p -> p.startsWith(match)

public getEntries(match) {
    	List<String> myList = [ "1-abc", "1-def", "2-ghi", "2-jkl" ]
        //return"1-")).collect(Collectors.toList()) // this does not work
        return { s -> s.startsWith("1-") }.collect(Collectors.toList()) // this does not work
        //return  // this works but NO filter!