commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <garydgreg...@gmail.com>
Subject Re: [LANG] FieldUtils forceAccess does not force access for final
Date Thu, 30 Jan 2014 18:46:14 GMT
Yes.

Another issue is that the way the code is currently factored means that you'd get write access
when you only need read...

Gary

-------- Original message --------
From: Benedikt Ritter <britter@apache.org> 
Date:01/30/2014  13:22  (GMT-05:00) 
To: Commons Developers List <dev@commons.apache.org> 
Subject: Re: [LANG] FieldUtils forceAccess does not force access for final 

So the point you're making is that accessibility alway includes write
access?


2014/1/29 Gary Gregory <garydgregory@gmail.com>

> Hi All:
>
> I have a use case where I need to use reflection to set a public static
> final Object.
>
> This does not work with our FieldUtils class because the "forceAccess"
> argument is only used to deal with field visibility by calling
> Field#setAccessible(boolean)
>
> Q1: Should "forceAccess" be expanded to remove the final modifier? Or:
> Q2: Should we add another boolean parameter "forceWrite" to remove the
> FINAL modifier?
>
> I like Q1.
>
> Q3: The Accessible flag is NOT reset if changed after a write! I think it
> should be. Thoughts?
>
> Gary
>
> --
> E-Mail: garydgregory@gmail.com | ggregory@apache.org
> Java Persistence with Hibernate, Second Edition<
> http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> Spring Batch in Action <http://www.manning.com/templier/>
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>



-- 
http://people.apache.org/~britter/
http://www.systemoutprintln.de/
http://twitter.com/BenediktRitter
http://github.com/britter
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message