fix to JSReflection for grabbing from a superclass
authoradam <adam@megacz.com>
Fri, 7 Jan 2005 18:45:29 +0000 (18:45 +0000)
committeradam <adam@megacz.com>
Fri, 7 Jan 2005 18:45:29 +0000 (18:45 +0000)
darcs-hash:20050107184529-5007d-6e185336b55d9cd9b2d577322ec3dca11baf3c19.gz

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);
 
     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();
 
         try {
             java.lang.reflect.Method[] methods = this.getClass().getMethods();