Skip to content

Conversation

Vampire
Copy link
Contributor

@Vampire Vampire commented Sep 17, 2019

This also properly fixes #939 and removes the work-around that was put in place with #955.
If Java compatibility gets increased to Java 9 or newer, MethodHandle and VarHandle could be used afair.
But as Java compatibility is 7 currently, I solved it by using yet another private detail,
the method that delivers the declared fields unfiltered where the modifiers field is still included.

@sfuhrm
Copy link

sfuhrm commented Oct 16, 2019

@thekingnothing is there any chance we can see this being merged? It is very important for JDK 12+ support.

@thekingn0thing thekingn0thing merged commit 3eb2192 into powermock:release/2.x Oct 16, 2019
@Vampire Vampire deleted the fix-changing-final-fields-on-java-12 branch March 21, 2020 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error with setInternalState and JDK12 "java.lang.NoSuchFieldException: modifiers"
3 participants