title: MockClassLoader cannot access jdk/internal/reflect superclass jdk.internal.reflect.MagicAccessorImpl
body: <p>I am in the middle of migrating a project into Java9, The Tests start failing after I switched to the new Java version, it seems like PowerMock is trying to access some classes it does not have access to. </p>
  
  <pre><code>Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.973 sec &lt;&lt;&lt; FAILURE! - in com.Test
  initializationError(com.Test)  Time elapsed: 0.007 sec  &lt;&lt;&lt; ERROR!
  org.objenesis.ObjenesisException: java.lang.reflect.InvocationTargetException
  Caused by: java.lang.reflect.InvocationTargetException
  Caused by: java.lang.IllegalAccessError: class jdk.internal.reflect.ConstructorAccessorImpl loaded by org/powermock/core/classloader/MockClassLoader cannot access jdk/internal/reflect superclass jdk.internal.reflect.MagicAccessorImpl
  </code></pre>
  
  <p><strong>maven-surefire-plugin</strong> </p>
  
  <pre><code>&lt;plugin&gt;
      &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
      &lt;version&gt;2.19.1&lt;/version&gt;
      &lt;configuration&gt;
          &lt;includes&gt;
              &lt;include&gt;**/*Test.java&lt;/include&gt;
              &lt;include&gt;**/*Test.groovy&lt;/include&gt;
              &lt;include&gt;**/*Spec.*&lt;/include&gt;
          &lt;/includes&gt;
          &lt;forkMode&gt;always&lt;/forkMode&gt;
          &lt;argLine&gt;--add-modules java.xml.bind&lt;/argLine&gt;
          &lt;argLine&gt;--add-modules java.activation&lt;/argLine&gt;
          &lt;argLine&gt;--add-opens=java.base/java.lang=ALL-UNNAMED --illegal-access=warn&lt;/argLine&gt;
      &lt;/configuration&gt;
  &lt;/plugin&gt;
  </code></pre>
  
  <p><strong>powermock dependency</strong>  </p>
  
  <pre><code>&lt;dependency&gt;
          &lt;groupId&gt;org.powermock&lt;/groupId&gt;
          &lt;artifactId&gt;powermock-module-junit4&lt;/artifactId&gt;
          &lt;version&gt;1.7.4&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.powermock&lt;/groupId&gt;
          &lt;artifactId&gt;powermock-api-mockito&lt;/artifactId&gt;
          &lt;version&gt;1.7.4&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
          &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;org.mockito&lt;/groupId&gt;
                  &lt;artifactId&gt;mockito-all&lt;/artifactId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
  </code></pre>