New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mockito "cannot mock" exceptions with IBM Semeru Java 11 and 17 #2995
Comments
Unfortunately, |
@TimvdLippe The problems I was having weren't limited to InputStream or even third party classes. Moreover, all of those tests that are failing for me with IBM Semeru Java are passing with Oracle Java, so the issues aren't inherent to mockito. To see if I could make this clearer, I tried running mockito's own test suite today with IBM Semeru Java (jdk-11.0.17+8) by setting "executable" in mockito's top-level build.gradle, like this:
The result was that mockito's own tests have about 500 failures in the top-level project alone, and I also noticed failures in subprojects. I didn't look at every single failure, but from a sampling it is nearly all the very same "cannot mock" exceptions that I gave an example of in my original problem report. I've attached the contents of mockito's top level build/reports/tests/test directory for your convenience. I hope that you will agree that there's a very widespread problem with mockito running under IBM Semeru Java and that this issue deserves to be reopened. The above results came from the Semeru version cited above, but in my testing it doesn't really matter, I've tried various Semeru Java 11 and 17 versions with the same results. Semeru downloads are available at https://developer.ibm.com/languages/java/semeru-runtimes/downloads/ |
@TimvdLippe , any update on this? I am hitting the same issue. But I am only mocking my own classes, so definitely not something Mockito would be dependent on. |
If anybody from IBM or another contributor wants to send us patches on how to fix Mockito on their SDK, we would welcome them. |
Duplicate of #2278 (please close this in favour of #2278). Thanks to @paulcheeseman from IBM for providing the link to the upstream issue (I am merely another user, but my company has IBM support and we ran into this, too. So I opened an issue so IBM could work on this more quickly). Should be fixed by the next OpenJ9 release. HTH |
Hi,
I'm having a problem with Mockito running under IBM Semeru Java 11 and 17 that I'm not having with Oracle versions. I'm using Mockito 5.3.1 and byte-buddy 1.14.4, but also have this problem with Mockito 5.2.0 and byte-buddy 1.14.3. The Java details in the error message below are from Windows Semeru Java 11 but I also get this on Linux, and also on even the latest Semeru Java 17. The problem is that in some cases I'm getting a "Mockito cannot mock this class" MockitoException. I give one such example below that complains about not being able to mock java.io.InputStream, but I'm also getting this on some of my company's own classes and on proprietary third party classes that we use. Much of our mocking code runs fine, but in the places where this fails, it fails consistently in this way.
Here's an example exception:
Here's the ByteBufferBasedDatabaseDataInputStreamTest.injectMocks method that this is being thrown from:
Has mockito been tested with IBM Semeru Java? Do you have any ideas why this might be happening?
Thanks,
Gregg
The text was updated successfully, but these errors were encountered: