fix to JSReflection for grabbing from a superclass
[org.ibex.js.git] / src / org / ibex / js / JSReflection.java
index 9c23830..28a514e 100644 (file)
@@ -41,12 +41,16 @@ public class JSReflection extends JS.Immutable {
 
     public JS get(JS key) throws JSExn {
         String k = JSU.toString(key);
-        try {
-            Field f = this.getClass().getField(k);
-            return wrap(f.get(this));
-        } catch (NoSuchFieldException nfe) {
-        } catch (IllegalAccessException nfe) {
-        } catch (SecurityException nfe) { }
+        Class c = this.getClass();
+        while(c != null) {
+            try {
+                Field f = c.getField(k);
+                return wrap(f.get(this));
+            } catch (NoSuchFieldException nfe) {
+            } catch (IllegalAccessException nfe) {
+            } catch (SecurityException nfe) { }
+            c = c.getSuperclass();
+        }
 
         try {
             java.lang.reflect.Method[] methods = this.getClass().getMethods();