Evaluated Groovy script should expose the current hudson.model.TaskListener so that scripts implementers can invoke hudson.model.Run#getEnvironment(hudson.model.TaskListener) (with the actual value) instead of invoking the deprecated hudson.model.Run#getEnvironment() which was deprecated since Jenkins 1.305 (EnvInject currently requires Jenkins ≥ 1.532.3):
/**
* @deprecated as of 1.305 use {@link #getEnvironment(TaskListener)}
*/
public EnvVars getEnvironment() throws IOException, InterruptedException {