incubator-aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r1039127 - /incubator/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/utils/ReflectionUtils.java
Date Thu, 25 Nov 2010 18:13:01 GMT
Author: gnodet
Date: Thu Nov 25 18:13:01 2010
New Revision: 1039127

URL: http://svn.apache.org/viewvc?rev=1039127&view=rev
Log:
[ARIES-500] Field injection does not consider fields defined on parent classes

Modified:
    incubator/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/utils/ReflectionUtils.java

Modified: incubator/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/utils/ReflectionUtils.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/utils/ReflectionUtils.java?rev=1039127&r1=1039126&r2=1039127&view=diff
==============================================================================
--- incubator/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/utils/ReflectionUtils.java
(original)
+++ incubator/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/utils/ReflectionUtils.java
Thu Nov 25 18:13:01 2010
@@ -176,18 +176,20 @@ public class ReflectionUtils {
             }            
             
             if (allowFieldInjection) {
-                for (Field field : clazz.getDeclaredFields()) {
-                    if (!!!Modifier.isStatic(field.getModifiers())) {
-                        String name = decapitalize(field.getName());
-                        PropertyDescriptor desc = props.get(name);
-                        if (desc == null) {
-                            props.put(name, new FieldPropertyDescriptor(name, field));
-                        } else if (desc instanceof MethodPropertyDescriptor) {
-                            props.put(name, 
-                                    new JointPropertyDescriptor((MethodPropertyDescriptor)
desc, 
-                                            new FieldPropertyDescriptor(name, field)));
-                        } else {
-                            illegalProperties.add(name);
+                for (Class cl = clazz; cl != null && cl != Object.class; cl = cl.getSuperclass())
{
+                    for (Field field : cl.getDeclaredFields()) {
+                        if (!!!Modifier.isStatic(field.getModifiers())) {
+                            String name = decapitalize(field.getName());
+                            PropertyDescriptor desc = props.get(name);
+                            if (desc == null) {
+                                props.put(name, new FieldPropertyDescriptor(name, field));
+                            } else if (desc instanceof MethodPropertyDescriptor) {
+                                props.put(name,
+                                        new JointPropertyDescriptor((MethodPropertyDescriptor)
desc,
+                                                new FieldPropertyDescriptor(name, field)));
+                            } else {
+                                illegalProperties.add(name);
+                            }
                         }
                     }
                 }



Mime
View raw message