Get task candidate groups

When I add a task listener, I want to use grovvy scripts to get task’s groups info like this:

task.execution.getProcessEngineServices().getTaskService().getCandidates()

But I faild, log is:

groovy.lang.MissingMethodException: No signature of method: org.camunda.bpm.engine.impl.TaskServiceImpl.getCandidates() is applicable for argument types: () values:

Can I retrieves the candidate users and groups associated with a task?

BTW,Can I get the process instance state(active, completed) in the task listener?

Thank you very much! :heart: