1

I am upgrading a project from java 8 to 11. I am getting test failures. The app uses mockito, powermock

I am getting the error

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.powermock.reflect.internal.WhiteboxImpl (file: .m2/repository/org/powermock/powermock-reflect/2.0.4/powermock-reflect-2.0.4.jar) to method java.lang.Object.clone()

WARNING: Please consider reporting this to the maintainers of org.powermock.reflect.internal.WhiteboxImpl

Here is my pom

<dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-all</artifactId>
        <version>1.10.19</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.powermock</groupId>
        <artifactId>powermock-api-mockito2</artifactId>
        <version>2.0.2</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.powermock</groupId>
        <artifactId>powermock-core</artifactId>
        <version>2.0.4</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.powermock</groupId>
        <artifactId>powermock-module-junit4</artifactId>
        <version>2.0.4</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.hamcrest</groupId>
        <artifactId>hamcrest-all</artifactId>
        <version>1.3</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.assertj</groupId>
        <artifactId>assertj-core</artifactId>
        <version>3.14.0</version>
        <scope>test</scope>
    </dependency>

Does powermock not work with java 11?

  • It's related to the Java 9 module system. – Michael Jan 23 '20 at 17:35
  • whats related to java 9? and i am not using java 9 –  Jan 23 '20 at 17:38
  • You are using Java 11, which includes the features of every preceding version, including Java 9. – Michael Jan 23 '20 at 17:41
  • You may find more success in migrating in some increments 8 -> 9 -> 10 -> 11, rather than trying to make the jump. Oracle publishes a migration guide for each release. Suggest you read it – Michael Jan 23 '20 at 17:42
  • so does powermock even work with java 11? As far as i am seeing it doesnt. https://github.com/powermock/powermock/issues/979 –  Jan 23 '20 at 17:49

0 Answers0