Closed schmidti159 closed 9 months ago
Thanks for reporting this, I filed JBR-6363 in our issue tracker.
This problem is a bit more difficult. The sample program uses PowerMock, which redefines java.lang.Object
, which results in redefining all subclasses, i.e. almost all the classes just loaded in ClassLoader
. In this case, there are ~4,000 classes. The size wouldn't be such a problem, but the problem is that it redefines java.lang.Object
, which has a lot of bindings and dependencies in the JVM and the current DCEVM doesn't support redefinition of this class. However, a fix is being worked on, but it won't be in the short term, this is a major intervention in the DCEVM code.
Thank you for your analysis. I was not aware that the sample was using PowerMock explicitly, so I looked at it again. The root cause of why it only occurred now, is that Mockito changed the default MockMaker with version 5. Before it was using the subclass MockMaker, now the default is the inline MockMaker (see https://github.com/mockito/mockito/releases/tag/v5.0.0).
So if the subclass MockMaker is enough for the current project a simple workaround is to add this dependency to the project:
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-subclass</artifactId>
<scope>test</scope>
</dependency>
There is a jbr branch with the patch available at:
https://github.com/JetBrains/JetBrainsRuntime/tree/vladimir.dvorak/JBR-6363
if you know how to build a JDK, it would be great if you could try it on your case, but don't feel it's necessary
New release https://github.com/JetBrains/JetBrainsRuntime/releases/tag/jbr-release-17.0.10b1186.1 support redefinition of java.lang.object
, so this issue should be fixed now
Hi, we recently upgraded from Spring Boot 2.7 to Spring Boot 3.1 and with this we also upgraded mockito from 4.5.1 to 5.3.1 and bytebuddy from 1.12.23 to 1.14.10.
We use JBR in our development flow with
-XX:+AllowEnhancedClassRedefinition
to have faster development cycles when working on UI tests so no restart is required.After the upgrade we see exceptions caused by
java.lang.InternalError
in our tests when we use JBR with this flag.I uploaded a minimal reproducer here: https://github.com/schmidti159/reproducer_for-internal_error_in_jbr_with_mockito
The readme also contains the complete stacktrace and steps how to reproduce.
I am using IntelliJ IDEA 2023.2.5 to start the test and could reproduce it with JBR version 17.0.9+7-b1087.3
Could you please have a look? Having enhanced class redefinition is very valuable to our development workflow.