<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -71,13 +71,16 @@ public class AdaptiveObject implements Scriptable {
         try {
             wrapped.put(name, start, value);
         } catch (NoSuchFieldError nsf) {
-            // morph
             transition(name, value);
         }
     }
 
     public void put(int index, Scriptable start, Object value) {
-        wrapped.put(index, start, value);
+        try {
+            wrapped.put(index, start, value);
+        } catch (NoSuchFieldError nsf) {
+            transition(Integer.valueOf(index), value);
+        }
     }
 
     public void delete(String name) {
@@ -116,26 +119,30 @@ public class AdaptiveObject implements Scriptable {
         return wrapped.hasInstance(instance);
     }
 
-    private synchronized void transition(String name, Object value) {
+    private synchronized void transition(Object id, Object value) {
         AdaptiveBase adaptive = (AdaptiveBase) wrapped;
         Map&lt;Object, Class&gt; map = transitions.get(adaptive.getClass());
         if (map == null) {
             map = new HashMap&lt;Object, Class&gt;();
             transitions.put(adaptive.getClass(), map);
         }
-        Class&lt;?&gt; clazz = map.get(name);
+        Class&lt;?&gt; clazz = map.get(id);
         if (clazz == null) {
             Object[] ids = adaptive.getIds();
             Object[] newIds = new Object[ids.length + 1];
             System.arraycopy(ids, 0, newIds, 0, ids.length);
-            newIds[ids.length] = name;
+            newIds[ids.length] = id;
             clazz = ClassGen.createClass(newIds);
-            map.put(name,clazz);
+            map.put(id, clazz);
         }
         try {
             AdaptiveBase newObj = (AdaptiveBase) clazz.newInstance();
             newObj.initFrom(adaptive);
-            newObj.put(name, newObj, value);
+            if (id instanceof String) {
+                newObj.put((String) id, newObj, value);
+            } else {
+                newObj.put(((Integer) id).intValue(), newObj, value);
+            }
             wrapped = newObj;
         } catch (InstantiationException ie) {
             throw new RuntimeException(ie);</diff>
      <filename>src/org/mozilla/javascript/adaptive/AdaptiveObject.java</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>476f79bf4d95ebe6640e79468be0c8df2f5e8b51</id>
    </parent>
  </parents>
  <author>
    <name>Hannes Walln&#246;fer</name>
    <email>hannesw@gmail.com</email>
  </author>
  <url>http://github.com/hns/rhino-8/commit/8d39b83c5c90341d72ed813029c85ef6d4705783</url>
  <id>8d39b83c5c90341d72ed813029c85ef6d4705783</id>
  <committed-date>2009-11-02T14:48:54-08:00</committed-date>
  <authored-date>2009-11-02T14:48:54-08:00</authored-date>
  <message>Implement transitions for numeric ids</message>
  <tree>376133ecc5ec8bc671a5174b8089642ec8e4d1bc</tree>
  <committer>
    <name>Hannes Walln&#246;fer</name>
    <email>hannesw@gmail.com</email>
  </committer>
</commit>
