Recientemente, estaba actualizando mi proyecto de JDK 11 a JDK 17. Después de actualizar, powermock parece tener un problema. Mientras ejecuto AUT, recibo el siguiente error:
java.lang.RuntimeException: PowerMock internal error: Should never throw exception at this level Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected native java.lang.Object java.lang.Object.clone() throws java.lang.CloneNotSupportedException accessible: module java.base does not "opens java.lang" to unnamed module @3fc34119¿Conoce alguna solución a este problema? Si es así, ¿puede proporcionar la solución?
Como medida provisional (hasta que se actualice Powermock), debería poder ejecutar sus pruebas pasando el siguiente argumento a su JVM:
--add-opens java.base/java.lang=ALL-UNNAMED Si está ejecutando sus pruebas con Maven , puede configurar el surefire-plugin esta manera:
<plugin> <artifactId>maven-surefire-plugin</artifactId> <version>${plugin.surefire.version}</version> <configuration> <argLine>--add-opens java.base/java.lang=ALL-UNNAMED</argLine> </configuration> </plugin>