commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <garydgreg...@gmail.com>
Subject Re: svn commit: r1563014 - /commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/reflect/MemberUtils.java
Date Fri, 31 Jan 2014 00:41:58 GMT
On Thu, Jan 30, 2014 at 6:44 PM, Matt Benson <gudnabrsam@gmail.com> wrote:

> This change breaks binary compatibility.
>

I think this is OK because the class is package private. Strictly speaking
it does break BC if a user's class is also in org/apache/commons/
lang3/reflect/ which I claim is asking for trouble. Why else would our
class be package private?

Gary



>
>
> On Thu, Jan 30, 2014 at 5:28 PM, <ggregory@apache.org> wrote:
>
> > Author: ggregory
> > Date: Thu Jan 30 23:28:26 2014
> > New Revision: 1563014
> >
> > URL: http://svn.apache.org/r1563014
> > Log:
> > [LANG-961]
> > org.apache.commons.lang3.reflect.FieldUtils.removeFinalModifier(Field)
> does
> > not clean up after itself. Only call setAccessible if neccessary and tell
> > the caller about it so it can undo the change if need be.
> >
> > Modified:
> >
> >
> commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/reflect/MemberUtils.java
> >
> > Modified:
> >
> commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/reflect/MemberUtils.java
> > URL:
> >
> http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/reflect/MemberUtils.java?rev=1563014&r1=1563013&r2=1563014&view=diff
> >
> >
> ==============================================================================
> > ---
> >
> commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/reflect/MemberUtils.java
> > (original)
> > +++
> >
> commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/reflect/MemberUtils.java
> > Thu Jan 30 23:28:26 2014
> > @@ -49,20 +49,22 @@ abstract class MemberUtils {
> >       * sufficiently privileged code. Better workarounds would be
> > gratefully
> >       * accepted.
> >       * @param o the AccessibleObject to set as accessible
> > +     * @return a boolean indicating whether the accessibility of the
> > object was set to true.
> >       */
> > -    static void setAccessibleWorkaround(final AccessibleObject o) {
> > +    static boolean setAccessibleWorkaround(final AccessibleObject o) {
> >          if (o == null || o.isAccessible()) {
> > -            return;
> > +            return false;
> >          }
> >          final Member m = (Member) o;
> > -        if (Modifier.isPublic(m.getModifiers())
> > -                &&
> isPackageAccess(m.getDeclaringClass().getModifiers()))
> > {
> > +        if (!o.isAccessible() && Modifier.isPublic(m.getModifiers()) &&
> > isPackageAccess(m.getDeclaringClass().getModifiers())) {
> >              try {
> >                  o.setAccessible(true);
> > +                return true;
> >              } catch (final SecurityException e) { // NOPMD
> >                  // ignore in favor of subsequent IllegalAccessException
> >              }
> >          }
> > +        return false;
> >      }
> >
> >      /**
> >
> >
> >
>



-- 
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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message