Source:
public void addRecipients(final ExtendedEmailPublisherContext context, EnvVars env, Set<InternetAddress> to, Set<InternetAddress> cc, Set<InternetAddress> bcc) { final class Debug implements RecipientProviderUtilities.IDebug { private final ExtendedEmailPublisherDescriptor descriptor = Jenkins.getActiveInstance().getDescriptorByType(ExtendedEmailPublisherDescriptor.class); private final PrintStream logger = context.getListener().getLogger(); public void send(final String format, final Object... args) { descriptor.debug(logger, format, args); } } final Debug debug = new Debug(); Run<?,?> run = context.getRun(); try { Method getCulprits = run.getClass().getMethod("getCulprits"); if (Set.class.isAssignableFrom(getCulprits.getReturnType())) { @SuppressWarnings("unchecked") Set<User> users = (Set<User>) getCulprits.invoke(run); if (Iterables.all(users, Predicates.instanceOf(User.class))) { RecipientProviderUtilities.addUsers(users, context, env, to, cc, bcc, debug); } } } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) { debug.send("Exception getting culprits for %s: %s", run, e); List<Run<?, ?>> builds = new ArrayList<>(); Run<?, ?> build = run; builds.add(build); build = build.getPreviousCompletedBuild(); while (build != null) { final Result buildResult = build.getResult(); if (buildResult != null) { if (buildResult.isWorseThan(Result.SUCCESS)) { debug.send("Including build %s with status %s", build.getId(), buildResult); builds.add(build); } else { break; } } build = build.getPreviousCompletedBuild(); } Set<User> users = RecipientProviderUtilities.getChangeSetAuthors(builds, debug); RecipientProviderUtilities.addUsers(users, context, env, to, cc, bcc, debug); } }

Target:
public void addRecipients(final ExtendedEmailPublisherContext context, EnvVars env, Set<InternetAddress> to, Set<InternetAddress> cc, Set<InternetAddress> bcc) { final class Debug implements RecipientProviderUtilities.IDebug { private final ExtendedEmailPublisherDescriptor descriptor = Jenkins.getActiveInstance().getDescriptorByType(ExtendedEmailPublisherDescriptor.class); private final PrintStream logger = context.getListener().getLogger(); public void send(final String format, final Object... args) { descriptor.debug(logger, format, args); } } final Debug debug = new Debug(); Run<?,?> run = context.getRun(); boolean runHasGetCulprits = false; try { Method getCulprits = run.getClass().getMethod("getCulprits"); runHasGetCulprits = true; if (Set.class.isAssignableFrom(getCulprits.getReturnType())) { @SuppressWarnings("unchecked") Set<User> users = (Set<User>) getCulprits.invoke(run); if (Iterables.all(users, Predicates.instanceOf(User.class))) { RecipientProviderUtilities.addUsers(users, context, env, to, cc, bcc, debug); } } } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) { if (!(run instanceof WorkflowRun && !runHasGetCulprits)) { debug.send("Exception getting culprits for %s: %s", run, e); } List<Run<?, ?>> builds = new ArrayList<>(); Run<?, ?> build = run; builds.add(build); build = build.getPreviousCompletedBuild(); while (build != null) { final Result buildResult = build.getResult(); if (buildResult != null) { if (buildResult.isWorseThan(Result.SUCCESS)) { debug.send("Including build %s with status %s", build.getId(), buildResult); builds.add(build); } else { break; } } build = build.getPreviousCompletedBuild(); } Set<User> users = RecipientProviderUtilities.getChangeSetAuthors(builds, debug); RecipientProviderUtilities.addUsers(users, context, env, to, cc, bcc, debug); } }