[ 
https://issues.apache.org/jira/browse/LANG-961?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gary Gregory updated LANG-961:
------------------------------

    Description: 
FieldUtils.removeFinalModifier(Field) calls setAccessible(true) on the Field it 
is working on but does not reset it to false when done, after the final 
modifier has been removed. Also the method does not need to call 
setAccessible(true) if the field is already accessible.

- Only call setAccessible when needed
- Refactor and add a new method removeFinalModifier(Field field, boolean 
forceAccess)


  was:FieldUtils.removeFinalModifier(Field) calls setAccessible(true) on the 
Field it is working on but does not reset it to false when done, after the 
final modifier has been removed. Also the method does not need to call 
setAccessible(true) if the field is already accessible.


> org.apache.commons.lang3.reflect.FieldUtils.removeFinalModifier(Field) does 
> not clean up after itself
> -----------------------------------------------------------------------------------------------------
>
>                 Key: LANG-961
>                 URL: https://issues.apache.org/jira/browse/LANG-961
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.reflect.*
>    Affects Versions: 3.2, 3.2.1
>         Environment: Apache Maven 3.1.1 
> (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 11:22:22-0400)
> Maven home: C:\Java\apache-maven-3.1.1\bin\..
> Java version: 1.7.0_51, vendor: Oracle Corporation
> Java home: C:\Program Files\Java\jdk1.7.0_51\jre
> Default locale: en_US, platform encoding: Cp1252
> OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
>            Reporter: Gary Gregory
>            Assignee: Gary Gregory
>             Fix For: 3.3
>
>
> FieldUtils.removeFinalModifier(Field) calls setAccessible(true) on the Field 
> it is working on but does not reset it to false when done, after the final 
> modifier has been removed. Also the method does not need to call 
> setAccessible(true) if the field is already accessible.
> - Only call setAccessible when needed
> - Refactor and add a new method removeFinalModifier(Field field, boolean 
> forceAccess)



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to