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
Error with setInternalState and JDK12 "java.lang.NoSuchFieldException: modifiers" #939
Comments
Anyone else has this problem ? |
OpenJDK discussion: http://mail.openjdk.java.net/pipermail/core-libs-dev/2018-November/056486.html |
Thank you @ijuma for posting my discussion. |
@ijuma this is my proof of concept, it is a very simple agent made with ByteBuddy. It works for most of the cases, but in the case he specific error at at org.powermock.modules.junit4.PowerMockRunner.run(PowerMockRunner.java:61) It does not work because ByteBuddy is not "transforming" the Annotation[] fAnnotations field of org.junit.runner.Description. It seems a bug in ByteBuddy (raphw/byte-buddy#559). That specific case, could be worked-around in PowerMock by just not failing in case of failure in that point in the finally block. In that case there is a best-effort trial to reset a field in description. Temporary you can bypass the specific error with a subclass of PowerMockRunner, this is very hacky but 'it works'
|
For org.powermock.modules.junit4.PowerMockRunner I think we should have a minimal fix which ignores the error. I can send a patch |
This is my minimal patch |
Fix in PR only suppresses exception in one part of powermock's own code but if users call |
@rnveach you can use a java agent like this one https://github.com/eolivelli/tweakjava |
|
There are multiple ways.
|
No official release notes (yet?), the following issues are fixed: powermock/powermock#685 powermock/powermock#992 powermock/powermock#939 Change-Id: Ie8266a961c75cb0dcb606e4639ef0b91a8992b5e Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
No official release notes (yet?), the following issues are fixed: powermock/powermock#685 powermock/powermock#992 powermock/powermock#939 Change-Id: Ie8266a961c75cb0dcb606e4639ef0b91a8992b5e Signed-off-by: Robert Varga <robert.varga@pantheon.tech> (cherry picked from commit 3479902)
What steps will reproduce the problem?
Use WhiteBox#setInternalState with JDK12
What is the expected output?
setInternalState does not throw exception
What do you see instead?
What version of the product are you using?
2.0.0.Beta5
The text was updated successfully, but these errors were encountered: