diff --git a/core/src/main/java/hudson/model/queue/Executables.java b/core/src/main/java/hudson/model/queue/Executables.java index d3a7319e8d..e8533ad5e9 100644 --- a/core/src/main/java/hudson/model/queue/Executables.java +++ b/core/src/main/java/hudson/model/queue/Executables.java @@ -26,6 +26,7 @@ package hudson.model.queue; import hudson.model.Queue.Executable; import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; /** * Convenience methods around {@link Executable}. @@ -41,7 +42,9 @@ public class Executables { return _getParentOf(e); } catch (AbstractMethodError _) { try { - return (SubTask)e.getClass().getMethod("getParent").invoke(e); + Method m = e.getClass().getMethod("getParent"); + m.setAccessible(true); + return (SubTask) m.invoke(e); } catch (IllegalAccessException x) { throw (Error)new IllegalAccessError().initCause(x); } catch (NoSuchMethodException x) {