-
Bug
-
Resolution: Fixed
-
Minor
-
-
2.271
the previous implementaion of `FieldUtils.setProtectedFieldValue` worked for final as well as protected methods.
this is not the case for the new code and it fails with
```
java.lang.IllegalAccessException: Can not set final java.lang.ClassLoader field hudson.PluginManager.uberClassLoader to org.powermock.core.classloader.javassist.JavassistMockClassLoader
at sun.reflect.UnsafeFieldAccessorImpl.throwFinalFieldIllegalAccessException(UnsafeFieldAccessorImpl.java:76)
at sun.reflect.UnsafeFieldAccessorImpl.throwFinalFieldIllegalAccessException(UnsafeFieldAccessorImpl.java:80)
at sun.reflect.UnsafeQualifiedObjectFieldAccessorImpl.set(UnsafeQualifiedObjectFieldAccessorImpl.java:79)
at java.lang.reflect.Field.set(Field.java:764)
at org.apache.commons.lang.reflect.FieldUtils.writeField(FieldUtils.java:523)
at org.apache.commons.lang.reflect.FieldUtils.writeField(FieldUtils.java:500)
at org.apache.commons.lang.reflect.FieldUtils.writeField(FieldUtils.java:560)
at org.acegisecurity.util.FieldUtils.setProtectedFieldValue(FieldUtils.java:43)
```
the code should be adapted to work with final classes.
Currently only observed in test code - but may as well fix it before it is observed in production code.
- links to