AccessController.doPrivileged and default methods

Michael Rasmussen michael.rasmussen at
Tue Jul 4 11:57:01 UTC 2017


I was playing around with having an easy way to have doPrivileged call
void methods via lambdas/method references, and noticed that if you
use AccessController.doPrivileged(PrivilegedAction), and the run
method is implemented as a default method, then you get the following
exception: java.lang.InternalError: No run method

I failed finding anywhere in the documentation stating this should not
be supported, or a bug report about it, so writing/asking here.

See example code below

Kind regards
Michael Rasmussen


package com.test;


public class Test {
  interface VoidPrivilegedAction extends PrivilegedAction<Void> {
    void perform();

    default Void run() {
      return null;

  static void doPrivileged(VoidPrivilegedAction act) {

  public static void main(String[] args) throws Exception {
    doPrivileged(() -> System.out.println(System.getProperty("java.home")));


Exception in thread "main" java.lang.InternalError: No run method
at Method)
at com.test.Test.doPrivileged(
at com.test.Test.main(

More information about the security-dev mailing list