-
Notifications
You must be signed in to change notification settings - Fork 583
Issue 939: Error with setInternalState and JDK12 "java.lang.NoSuchFieldException: modifiers #955
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
Conversation
…ldException: modifiers" Signed-off-by: Enrico Olivelli - Diennea <enrico.olivelli@diennea.com>
@thekingnothing can you please take a look ? this is quite blocker for testing of projects of JDK12. |
@ijuma do you think this change will be useful in your case ? |
@@ -58,7 +58,16 @@ public void run(RunNotifier notifier) { | |||
try { | |||
super.run(notifier); | |||
} finally { | |||
Whitebox.setInternalState(description, "fAnnotations", new Annotation[]{}); | |||
try { | |||
Whitebox.setInternalState(description, "fAnnotations", new Annotation[]{}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the old code made such a drastic operation?
@thekingnothing Is it really needed because it looks like a workaround of something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Tibor17 it's a "dirty hack" to fix out memory issue. However, I don't see a lot of benefits as annotation does not consume a lot of memory and does not store any state or link to a heavy object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thekingnothing
The performance issues are understandable, but I was asking for the purpose why annotations had to be removed from Description
after Runners execution. Nobody reads them anyway after the runner has finished.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here I cannot help, as this code was introduced 7 years ago and I'm supporting PowerMock only for 3 years. I cannot say the real reason why it was done in such a way.
Great! I thank you. |
Thank you. In theory, the release should be in Maven central in next few minutes, however, sync between bintray and maven central usually fails. So the release will be in next few hours. |
@thekingnothing |
Add a catch clause in order to workaround a problem with PowerMockRunner and JDK12
Signed-off-by: Enrico Olivelli - Diennea enrico.olivelli@diennea.com
Fixes #939